I have a table with a column that I need to change its type in the middle of the table.
For example, I have a part of the table in which the column will hold a typeset number with some decimal points and some alignment. After some rows, I need the same column to be a simple number (no decimal alignment) and with a different alignment.
For example, something in the lines of
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{lS[table-format=3.2]}
\multicolumn{2}{l}{\textbf{Part 1}} \\
Number & 100 \\
Number & 2.00 \\
% Somehow change the row format
\newrowformat{rS[table-format=1]}
\multicolumn{2}{l}{\textbf{Part 2}} \\
Right & 1 \\
Rigth &10 \\
\end{tabular}
\end{document}
I know that I can use a \multicolumn
1-column span hack to change the type of each cell, but I wanted a more flexible solution that allows me to change the type from that point onwards.
How can I achieve that?
Best Answer
I suggest you simply set up two separate
tabular
environments, with one row of eachtabular
(likely the header row) containing information about the (ex-ante fixed) width of each column.In the following example, vertical lines are used in each
tabular
purely to demonstrate that they line up across the two environments.