TeX - LaTeX Asked on April 2, 2021
I am making tables with NiceTabular
environment from nicematrix
package and S
-type columns from siunitx
package. These tables have multi-line side headings. In accordance with guidelines for tables composition numbers must be centered vertically in cells or aligned bottom (A. Wolański, Edycja Tekstów):
It is done with the use of m
-type column for side heading, which was suggested by @Werner here.
Moreover in the case of multiline cells in side heading it is necessary to indent all lines with exception for the first line:
How to modify the code to get this effect? I tried apply the solution given here, but without success. How to force the text in the m
-type column to be left-justified?
Code:
documentclass{standalone}
usepackage{nicematrix} % for NiceTabular environment
usepackage{siunitx} % for proper horizontal alignments of numbers
usepackage{booktabs} % for commands toprule, midrule, bottomrule
begin{document}
begin{NiceTabular}{
>{setlength{parindent}{-1em}}m{2cm}
S[table-format=2.2]
S[table-format=3.1]
}
toprule
multicolumn{1}{c}{First descr.} & multicolumn{1}{c}{Second descr.} & multicolumn{1}{c}{Third descr.}
midrule
Long first side heading & 1.1 & 11.1
Also long second side heading & 11.11 & 111.1
bottomrule
end{NiceTabular}
end{document}
Using @Fran comment and the answer concerning ragged right text in the cell I got:
documentclass{standalone}
usepackage{nicematrix} % for NiceTabular environment
usepackage{siunitx} % for proper horizontal alignments of numbers
usepackage{booktabs} % for commands toprule, midrule, bottomrule
usepackage{ragged2e} % for ragged right text
begin{document}
begin{NiceTabular}{
>{RaggedRightarraybackslashhangindent1em}m{3.5cm}
S[table-format=2.2]
S[table-format=3.1]
}
toprule
multicolumn{1}{c}{First descr.} & multicolumn{1}{c}{Second descr.} & multicolumn{1}{c}{Third descr.}
midrule
Long text in the first side heading cell & 1.1 & 11.1
Also long text in the second side heading cell & 11.11 & 111.1
bottomrule
end{NiceTabular}
end{document}
Answered by forrest on April 2, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP