在章节标题中指定换行符

在章节标题中指定换行符

我为我的论文创建了自己的 .cls 文件,当我在章节标题中指定换行符时,我收到一条错误消息

以下是文件中定义章节标题的部分:

%----------------------------------------------------------------------%
%   Chapter heading font size
%----------------------------------------------------------------------%

\RequirePackage{sectsty}

\chapternumberfont{\normalsize} 
\chaptertitlefont{\normalsize}


%----------------------------------------------------------------------%
%   Title spacing
%----------------------------------------------------------------------%

\RequirePackage{titlesec} % Adjust title headers

% Reduce spacing after section/subsection/subsubsections
\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

% Single spaced headers
\titleformat{\chapter}      % command
    [display]               % shape
    {\color{UOFURED}\centering\normalfont\Large\bfseries\doublespacing}
    {\MakeUppercase{\chaptertitlename} \Large\thechapter}
    {0pt}                   % separations
    {\MakeUppercase}        % before
    []              % After (leave blank)

%\titleformat{\chapter}[display]{\centering\normalfont\huge\bfseries\singlespacing}{\chaptertitlename\ \thechapter}{40pt}{\huge}
\titleformat{\section}{\centering\singlespacing\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\centering\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\centering\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}

以下是我定义章节的方式,以便文本全部大写

\chapter{\uppercase{Chapter title goes here}}

但是,我的大学要求长章节标题必须为倒金字塔。我读到过,您可以通过指定换行符来实现这一点,如下所示:

\chapter[This is a really long title that needs to be wrapped as an inverted pyramid]{This is a really long title that \\ needs to be wrapped as an \\ inverted pyramid}

在 ubuntu 中编译后我收到一条错误消息,内容是:

! TeX capacity exceeded, sorry [main memory size=5000000].
\reserved@a #1#2->\let #1#2\reserved@a

l.8 ...ds to be wrapped as an \\ inverted pyramid}

!  ==> Fatal error occurred, no output PDF file produced!

有人知道如何解决这个问题吗?

答案1

这个问题在评论中得到了回答。只需\protect\\\chapter调用中添加即可。

相关内容