표 형식에 \multicolumn이 포함된 허위 선행 수평 공백

표 형식에 \multicolumn이 포함된 허위 선행 수평 공백

\multicolumna tabular(또는 ) 내에서 a를 사용하면 에 대해 eft 정렬이 지정되었음에도 tabularx불구하고 열 시작 부분에 추가 가로 간격이 추가된 것 같습니다 . 이 표의 마지막 줄은 이 문제를 보여줍니다.l\multicolumn

여기에 이미지 설명을 입력하세요

공백이 있는 이유는 무엇이며 어떻게 제거합니까?

암호:

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

답변1

매개변수 에 의해 결정됩니다 \arraycolsep. 질문이 "이 건너뛰기를 방지하는 방법"을 의미하는 경우 해결책은 간단합니다.

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

관련 정보