TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

Your Answer


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.