
我試圖使我的表格左對齊並與文字整體對齊。使用to \textwidth
設法使表格大小合適,但有時無法與文字正確對齊。它稍微縮進,這使得它超出了右側的邊距,並且在下面的範例中看到了不良行為。
這是我的 MNWE:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{longtable,tabu}
\newcommand{\TableSetupFourColumns}{
\rowcolors{2}{gray!25}{white}
\begin{tabu} to \textwidth {lccX}
\rowcolor{gray!50}}
\begin{document}
\section{Test 1}
This is the text I want the table to align with after flushing.\par \noindent
\TableSetupFourColumns
Test & test & test & test\\
\end{tabu}
\end{document}
答案1
你的定義中有一個尾隨空格。使用
\newcommand{\TableSetupFourColumns}{% <----