我正在写一份简历将节标题放在加宽的左边距中。在下面的例子中,我试图获取itemize
部分酒吧与节标题垂直对齐,就像其他两个节中的内容对齐一样。但是,在itemize
节开头的 之前有一个不受欢迎的间隙,尽管有几种设置旨在防止这种情况(例如topsep=0pt
)。
我缺少什么来“消耗”这个空间并将其itemize
提升? 我尝试过否定\vspace
和\vskip
,但这充其量只是一种破解方法,而且容易出现反复试验。(相关地,我的一些\setlist
选项是否对此没有必要?)
\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=0.75in, left=1.5in]{geometry}
% Section headers in margins
% https://tex.stackexchange.com/a/1315/10906
\usepackage{titlesec}
\titleformat{\section}[leftmargin]
{\sffamily}
{}{0pt}{}
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{2pc}
\setlength\parindent{0pt}
\usepackage{enumitem}
\setlist{nolistsep, nosep, topsep=0pt}
\setlength{\parskip}{0.5ex}
\begin{document}
\section{Education}
\textbf{Metasyntactic University \dotfill Date}
\begin{itemize}
\item Degree 1
\item Certificate 2
\end{itemize}
\section{Foo}
This is some brief free-form text about some stuff that I can do. Did you know I do Thing~3 and Thing~4? It's pretty cool; I know.
\section{Bar}
\begin{itemize}
\item Skill 5
\item Skill 6
\end{itemize}
\end{document}
答案1
通过垂直跳回到同一基线来手动纠正此行为:
\documentclass[10pt]{article}
\usepackage[margin=0.75in, left=1.5in]{geometry}
% Section headers in margins
% http://tex.stackexchange.com/a/1315/10906
\usepackage{titlesec}
\titleformat{\section}[leftmargin]
{\sffamily}
{}{0pt}{}
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{2pc}
\setlength\parindent{0pt}
\usepackage{enumitem}
\setlist{nolistsep, nosep, topsep=0pt}
\setlength{\parskip}{0.5ex}
\begin{document}
\section{Education}
\textbf{Metasyntactic University \dotfill Date}
\begin{itemize}
\item Degree 1
\item Certificate 2
\end{itemize}
\section{Foo}
This is some brief free-form text about some stuff that I can do. Did you know I do Thing~3 and Thing~4? It's pretty cool; I know.
\section{Bar}
\leavevmode% Start paragraph
\par% End paragraph/enter vertical mode
\vspace{\dimexpr-\baselineskip-\parskip}% Vertically jump back to baseline of section
\begin{itemize}
\item Skill 5
\item Skill 6
\end{itemize}
\end{document}