! LaTeX 錯誤:出了點問題-可能缺少 \item。 - 新增 \textbf 時

! LaTeX 錯誤:出了點問題-可能缺少 \item。 - 新增 \textbf 時

我下載了一個 C 模板,並用它來寫我的履歷。在「工作經驗」部分,我決定添加一條粗線,用於\textbf將經驗分類為獲得的相關可轉移技能。在我的第一份rSubsection履歷中(請參閱專案管理),它發揮了作用。在rSubsection如下所示的第二個(技術技能)中,第一\textbf行給了我一個錯誤。第二個(團隊合作)效果很好!

\begin{rSection}{Working Experience} 
\begin{rSubsection}{University of city}{November 2021 - Present}{Postdoctoral Researcher}{city, country} 
\textbf{Project Management} 
\item Leading a research project 
\item Delivered project milestones on time. 
\end{rSubsection}

\begin{rSubsection}{University of city}{October 2016 - October 2019}{Imaging Scientist}{City, Country}

\textbf{Technical Skills} %the moment I use this line I get an error on the line below
\item Lab Maintenance: microscope setup, restocking of basic consumables.

\textbf{Teamwork}
\item Sharing expertise with undergraduate and postgraduate students

\end{rSubsection}

錯誤訊息:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.73 \item M
            aintenance: microscope setup, restocking of basic consumables.

這也是模板部分:

%   SECTION FORMATTING
%----------------------------------------------------------------------------------------

% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
  \sectionskip
  \MakeUppercase{\bf #1} % Section title
  \sectionlineskip
  \hrule % Horizontal line
  \begin{list}{}{ % List for each individual item in the section
    \setlength{\leftmargin}{1.5em} % Margin within the section
  }
  \item[]
}{
  \end{list}
}

%----------------------------------------------------------------------------------------
%   WORK EXPERIENCE FORMATTING
%----------------------------------------------------------------------------------------

\newenvironment{rSubsection}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
 {\bf #1} \hfill {#2} % Bold company name and date on the right
 \ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
  \\
  {\em #3} \hfill {\em #4} % Italic job title and location
  }\smallskip
  \begin{list}{$\cdot$}{\leftmargin=0em} % \cdot used for bullets, no indentation
   \itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
  }{
  \end{list}
  \vspace{0.5em} % Some space after the list of bullet points
}

% The below commands define the whitespace after certain things in the document - they can be \smallskip, \medskip or \bigskip
\def\namesize{\huge} % Size of the name at the top of the document
\def\addressskip{\smallskip} % The space between the two address (or phone/email) lines
\def\sectionlineskip{\medskip} % The space above the horizontal line for each section 
\def\nameskip{\bigskip} % The space after your name at the top
\def\sectionskip{\medskip} % The space after the heading section

沒有\item遺漏,所以我添加的肯定有一些問題\textbf,但我有時無法理解它是如何工作的,有時卻不能!

答案1

OP程式碼是rSection來自a的修改版本(新增環境)代碼由 Steven B. Segletes 提供回答如何停用 rSubsection 中的清單?

在連結的程式碼中,您可以在rSubsection環境中插入文字或表格。不僅\item是的。

但環境中的第一個東西rSubsection需要是一個\item.

您可以使用 隱藏清單項目中的項目符號\item[]

為了防止全部變成粗體,我在環境\normalfont的程式碼中添加了一個rSection

\namesize我還刪除了、 、的定義\addressskip,並且\nameskip未在 OP 程式碼中使用。

OP錯過了\usepackage{ifthen}所以我添加它(需要\ifthenelse)。

\documentclass[11pt]{article}
\usepackage{ifthen}
%   SECTION FORMATTING
%----------------------------------------------------------------------------------------

% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
  \sectionskip
  \MakeUppercase{\bf #1} % Section title
  \sectionlineskip
  \hrule % Horizontal line
  \begin{list}{}{ % List for each individual item in the section
    \setlength{\leftmargin}{1.5em} % Margin within the section
  }
  \normalfont\item[]
}{
  \end{list}
}

%----------------------------------------------------------------------------------------
%   WORK EXPERIENCE FORMATTING
%----------------------------------------------------------------------------------------

\newenvironment{rSubsection}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
 {\bf #1} \hfill {#2} % Bold company name and date on the right
 \ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
  \\
  {\em #3} \hfill {\em #4} % Italic job title and location
  }\smallskip
  \begin{list}{$\cdot$}{\leftmargin=0em} % \cdot used for bullets, no indentation
   \itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
  }{
  \end{list}
  \vspace{0.5em} % Some space after the list of bullet points
}

% The below commands define the whitespace after certain things in the document - they can be \smallskip, \medskip or \bigskip
\def\sectionlineskip{\medskip} % The space above the horizontal line for each section 
\def\sectionskip{\medskip} % The space after the heading section

\begin{document}

\begin{rSection}{Working Experience} 
\begin{rSubsection}{University of city}{November 2021 - Present}{Postdoctoral Researcher}{city, country} 
\item[] \textbf{Project Management} % added a \item[] because we need here an \item, but the bullet is hidden with the blank option []
\item Leading a research project 
\item Delivered project milestones on time. 
\end{rSubsection}

\begin{rSubsection}{University of city}{October 2016 - October 2019}{Imaging Scientist}{City, Country}

\item[] \textbf{Technical Skills} % added a \item[] because we need here an \item, but the bullet is hidden with the blank option []
\item Lab Maintenance: microscope setup, restocking of basic consumables.

\textbf{Teamwork} % \item[] not needed here. Moreover, without the `\item[]` here, a slight vertical space (welcomed) is added.
\item Sharing expertise with undergraduate and postgraduate students

\end{rSubsection}
\end{rSection} % <-- added (missing in the OP code)

\end{document}

在此輸入影像描述

筆記:Steven B. Segletes 的程式碼用於本教程來自 Drshika Asher 的,以便用 LaTeX 製作簡歷。這可以給出這樣的佈局:

在此輸入影像描述

(與OP提供的程式碼無關,但在Drshika Asher的教程中,最後一個程式碼範例\item[]在之前遺失\textbf{Coursework:}。此外,在提供的具有完整程式碼的Overleaf專案中,\item[]缺少一些程式碼:在第100、128、133、142行)。

相關內容