Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
1  
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 1

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}}
\usetikzlibrary{matrix}
\tikzpicture
  \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 \\
  };
\endtikzpicture

I hope it helps, though!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.