第二列超出边距

第二列超出边距

我用它tabular来制作两列不同宽度的列。理想情况下,我希望每列的标题下都有一条水平线,第一列的标题下有一条水平线,一直到列尾,第二列的标题下有一条水平线,一直到边距。我用了\hrule,它延伸到了边距之外。下面是一段代码:

\documentclass[10pt]{article}
\usepackage{geometry,array}

\geometry{verbose,tmargin=40pt,bmargin=40pt,lmargin=30pt,
rmargin=30pt}

\newcolumntype{R}{>{\raggedright}p{0.4\textwidth}}
\newcolumntype{L}{p{0.6\textwidth}}
\begin{document}

\begin{tabular}{L R}
{\subsection*{EDUCATION}}
\hrule
\vspace{2mm}
&
{\subsection*{SKILLS}}
\hrule
\vspace{2mm}
\end{tabular}

\end{document}

\hrule我怎样才能以比玩弄右列中的值更好的方式实现第二个不超过右边距的期望结果?

答案1

这可行,但正如我在评论中提到的,您的几何设置不是最佳的:

\documentclass[10pt]{article}
\usepackage{geometry,array}
\usepackage{calc}
\geometry{verbose,tmargin=40pt,bmargin=40pt,lmargin=30pt,
    rmargin=30pt}
\usepackage{showframe} % shows you the cut-off side margin

\begin{document}
    \noindent % If the table stands alone, as it is, it will get a paragraph indent without this command.
    %\tabcolsep=15pt % if you want to change the blank width in the middle  
    \begin{tabular}{@{}p{0.46\textwidth} >{\raggedright\arraybackslash}p{0.54\textwidth-2\tabcolsep}}
        {\subsection*{EDUCATION}}
        \hrule
        \vspace{2mm}
        &
        {\subsection*{SKILLS}}
        \hrule
        \vspace{2mm}
    \end{tabular}   
\end{document}

在此处输入图片描述

相关内容