Decimal Point Alignment in Latex

By ET

UPDATE: A web-based version is available. You don’t need to upload the whole file to do the conversion now.

Check out the new version at: http://blog.mikezhang.com/dcolumn/processtable.cgi.


It has been a headache to do decimal point alignment in latex.

Fortunately, there is a package called dcolumn that helps with this problem.

This dcolumn package “defines a system for defining columns of entries in an array or tabular which are to be aligned on a decimal point.”

Unfortunately, it is very hard to make the modifications manually on the tables to align the decimal points of numbers. I searched online and could not find a solution. So I created a web service that does this:

Basically, just visit the webpage: http://blog.mikezhang.com/dcolumn/.

screen-capture-21

There is only one field for you to browse a latex file. Make sure it has extension .tex, otherwise, the system would not accept the file.

Click Submit, you will obtain the converted file with correctly aligned numbers in your tables.

See the screen shot of the finished page:

screen-capture-3

Now clicking “FILE” will bring you the new file, in txt format. You need to change the extension to .tex to try it out. This intended trouble helps you to avoid overwriting your original file.

Here is how it worked on a paper:

Before:

screen-capture6

and After:

screen-capture-11

  1. 1
    Dave Johansen Says:

    This is a really cool tool and thanks for making it available, but whenever I use it, it makes the vertical bars in my header go away (I assume that’s from the use of \multicolumn). Is there a way to fix that?

  2. 2
    Dave Johansen Says:

    I actually noticed that the documentation had an example of what I wanted to do and so I looked at the source and noticed that I needed to add a “|” to the \multicolumn definition to make it still have the vertical separator.

    Here’s an example:
    \multicolumn{1}{c|}{Text}

  3. 3
    ET Says:

    Dave,

    Thanks for the comments. I’ll see if I can give a quick fix for that. The program is getting messy after a lot of patches and quick hacks. :-p

    Michael

  4. 4
    Gareth Says:

    This is really cool. Many thanks for sharing this tool, you just improved my thesis productivity somewhat!

    Best wishes.

Leave a Reply


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2010. All rights reserved.
All trademarks property of their owners.