This question is related to this one: Colour only the text in a tabularx environment
I want to write as a succession of equality in blue (only the numbers) so that each line of the table has a corresponding equality line to its right.
\documentclass{article}
\usepackage{amsmath,numprint,tabularx,xcolor}
\begin{document}
\begin{minipage}{.4\linewidth}
\begin{tabularx}{5cm}{|*{11}{>{\leavevmode\color{blue}}X|}}
\hline
\multicolumn{2}{|c|}{$\rm m^2$} &
\multicolumn{2}{c|}{$\rm dm^2$} &
\multicolumn{2}{c|}{$\rm cm^2$} &
\multicolumn{2}{c|}{$\rm mm^2$} \\
\hline
&&&4,&&&& \\
&&&4&0&0&0& 0,\\
&0,&0&4&&&& \\
\hline
\end{tabularx}
\end{minipage}\quad
\begin{minipage}{.2\linewidth}
\begin{align*}
&\numprint[dm^2]{4}\\
&=\numprint[mm^2]{40000}\\
&=\numprint[m^2]{0,04}
\end{align*}
\end{minipage}
\end{document}
In the numprint manual, there is a hack that allows you to color the negative numbers on pages 18-19, I couldn't modify it to write the numbers in blue.
\makeatletter
\expandafter\renewcommand\csname nprt@sign@-\endcsname{%
\color{red}{\ensuremath{-}}}
\makeatother




w{c}{1em}, which is exactly how to make a 1em wide column with center alignment; (requiresarray). The comma is “hidden” by\rlap. – egreg Dec 27 '18 at 18:50tabularxis not the right tool because you don't know the target width; if you have several similar tables to this one, the width of the digit columns should be the same across the document – egreg Jan 03 '19 at 10:56w{}{}specificator, do you know where I can find it? – AndréC Apr 16 '21 at 06:47texdoc array– egreg Apr 16 '21 at 06:48