
셀 421과 237(이 예에서는) 중 하나가 어떤 방식으로든 강조 표시되면(굵게, 색상 등) 정렬되지 않습니다. 필요한 경우에만 S 열을 사용했습니다. 다음은 작은 예입니다.
\documentclass{report}
\usepackage{tabu, longtable}
\begin{document}
\begin{longtabu} to \textwidth {X[2, l]X[c]X[c]X[c]X[c]S[table-format=4]X[c]}
& \multicolumn{2}{c}{\textbf{column1}} & \multicolumn{4}{c}{\textbf{column2}} \\
& a & b & c & d & e & f \\
\textbf{round1} & 2.876 & 22 & 5.837 & 2.433 & \textbf{421} & 5.235 \\
& & & & 6.564 & 4.434 & 237 & 1.345 \\
\end{longtabu}
\end{document}
답변1
패키지가 누락되었습니다 siunitx
. e
두 번째 행 주위에 중괄호를 추가하고 detect-weight
설정에 추가하여 S
사용하십시오.
\protected\bfseries 421
굵은 글씨를 정렬하려면 421
:
\documentclass{report}
\usepackage{tabu, longtable}
\usepackage{siunitx}
\begin{document}
\begin{longtabu} to \textwidth {X[2, l]X[c]X[c]X[c]X[c]S[table-format=4,detect-weight]X[c]}
& \multicolumn{2}{c}{\textbf{column1}} & \multicolumn{4}{c}{\textbf{column2}} \\
& a & b & c & d & {e} & f \\
\textbf{round1} & 2.876 & 22 & 5.837 & 2.433 & \protected\bfseries 421 & 5.235 \\
& & & 6.564 & 4.434 & 237 & 1.345 \\
\end{longtabu}
\end{document}
불행히도 가 있는 열 \color
에서는 작동하지 않는 것 같습니다 . 하지만 다음을 사용할 수 있습니다 .S
tabu
\tablenum
\multicolumn{1}{c}{\tablenum[table-format=4,color=orange]{421}}
암호:
\documentclass{report}
\usepackage{tabu, longtable}
\usepackage{siunitx}
\usepackage[table]{xcolor}
\begin{document}
\begin{longtabu} to \textwidth {X[2, l]X[c]X[c]X[c]X[c]S[table-format=4,detect-weight]X[c]}
& \multicolumn{2}{c}{\textbf{column1}} & \multicolumn{4}{c}{\textbf{column2}} \\
& a & b & c & d & {e} & f \\
\textbf{round1} & 2.876 & 22 & 5.837 & 2.433 & \multicolumn{1}{c}{\tablenum[table-format=4,color=orange]{421}} & 5.235 \\
& & & 6.564 & 4.434 & 237 & 1.345 \\
\end{longtabu}
\end{document}
또는
\multicolumn{1}{>{\cellcolor{gray}}c}{\tablenum[table-format=4,color=orange]{421}}
\documentclass{report}
\usepackage{tabu, longtable}
\usepackage{siunitx}
\usepackage[table]{xcolor}
\newcommand\specSc{}
\def\specSc#1[#2]#3{%
\multicolumn{1}{>{#1}c}{\tablenum[#2]{#3}}%
}
\begin{document}
\begin{longtabu} to .5\textwidth {X[l]S[table-format=4.1]S[table-format=1.3,detect-weight]}
& {e} & {f} \\
\textbf{round1}
& \specSc{\bfseries}[table-format=4.1,detect-weight]{421.3}
& 5.235 \\
& \specSc{\color{orange}}[table-format=4.1]{237}
& \specSc{}[table-format=1.3,color=purple]{1.34} \\
& \specSc{\cellcolor{lightgray}}[table-format=4.1,color=blue]{237.2}
& \protected\bfseries 1.342 \\
\end{longtabu}
\end{document}