水平线延伸至桌子边缘

水平线延伸至桌子边缘

我遇到了一个问题,tabular表格中的\hlines 超出了表格边缘。我已通过使用\clines 解决了该问题,使其从第一个单元格延伸到最后一个单元格 ( \cline{1-18}),但这似乎是强制的。有什么理由不使用 \hline 吗?

注意,我留下了一条水平线作为 \hline。

梅威瑟:

\documentclass{article}

\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}

\newcounter{vonecount}
\setcounter{vonecount}{0}
\newcommand{\vone}{\stepcounter{vonecount}\thevonecount}

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}

\begin{tabular}{r|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}|C{2mm}} 
\cline{1-18}
\multicolumn{1}{|r|}{Section One}                           &   
\multicolumn{17}{>{\centering}p{4in}|}{Part One - Synonyms} \\ 
\cline{1-18}
Question \#     &   
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone \\
\cline{2-18}
Correct Answer  & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A \\
Your Answer     & & & & & & & & & & & & & & & & & &  \\
\cline{1-18}
\multicolumn{1}{|r|}{Section One}                                       &   
\multicolumn{17}{>{\centering}p{4in}|}{Part Two - Sentence Completions} \\ 
\cline{1-18}
Question \#     &   
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone & 
\vone \\
\cline{2-18}
Correct Answer  &   
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A & 
A \\
Your Answer     & & & & & & & & & & & & & & & & & &  \\
\hline
\multirow{2}{*}{Scores}                 &   
\multicolumn{4}{c|}{Correct}            &   
\multicolumn{4}{c|}{Total}              &   
\multicolumn{4}{c|}{Stanine}            &   
\multicolumn{5}{c|}{Percentile Rank}    \\
\cline{2-18}
                        &   
\multicolumn{4}{c|}{}   &   
\multicolumn{4}{c|}{}   &   
\multicolumn{4}{c|}{}   &   
\multicolumn{5}{c|}{}   \\
\cline{2-18}
\end{tabular}

\end{document}

答案1

&对于我来说,只要删除第 19 列并删除多余的部分,就可以了:

包含 18 列的表格

\documentclass{article}

\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}

\newcounter{vonecount}
\setcounter{vonecount}{0}
\newcommand{\vone}{\stepcounter{vonecount}\thevonecount}

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}

\begin{tabular}{r|*{17}{C{2mm}|}}
\hline
\multicolumn{1}{|r|}{Section One}                           &
\multicolumn{17}{>{\centering}p{4in}|}{Part One - Synonyms} \\
\hline
Question \#     &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone \\
\hline
Correct Answer  &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A \\
Your Answer     & & & & & & & & & & & & & & & & &   \\
\hline
\multicolumn{1}{|r|}{Section One}                                       &
\multicolumn{17}{>{\centering}p{4in}|}{Part Two - Sentence Completions} \\
\hline
Question \#     &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone &
\vone \\
\hline
Correct Answer  &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A &
A \\
Your Answer     & & & & & & & & & & & & & & & & &   \\
\hline
\multirow{2}{*}{Scores}                 &
\multicolumn{4}{c|}{Correct}            &
\multicolumn{4}{c|}{Total}              &
\multicolumn{4}{c|}{Stanine}            &
\multicolumn{5}{c|}{Percentile Rank}    \\
\cline{2-18}
                        &
\multicolumn{4}{c|}{}   &
\multicolumn{4}{c|}{}   &
\multicolumn{4}{c|}{}   &
\multicolumn{5}{c|}{}   \\
\hline
\end{tabular}

\end{document}

我不确定这是否符合预期,但它解决了问题中确定的问题。booktabs不过,你可能需要阅读文档。

相关内容