关于为什么我的自我配置超出了我的页面布局的\hrule
规定,有什么想法吗?\textwidth
最小工作示例(MWE):
\documentclass{article}
\usepackage{xcolor,colortbl}
\usepackage{tabularx}
\makeatletter
\newcommand{\thickline}{%
\noalign {\ifnum 0=`}\fi \color{red}\hrule height 5pt
\futurelet \reserved@a \@xhline
}
\makeatother
\begin{document}
\begin{tabularx}{\textwidth}{ll}
test & test \\\thickline
test & test \\
\end{tabularx}
\end{document}
答案1
article
,如果您没有另行定义,则以缩进开始段落(例外情况是紧接在章节标题之后的段落)。 可以通过以下方式删除:
- 在环境
\noindent
之前立即添加tabularx
- 将环境封闭
tabularx
在浮动环境中table
将其封闭在
center
环境中\documentclass{article} \usepackage[table]{xcolor} % loads 'colortbl' automatically \usepackage{tabularx} \makeatletter \newcommand{\thickline}{% \noalign {\ifnum 0=`}\fi \color{red}\hrule height 5pt \futurelet \reserved@a \@xhline } \makeatother %---------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} %---------------------------------------------------------------% \begin{document} \section{Tests} \begin{tabularx}{\textwidth}{lX} test & test \\\thickline test & test \\ \end{tabularx} \noindent \begin{tabularx}{\textwidth}{lX} test & test \\\thickline test & test \\ \end{tabularx} \bigskip or \begin{table}[htb] \begin{tabularx}{\textwidth}{lX} test & test \\\thickline test & test \\ \end{tabularx} \end{table} or \begin{center} \begin{tabularx}{\textwidth}{lX} test & test \\\thickline test & test \\ \end{tabularx} \end{center} \end{document}