Skip to main content.
January 18th, 2007

First steps with report writing and LaTeX

Recently at work I put a lot of effort in documenting things. I use my intranet MediaWiki page to keep note of all sort of useful info. Links, snippets of batch files, install processes. Things that one tends to forget and re-use again.
I also got access to a server and installed Wordpress where I keep a very simple blog in (very simple) Japanese.
Wiki’s are great to gather information, but they aren’t very good for diary-like reports and don’t make it easy to leave simple comments. Wordpress is much better, but still sucks because it doesn’t implement comments’ preview !

I also started learning about LaTeX to write simple research reports. I don’t want to sound geeky, but LaTeX seems to make a lot more sense than plainly using Microsoft Word or any other word processor. With LaTeX I can write down text and include images without worrying about layout. With a parameter I can tell it if I want a document to look like a IEEE paper or a Siggraph paper and just recompile it !
Things of course aren’t so smooth. For example today I drew a vector-based image with OpenOffice Draw. OO Draw makes you draw on canvases of printable document size, for example an A4. However one often needs just to save out a portion of the page. For example a graph that needs to go on a sub-figure in the LaTeX paper.
OO Draw allows to save out just a selection, but it does so by including the saved selection in a page sized as the whole document !
It took me a while to find out that this is a known issue that dates back to 2004 ! Luckily someone wrote a macro that can export the selection without the canvas size.. but in the process of discovering all this I felt a bit stupid. Lost in the process of writing something as I’m not even sure about the contents !!

Documenting seems like big waste of time. But this is mostly due to the fact that I have little experience on writing proper reports, however this is the only way I can demonstrate and communicate about my findings, and it’s also a good way to keep a reference of things that one tends to forget.

moomooo !

Posted by Davide Pasca in report writing, LaTeX, OpenOffice

This entry was posted on Thursday, January 18th, 2007 at 2:43 am and is filed under report writing, LaTeX, OpenOffice. You can follow any responses to this entry through the comments RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “First steps with report writing and LaTeX”

  1. rince says:

    Problem with documenting is that it progressively occupies more and more of your time as you try to keep it up to date.

    Anyway, so recently I ran into a problem where I needed to solve a set of 686 linear equations. (To calculate coeffcients of a 686 degree polynomial). So I quickly ran into the problem of not having enough bits in the built in c/c++ numerical types to store intermediate results. A number raised to the power of 686 needs a lot of bits to represent itself!!!!

    So I implemented integer math code that works on arbitrary size arrays of unsigned int, thus giving me as many bits as I need. This was actually not too trivial, especially the multiplication and division!

    Anyway I thought this could be a good opportunity to give c++ operator overriding another try, as I always stayed away from that on the grounds of it being very obfuscated to debug later on. And very quickly I indeed confirmed my initial views! Here is the case:

    I have the following code:

    // constructor
    integer::integer(const unsigned int bits, const unsigned int *pValue)
    {
    assert((bits & 0×1F) == 0);
    mpValue = new unsigned int[bits / 0×20];
    assert(mpValue);
    unsigned int i;
    for(i = 0; i > 32);
    }
    }

    // operator -
    integer integer::operator-() const
    {
    integer neg(mBits, mpValue);
    neg.twos_compliment( );
    return neg;
    }

    So lets say I do something like:

    unsigned int arr[2] = { 1, 0 };
    integer b(64, arr);
    b =-b;

    Looks good, right? But it crashes in a destructor of “integer” trying to delete mpValue.

    Why?

    Well what seems to happen is that when the - operator is called c++ creates a ‘hidden’ instance of “integer” when executing

    return neg;

    Since there is no ‘=’ anywhere in that statement the default assignment operator gets called so the mpValue in this ‘hidden’ instance is now pointing to the same place as mpValue of ‘neg’.

    Then when the - operator goes out of scope destructor of ‘neg’ gets called and deletes mpValue, but the ‘hidden’ instance is still alive because it is needed for the b =-b statement, however once b=-b is executed, destructor for the ‘hidden’ instance gets called and it crashes trying to delete its mpValue, because it already has been deleted….

    So the fix was to implement another constructor:

    // constructor
    integer::integer(integer &src)
    {
    mBits = src.bits( );
    mpValue = new unsigned int[mBits / 0×20];
    unsigned int i;
    for(i = 0; i

  2. rince says:

    eeehhh wtf, half of my comment didnt make it…. bah, even parts in the middle of the article have gone missing…

  3. Davide Pasca says:

    Talk about the difficulty of documenting 8P
    Wordpress is officially a piece of crap. I just created a test user and posted a comment with that account. Apparently there is no way to delete your own comments even if you are a registered user !!
    I’m seriously considering going back to blogger.com.. especially now that it allows to host the blog on your own domain.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>