estoy usando unplantillapara hacer mi CV pero me he encontrado con un problema. Intenté eliminar todo menos el código esencial en el MWE a continuación. Hace dos mesas. En la primera tabla, la viñeta no se alinea con el texto de la primera columna, sin embargo, en la segunda tabla, sin la viñeta, el texto está alineado correctamente. ¿Alguien puede ayudar a solucionar este problema de alineación?
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}
Respuesta1
Esto se debe a que el entorno de listas agrega un espaciado vertical al texto antes y al texto después de la lista. Puedes engañar a LaTeX haciéndole creer que estás al principio de una minipágina: en este caso, no hay espacio arriba, por razones obvias. Eso es lo que \compress
hace la macro.
Además, alineé la viñeta con el comienzo del texto en la otra tabla, ya que, en mi opinión, no es necesario sangrar la viñeta con la ayuda del enumitem
paquete.
\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}