我正在使用一個範本去做我的履歷,但我遇到了問題。我嘗試刪除下面 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}