在简历文档类中,如何创建没有项目的子部分?

在简历文档类中,如何创建没有项目的子部分?

我有一份文档,其中有我可能有或没有要枚举的项目的小节:

\documentclass[10pt,a4paper]{resume} % Use the custom resume.cls style  
\usepackage[left=0.4 in,top=0.4in,right=0.4 in,bottom=0.4in]{geometry} % Document margins
\usepackage{eurosym}
\usepackage[usenames, dvipsnames]{color}

\begin{document}

\begin{rSection}{Section1}

\begin{rSubsection}{Sub1}{}
{}{}
\item[] MyItem1
\item[] MyItem2
\end{rSubsection}

\begin{rSubsection}{MyEmptySubsection}{}
{}{}
\end{rSubsection}

\begin{rSubsection}{Sub2}{}
{}{}
\item[] MyItem1
\end{rSubsection}

\end{rSection}

\end{document}

我的问题是它不接受像第二个这样的没有项目的子部分。我该如何解决这个问题?

(请注意,我希望保持每个小节之间完全相同的字体、间距等)

简历.cls可以在那里找到: https://github.com/treyhunner/resume

答案1

我认为一个好方法是为一个设计为空的小节创建一个新的环境,然后给它起一个新名字,比如rEmptySubsection您正在使用的课程的来源rSubsection,带有列表的环境如下:

\newenvironment{rSubsection}[4]{
  %%%%%%%%%%%%%%%%%%%%%% Default Layout: %%%%%%%%%%%%%%%%%%%%%%%%
  %%    Employer (bold)                     Dates (regular)    %%
  %%    Title (emphasis)                Location (emphasis)    %%
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  {\bf #1}                 \hfill                  {    #2}% Stop a space
  \ifthenelse{\equal{#3}{}}{}{
  \\
  {\em #3}                 \hfill                  {\em #4}% Stop a space
  }\smallskip
  % \cdot used for bullets, items non-indented
  \begin{list}{$\cdot$}{\leftmargin=0em}
  \itemsep -0.5em \vspace{-0.5em}
}{
  \end{list}
  \vspace{0.5em}
}

从相同的想法开始,并假设您只想从环境中删除列表,您可以执行以下操作:

\documentclass[10pt,a4paper]{resume} % Use the custom resume.cls style  
\usepackage[left=0.4 in,top=0.4in,right=0.4 in,bottom=0.4in]{geometry} % Document margins
\usepackage{eurosym}
\usepackage[usenames, dvipsnames]{color}

% Item-less subsection
\newenvironment{rEmptySubsection}[4]{
  %%%%%%%%%%%%%%%%%%%%%% Default Layout: %%%%%%%%%%%%%%%%%%%%%%%%
  %%    Employer (bold)                     Dates (regular)    %%
  %%    Title (emphasis)                Location (emphasis)    %%
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  {\bf #1}                 \hfill                  {    #2}% Stop a space
  \ifthenelse{\equal{#3}{}}{}{
  \\
  {\em #3}                 \hfill                  {\em #4}% Stop a space
  }
  % empty
}{
}

\begin{document}

\begin{rSection}{Section1}

\begin{rSubsection}{Sub1}{}
{}{}
\item[] MyItem1
\item[] MyItem2
\end{rSubsection}

\begin{rEmptySubsection}{MyEmptySubsection}{}
{}{}
\end{rEmptySubsection}

\begin{rSubsection}{Sub2}{}
{}{}
\item[] MyItem1
\end{rSubsection}

\end{rSection}

\end{document}

通过这种方式,您可以自定义环境并决定间距。如果您愿意,您甚至可以创建不同类型的子部分。希望这对您有所帮助。

相关内容