表格中项目符号 (\item) 的对齐方式

表格中项目符号 (\item) 的对齐方式

我正在使用模板做我的简历,但我遇到了一个问题。我试图删除下面 MWE 中除基本代码之外的所有代码。它生成两个表格。在第一个表中,项目符号与第一列文本不对齐,但在第二个表中,没有项目符号,文本对齐正确。有人能帮忙解决这个对齐问题吗?

梅威瑟:

\documentclass[12pt,letterpaper,twoside]{article}

\usepackage{array}% required for defining newcolumntype with custom vrule
\usepackage{longtable}% normal \tabular environment does not allow page breaks
\setlength{\LTpre}{0pt}% glue before longtable
\addtolength{\LTpost}{0pt}% glue after longtable

\newcommand{\datewidth}{0.21}
\newcommand{\bodywidth}{0.75}

\newcolumntype{L}{>{\raggedright}p{\datewidth\textwidth}}
\newcolumntype{R}{p{\bodywidth\textwidth}}

\newenvironment{cvsection}{%
    \setlength{\extrarowheight}{0.40ex}
    \begin{longtable}[l]{@{} L R @{}}
        % Comment line above and uncomment line below to add gray vrule between date and body.
        % \begin{longtable}{@{} L !{\myvrule} R @{}}
    }{%
    \end{longtable}
}

\begin{document}

\begin{cvsection}
    abc1    & \parbox[t]{\bodywidth\textwidth}{%
   \begin {itemize} \item {\footnotesize TEST TEXT TEST TEXT TEST TEXT TEST TEXT TEST TEXTTEST TEXTTEST  TEXT.} 
    \end {itemize} }\\
\end{cvsection} 

\begin{cvsection}

    abc2 & \parbox[t]{\bodywidth\textwidth}{%
     {\footnotesize TEST TEXT TEST TEXT TEST TEXT TEST TEXT TEST TEXTTEST 
     TEXTTEST TEXT.} }\\

\end{cvsection} 

\end{document}

答案1

这是因为列表环境在列表前后的文本之间添加了垂直间距。您可以欺骗 LaTeX,让它相信您位于小页面的开头:在这种情况下,上面没有空格,原因很明显。这就是宏的作用\compress

此外,我将项目符号与另一个表中的文本开头对齐,因为在我看来,在包的帮助下,无需缩进项目符号enumitem

\documentclass[12pt,letterpaper,twoside]{article}

\usepackage{array}% required for defining newcolumntype with custom vrule
\usepackage{longtable}% normal \tabular environment does not allow page breaks
\makeatletter
    \newcommand*{\compress}{\@minipagetrue}
\makeatother
\usepackage{enumitem}
\setlength{\LTpre}{0pt}% glue before longtable
\addtolength{\LTpost}{0pt}% glue after longtable

\newcommand{\datewidth}{0.21}
\newcommand{\bodywidth}{0.75}

\newcolumntype{L}{>{\raggedright}p{\datewidth\textwidth}}
\newcolumntype{R}{p{\bodywidth\textwidth}}

\newenvironment{cvsection}{%
    \setlength{\extrarowheight}{0.40ex}
    \begin{longtable}[l]{@{} L >{\compress}R @{}}
        % Comment line above and uncomment line below to add gray vrule between date and body.
        % \begin{longtable}{@{} L !{\myvrule} R @{}}
    }{%
    \end{longtable}
}

\begin{document}

\begin{cvsection}
    abc1 & \parbox[t]{\bodywidth\textwidth}{%
   \begin {itemize}[wide, leftmargin=*] \item {\footnotesize TEST TEXT TEST TEXT TEST TEXT TEST TEXT TEST TEXTTEST TEXTTEST TEXT.}
    \end {itemize} }\\
\end{cvsection}

\begin{cvsection}

    abc2 & \parbox[t]{\bodywidth\textwidth}{%
     {\footnotesize TEST TEXT TEST TEXT TEST TEXT TEST TEXT TEST TEXTTEST
     TEXTTEST TEXT.} }\\

\end{cvsection}

\end{document} 

enter image description here

相关内容