我最近在多个文档中都收到此错误。第一节和第三节标题显示正确,但第二节标题出现错误。
\documentclass{report}
\begin{document}
\begin{center}
\section*{\normalsize{SECTION ONE}}
\end{center}
\begin{center}
\section*{\normalsize{SECTION TWO}}
\end{center}
\begin{center}
\section*{\normalsize{SECTION THREE}}
\end{center}
\end{document}
答案1
要轻松更改分段单位的格式,请使用titlesec
包裹:
\documentclass{report}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}% just to generate text for the example
\titleformat{\section}
{\normalfont\normalsize\bfseries\centering}{}{0em}{\MakeUppercase{#1}}
\begin{document}
\section{Section one}
\lipsum[4]
\section{Section two}
\lipsum[4]
\section{Section three}
\lipsum[4]
\end{document}
我假设你希望你的\section
s 不被编号;如果不是这样,请告诉我,定义将如下所示:
\documentclass{report}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}% just to generate text for the example
\titleformat{\section}
{\normalfont\normalsize\bfseries\centering}{\thesection}{1em}{\MakeUppercase{#1}}
\begin{document}
\section*{Section one}
\lipsum[4]
\section*{Section two}
\lipsum[4]
\section*{Section three}
\lipsum[4]
\end{document}
如果没有包,您可以\section
按照以下命令重新定义命令report.cls
:
\documentclass{report}
\usepackage{lipsum}% just to generate text for the example
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\normalsize\bfseries\centering\MakeUppercase}}
\makeatother
\begin{document}
\section*{Section one}
\lipsum[4]
\section*{Section two}
\lipsum[4]
\section*{Section three}
\lipsum[4]
\end{document}