Latex 乳胶\hr超过表宽
这是我的密码:Latex 乳胶\hr超过表宽,latex,Latex,这是我的密码: \begin{table}[H] \begin{tabularx}{\textwidth}{sfmX} \noalign{\hrule height 1.5pt} \rowcolor{orange!85} Version & Date & Autore & Description \\ \noalign{\hrule height 1.5pt}
\begin{table}[H]
\begin{tabularx}{\textwidth}{sfmX}
\noalign{\hrule height 1.5pt}
\rowcolor{orange!85} Version & Date & Autore & Description \\
\noalign{\hrule height 1.5pt}
1.1.1 & 2016-01-11 & Person 1 & Action 1 \\
\noalign{\hrule height 0.5pt}
1.1.0 & 2016-01-10 & Person 2 & Action 2 \\
\noalign{\hrule height 1.5pt}
\end{tabularx}
\caption{Diary \label{tab:table_label}}
\end{table}
与:
\newcolumntype{s}{>{\hsize=.22\hsize}X}
\newcolumntype{f}{>{\hsize=.4\hsize}X}
\newcolumntype{m}{>{\hsize=.5\hsize}X}
结果:
是否有任何方法可以删除超出的\noalign{\hrule}
s?
不知道为什么Tablerx不会占用所有空间,或者为什么规则占用了太多空间 问题实际上是彩色标题行比
\hrule
s短,因为它们非常适合\textwidth
。此外,您对列s
的选择太窄
相反,我建议您放弃使用\hr规则
s,因为您可以使用以下中已有的结构:
我自己找到了解决方案:不是因为\hline超过了颜色,而是因为颜色没有覆盖整个桌子。这是由于列%没有精确到100%造成的。给出0.2,0.4,0.4解决了这个问题
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs,tabularx}
\colorlet{headcol}{orange!85}
\newcommand{\headcol}{\rowcolor{headcol}}
\newcommand{\toprulec}{\arrayrulecolor{black}\specialrule{0.1em}{\abovetopsep}{0pt}%
\arrayrulecolor{headcol}\specialrule{\belowrulesep}{0pt}{0pt}%
\arrayrulecolor{black}}
\newcommand{\midrulec}{\arrayrulecolor{headcol}\specialrule{\aboverulesep}{0pt}{0pt}%
\arrayrulecolor{black}\specialrule{\lightrulewidth}{0pt}{0pt}%
\arrayrulecolor{white}\specialrule{\belowrulesep}{0pt}{0pt}%
\arrayrulecolor{black}}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{l l l X}
\toprulec
\headcol Version & Date & Autore & Description \\
\midrulec
1.1.1 & 2016-01-11 & Person 1 & Action 1 \\
1.1.0 & 2016-01-10 & Person 2 & Action 2 \\
\bottomrule
\end{tabularx}
\end{document}