6

When I use a \multicolumn within a tabular (or tabularx) there seems to be additional horizontal spacing added at the beginning of the column even though the left alignment was specified for \multicolumn. The last line in this table shows this issue:

enter image description here

Why is the spacing there, and how do I eliminate it?

Code:

\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}
2
  • 1
    You have to use \multicolumn{3}{@{}l}{ as \multicolumn overrides previous settings.
    – user11232
    Sep 29 '14 at 2:02
  • @HarishKumar: Dammm!! So its a general tabular issue and not something specific to tabularx. Can't believe I have not encountered that problem with tabular before. Have edited question to reflect that. Sep 29 '14 at 2:10
7

It is determined by the \arraycolsep parameter. If you question means "how to avoid this skip", the solution is simple:

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.