Take the 2-minute tour ×

Is there a way to align numbers in a TikZ matrix at the decimal points, as is possible in normal tables (Aligning numbers by decimal points in table columns)?

http://www.texample.net/tikz/builds/ says that a feature that "Added '/pgf/number format/assume math mode' to disable math checks. This allows to assemble tabulars, apply pgfmathprintnumber to each cell and use the dcolumn package to align at decimal separators (no documentation for that feature yet)" was made in June of 2008, but nothing else.

share|improve this question
FWIW, that feature you're looking at seems to be about using pgfmath-parsed expressions inside tabulars, not pgf matrices. –  Matthew Leingang Dec 31 '10 at 5:21
add comment

1 Answer

This is a really, really, hackish and verbose and ugly idea, where pretty much the only bright side is that you get decimal point alignment given that each and every piece of input includes the decimals. I used commas, you might prefer periods. Also you might need to tweak the column sep -setting.

\def\decsp #1,#2 {\llap{#1},\rlap{#2}}
  \matrix[matrix of nodes, column sep=2cm] {
    \decsp 0,015 & \decsp 52,432 \\
    \decsp 10,2  & \decsp 1084,85 \\
    \decsp 104,8 & \decsp 0,345 \\

I hope it helps, though!

share|improve this answer
add comment

Your Answer


