宏内列表环境前的垂直空格

宏内列表环境前的垂直空格

更新

我的问题归结为以下几点:\item在宏中的列表的 s 之前添加了垂直空间。我想要使用的布局基于 Alessandro Plasmati 的 classicthesis 风格的 CV(currvita)模板,并且定义的命令(\MarginText\Description)应生成与文本第一行垂直对齐的边距文本\Description

但是,使用列表时,会在列表前添加垂直空格。我该如何消除这种情况?我已经尝试过\setlength{topskip}{0pt},并且还尝试了包中添加的空间控件enumitem

为什么列表会表现如此?

梅威瑟:

\documentclass[a4paper]{scrartcl}
\reversemarginpar
\newcommand{\MarginText}[1]{\marginpar{\raggedleft#1}}
\newcommand{\Description}[1]{#1}

\begin{document}
\Description{\MarginText{Papers}
\begin{itemize}
\item a bibitem
\item another one
\end{itemize}
}

\end{document}

在此处输入图片描述


旧版

当我\bibentry在经典论文风格的简历中使用时,条目会在换行符后列出,但是我希望\bibentry 下一个到类别(例如论文、会议、海报等)。此外,参考书目列在下面(我不想要)——我该如何更改这种情况?请参阅上传的屏幕截图和下面的 MWE 中的示例。

在此处输入图片描述

平均能量损失

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[a4paper]{scrartcl}
\usepackage[nochapters]{classicthesis} 
\usepackage[LabelsAligned]{currvita} 

%***********************
% FONTS
%***********************
\usepackage{fontspec,xunicode}
\setmainfont[Ligatures={Common,Historical}]{Adobe Caslon Pro}
\setsansfont[Mapping=tex-text,Scale=MatchLowercase]{Futura}


%***********************
% LAYOUT
%***********************
\reversemarginpar % Move the margin to the left of the page 
\newcommand{\MarginText}[1]{\marginpar{\raggedleft\itshape\small#1}\marginparsep0pt} % New command defining the margin text style

\usepackage{xcolor}\renewcommand{\cvheadingfont}{\Huge\sf{\bf}\color{Maroon}} 

\usepackage{hyperref}

\newlength{\datebox}\settowidth{\datebox}{Long  2011} % Set the width of the date box in each block

\newcommand{\NewEntry}[3]{\noindent\hangindent=2em\hangafter=0 \parbox{\datebox}{\small \sffamily \textit{#1}}\hspace{1em} #2 #3 % Define a command for each new block - change spacing and font sizes here: #1 is the left margin, #2 is the italic date field and #3 is the position/employer/location field
\vspace{0.5em}} % Add some white space after each new entry

\newcommand{\Description}[1]{\hangindent=2em\hangafter=0\noindent\raggedright\footnotesize{#1}\par\normalsize\vspace{1em}} % Define a command for descriptions of each entry - change spacing and font sizes here




% bib stuff
\usepackage[round]{natbib}
\usepackage{bibentry}
\nobibliography*


%----------------------------------------------------------------------------------------






\begin{document}

\thispagestyle{empty} % Stop the page count at the bottom of the first page

%----------------------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------

\begin{cv}{\spacedallcaps{The Applicant}}\vspace{1.5em} % Your name

\noindent\spacedlowsmallcaps{Personal Information}\vspace{0.5em} % Personal information heading

\NewEntry{*}{\textit{Born in the USA,}}{19 July 2013} % Birthplace and date 

\NewEntry{email}{\href{mailto:[email protected]}{[email protected]}}% Email address

\NewEntry{address}{Ice cream street 3, 0188484 Popsicle, Alaska} % Personal website

\NewEntry{phone}{(H) +33 (0) 3455 9222\ \ $\cdotp$\ \ (M) +33 (0) 455 1116661} % Phone number(s)

\vspace{1em} % Extra white space between the personal information section and goal

\noindent\spacedlowsmallcaps{Goal}\vspace{1em} % Goal heading, could be used for a quotation or short profile instead

\vspace{2em} % Goal text

%----------------------------------------------------------------------------------------
%   EDUCATION
%----------------------------------------------------------------------------------------

\spacedlowsmallcaps{Education}\vspace{1em}


\NewEntry{2009--2013}{University XYZ}

\Description{\MarginText{Ph.\,D.} Info, info, info\ \ $\cdotp$\ \ School: School of Physics \newline Thesis: \textit{"Title title"} Description: ... \\ Advisors: Dr.\,XC \textsc{Hellloo}}

%----------------------------------------------------------------------------------------
%   PUBLICATIONS
%----------------------------------------------------------------------------------------

\spacedlowsmallcaps{Publications}\vspace{1em}

\Description{\MarginText{Papers}
\begin{itemize}
\item \bibentry{Bohr:1923tl}
\item \bibentry{Bohr:1923tl}  
\end{itemize}
}

\Description{\MarginText{Posters}
Text text text
\begin{itemize}
\item \bibentry{Bohr:1923tl}
\item \bibentry{Bohr:1923tl}  
\end{itemize}
}

\Description{\MarginText{Conferences}
\bibentry{Bohr:1923tl}
}

%------------------------------------------------

\end{cv}

%\nocite{*} 
\bibliographystyle{plainnat} 
\bibliography{lib-x}

\end{document}

库文件

@article{Bohr:1923tl,
author = {Bohr, N},
title = {{The structure of the atom}},
journal = {Nature},
year = {1923},
volume = {112},
pages = {29--44}
}

答案1

这是针对您更新的问题的版本。我使用enumitem它来轻松消除列表上的顶部间距,并在列表之前确保我们垂直备份(此代码现在放在列表选项中)。请注意\leavevmode添加到\MarginText命令中的,以确保间距的一致性:

示例输出

\documentclass[a4paper]{scrartcl}

\reversemarginpar

\newcommand{\MarginText}[1]{\leavevmode\marginpar{\raggedleft#1}\ignorespaces}
\newcommand{\Description}[1]{#1}

\usepackage{enumitem}

\begin{document}

\Description{\MarginText{Papers}
\begin{itemize}[topsep=0pt,partopsep=0pt,before=\vspace*{\dimexpr-\baselineskip-\parskip},after=\vspace*{\baselineskip}]
\item a bibitem
\item another one
\end{itemize}
}

\Description{\MarginText{Other}
Some text

And some more}

\end{document}

在您的示例中,您可能想要定义一个新的列表类型并在必要时使用它:

示例输出

\documentclass[a4paper]{scrartcl}
\usepackage[nochapters]{classicthesis} 
\usepackage[LabelsAligned]{currvita} 

%***********************
% FONTS
%***********************
\usepackage{fontspec,xunicode}
%\setmainfont[Ligatures={Common,Historical}]{Adobe Caslon Pro}
%\setsansfont[Mapping=tex-text,Scale=MatchLowercase]{Futura}


%***********************
% LAYOUT
%***********************
\reversemarginpar % Move the margin to the left of the page 
\newcommand{\MarginText}[1]{\leavevmode\marginpar{\raggedleft\itshape\small#1}\ignorespaces} % New command defining the margin text style

\usepackage{xcolor}\renewcommand{\cvheadingfont}{\Huge\sf{\bf}\color{Maroon}} 

\usepackage{enumitem}
\newlist{thislineitemize}{itemize}{1}
\setlist[thislineitemize]{label=\textbullet,topsep=0pt,partopsep=0pt,before=\vspace*{\dimexpr-\baselineskip-\parskip},after=\vspace*{\baselineskip}}

\usepackage{hyperref}

\newlength{\datebox}\settowidth{\datebox}{Long  2011} % Set the width of the date box in each block

\newcommand{\NewEntry}[3]{\noindent\hangindent=2em\hangafter=0 \parbox{\datebox}{\small \sffamily \textit{#1}}\hspace{1em} #2 #3 % Define a command for each new block - change spacing and font sizes here: #1 is the left margin, #2 is the italic date field and #3 is the position/employer/location field
\vspace{0.5em}} % Add some white space after each new entry

\newcommand{\Description}[1]{\bgroup\hangindent=2em\hangafter=0\noindent
\raggedright\footnotesize#1\par\egroup\vspace{1em}} % Define a command for descriptions of each entry - change spacing and font sizes here

% bib stuff
\usepackage[round]{natbib}
\usepackage{bibentry}
\nobibliography*

\begin{document}

\thispagestyle{empty} % Stop the page count at the bottom of the first page

\begin{cv}{\spacedallcaps{The Applicant}}\vspace{1.5em} % Your name

\noindent\spacedlowsmallcaps{Personal Information}\vspace{0.5em} % Personal information heading

\NewEntry{*}{\textit{Born in the USA,}}{19 July 2013} % Birthplace and date 

\NewEntry{email}{\href{mailto:[email protected]}{[email protected]}}% Email address

\NewEntry{address}{Ice cream street 3, 0188484 Popsicle, Alaska} % Personal website

\NewEntry{phone}{(H) +33 (0) 3455 9222\ \ $\cdotp$\ \ (M) +33 (0) 455 1116661} % Phone number(s)

\vspace{1em} % Extra white space between the personal information section and goal

\noindent\spacedlowsmallcaps{Goal}\vspace{1em} % Goal heading, could be used for a quotation or short profile instead

\vspace{2em} % Goal text

%----------------------------------------------------------------------------------------
%   EDUCATION
%----------------------------------------------------------------------------------------

\spacedlowsmallcaps{Education}\vspace{1em}


\NewEntry{2009--2013}{University XYZ}

\Description{\MarginText{Ph.\,D.} Info, info, info\ \ $\cdotp$\ \ School: School of Physics \newline Thesis: \textit{``Title title''} Description: \dots \\ Advisors: Dr.\,XC \textsc{Hellloo}}

%----------------------------------------------------------------------------------------
%   PUBLICATIONS
%----------------------------------------------------------------------------------------

\spacedlowsmallcaps{Publications}\vspace{1em}

\Description{\MarginText{Papers}
\begin{thislineitemize}
\item \bibentry{Bohr:1923tl}
\item \bibentry{Bohr:1923tl}  
\end{thislineitemize}
}

\Description{\MarginText{Posters}
Text text text
\begin{itemize}
\item \bibentry{Bohr:1923tl}
\item \bibentry{Bohr:1923tl}  
\end{itemize}
}

\Description{\MarginText{Conferences}
\bibentry{Bohr:1923tl}
}

%------------------------------------------------

\end{cv}

%\nocite{*} 
\bibliographystyle{plainnat} 
\bibliography{lib-x}

\end{document}

至于一般的“为什么”,列表环境作为标准以换行符开始。这通常是可取的,因为您不必担心调用是否在段落内。但在某些情况下,这并不是人们想要的。

答案2

最后不要列出参考文献,而要\bibliography{lib-x}\nobibliography{lib-x}。来源:http://gking.harvard.edu/files/bibentry2.pdf

“会议”部分之所以有换行符,是因为您在其中放置了一个换行符,即您写道

\Description{\MarginText{Conferences}

\bibentry{Bohr:1923tl}
}

但你可以通过以下方式删除换行符

\Description{\MarginText{Conferences}
\bibentry{Bohr:1923tl}
}

在我的测试中,这弄乱了 的位置\MarginText,但我不知道为什么。我认为“论文”部分出现换行符的原因与 有关itemize,但这可能是错误的。

相关内容