标题中的 \makecell:如何去除表格最后一列后的空格?

标题中的 \makecell:如何去除表格最后一列后的空格?

除了末尾剩余的空间外,这个表对我来说很完美:

在此处输入图片描述

我该如何消除它?@{}不起作用!

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{makecell}

\usepackage[british]{babel}
\begin{document}

\begin{tabular}{@{}l*{3}{S[table-format=3]}@{}}
    \toprule 
     & \multicolumn{1}{c}{Lions} &  \multicolumn{1}{c}{Ducks} & \multicolumn{1}{l}{\makecell{Ducks and\\ Lions}} \tabularnewline
    \midrule
    Tizio & 1 & 10 & 100\tabularnewline
    Caio & 20 & 200 & 2\tabularnewline
    Sempronio & 300 & 3 & 30\tabularnewline
    \bottomrule
\end{tabular}

\end{document}

答案1

您需要的\multicolumn规范包括@{}

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{makecell}

\usepackage[british]{babel}
\begin{document}

\begin{tabular}{@{}l*{3}{S[table-format=3]}@{}}
    \toprule 
     & \multicolumn{1}{c}{Lions} &  \multicolumn{1}{c}{Ducks} & \multicolumn{1}{l@{}}{\makecell{Ducks and\\ Lions}} \tabularnewline
    \midrule
    Tizio & 1 & 10 & 100\tabularnewline
    Caio & 20 & 200 & 2\tabularnewline
    Sempronio & 300 & 3 & 30\tabularnewline
    \bottomrule
\end{tabular}

\end{document}

相关内容