Quando uso a \multicolumn
dentro de a tabular
(ou tabularx
), parece haver espaçamento horizontal adicional adicionado no início da coluna, mesmo que o l
alinhamento eft tenha sido especificado para \multicolumn
. A última linha desta tabela mostra esse problema:
Por que existe o espaçamento e como eliminá-lo?
Código:
\documentclass{article}
\usepackage{tabularx}
\usepackage[showframe,textwidth=7.0cm]{geometry}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{@{}X l l@{}}
Sub Item 1 & 3,000 \\
Sub Item 2 & 4,000 \\
Total & & 7,000 \\
\multicolumn{3}{l}{$\leftarrow$ Why is there space to the left of this?} \\
\end{tabularx}
\bigskip
\par\noindent
\begin{tabular}{@{}l l l@{}}
Sub Item 1 & 3,000 \\
Sub Item 2 & 4,000 \\
Total & & 7,000 \\
\multicolumn{3}{l}{$\leftarrow$ Why is there space to the left of this?} \\
\end{tabular}
\end{document}
Responder1
É determinado pelo \arraycolsep
parâmetro. Se você questiona “como evitar esse pulo”, a solução é simples:
\documentclass{article}
\usepackage{tabularx}
\usepackage[showframe,textwidth=7.0cm]{geometry}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{@{}X l l@{}}
Sub Item 1 & 3,000 \\
Sub Item 2 & 4,000 \\
Total & & 7,000 \\
%\multicolumn{3}{l}{$\leftarrow$ Why is there space to the left of this?} \\
\multicolumn{3}{@{}l}{$\leftarrow$ Why is there space to the left of this?} \\
\end{tabularx}
\end{document}