사용자 정의 명령에 "여기에 끝낼 줄이 없습니다"

사용자 정의 명령에 "여기에 끝낼 줄이 없습니다"

LaTeX에서 이력서를 작성하는 중이며 업무 경험을 입력할 수 있는 명령을 정의했습니다. 유일한 문제는 아래와 같이 항목별 목록을 사용하려고 할 때마다 "! LaTeX Error: There's no line here to end.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... To Be Added}". \\어떤 이유로 든 수동으로 줄 바꿈을 추가해야 합니다 .

내 tex 문서의 코드:

\section{Related Experience}

\begin{entrylist}
  \experience
    {Jan 2014 – Present}
    {IT Systems}
    {Chocolate Covered Alien Co.; Mars, PA}
    {\textbf{Responsibilities:}\\
    \begin{itemize}
        \item Cook aliens to a nice texture
        \item Chocolate cover said aliens
    \end{itemize}}
    {\textbf{Key Achievements:}\\
    \begin{itemize}
        \item Ate chocolate covered aliens without the boss finding out
    \end{itemize}}
    \end{entrylist}

내 수업 문서의 코드:

\newenvironment{entrylist}{%
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
    \end{tabular*}
}

\newcommand{\experience}[5]{%
    \textbf{#1}&\parbox[t]{12cm}{%
        \textbf{#2}\\%
        \textit{#3}\\%
        #4\\%
        #5\vspace{\parsep}%
    }\\}

답변1

문제는 \begin{itemize} ... \end{itemize}텍스트 줄이 아니기 때문에 \\뒤에 넣을 수 없다는 것입니다. 환경은 독립적이므로 항상 한 문단 뒤와 다른 문단 앞에 배치됩니다.

이는 \\이후에 사용하는 것이 #4오류의 원인임을 의미합니다. 또한 \\. \vspace{\parsep}​매크로를 다음과 같이 재정의하세요.

\newcommand{\experience}[5]{%
    \textbf{#1}&\parbox[t]{12cm}{%
        \textbf{#2}\newline%
        \textit{#3}\newline%
        #4%
        #5\vspace{\parsep}%
}}

편집하다:그러나 이로 인해 또 다른 문제(경고)가 발생할 수 있습니다. 현재 테이블의 두 번째 열은 너비가 12cm이고 첫 번째 열은 원하는 길이로 늘릴 수 있습니다. 따라서 첫 번째 열의 텍스트가 두 번째 열을 "밀어낼" 때마다 hbox가 가득 차게 됩니다. hbox 과잉을 제거하려면 첫 번째 열에 대한 고정 길이도 정의해야 합니다. 두 열을 합쳐서 선 너비를 초과하지 않는 방식으로 수행해야 합니다. 다음과 같이 할 수 있습니다:

\newcommand{\experience}[5]{%
    \parbox[t]{0.3\linewidth}{\textbf{#1}}&\parbox[t]{0.63\linewidth}{%
        \textbf{#2}\newline%
        \textit{#3}\newline%
        #4%
        #5\vspace{\parsep}%
}}

여기서 0.3 + colsep + 0.63은 대략 선 너비 1입니다.

관련 정보