由于印刷偏好,我想使用小节作为我的小节。但是,我不想使用一个带有零的占位符来表示不存在的子节编号。我该如何去掉这些零?
\documentclass{article}
\begin{document}
\section{Section}
\subsection{Subsection Header Too Big For Me}
\subsubsection{I Want This Numbered as a Subsection}
\section{Other Section}
\subsubsection{I Don't Want This Zero in the Middle}
\subsubsection{For Example, This Should be ``2.1''}
\section{Third Section}
\subsubsection{This Should Be Numbered ``3.1''}
\subsubsection{I Don't Want This ``0'' for a Non-Existent Subsection}
\end{document}
答案1
如果它只是关于排版和事物的外观,您可以使用以下方法重新定义小节:
\makeatletter
\renewcommand\subsection{\@startsection {subsection}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\centering\normalfont\large\bfseries}}
\makeatother
只需替代大的满足您的任何需求。
答案2
我刚刚在下面添加了这一行,问题就解决了。我可以删除子节编号之间的所有零:
\renewcommand{\thesubsubsection}{\thesection.\arabic{subsubsection}}
答案3
如果你这样做,从终端窗口,
latexdef subsection subsubsection`
\subsection
你将获得和的标准定义\subsubsection
\subsection:
\long macro:->\@startsection {subsection}{2}{\z@ }{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont \large \bfseries }
\subsubsection:
\long macro:->\@startsection {subsubsection}{3}{\z@ }{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont \normalsize \bfseries }
所以你会发现,简单的区别就是字体大小。好吧,你怎么能轻易解决这个问题呢?有两种方法,但都不依赖于使用\subsubsection
而不是\subsection
。
方法 1:sectsty
\documentclass{article}
\usepackage{sectsty}
\subsectionfont{\normalsize}
\begin{document}
\section{Section}
\subsection{I Want This Numbered as a Subsection}
\section{Other Section}
\subsection{I Don't Want This Zero in the Middle}
\subsection{For Example, This Should be ``2.1''}
\section{Third Section}
\subsection{This Should Be Numbered ``3.1''}
\subsection{I Don't Want This ``0'' for a Non-Existent Subsection}
\end{document}
有两个无害的警告。
方法 2:etoolbox
\documentclass{article}
\usepackage{etoolbox}
\patchcmd{\subsection}{\large}{\normalsize}{}{}
\begin{document}
\section{Section}
\subsection{I Want This Numbered as a Subsection}
\section{Other Section}
\subsection{I Don't Want This Zero in the Middle}
\subsection{For Example, This Should be ``2.1''}
\section{Third Section}
\subsection{This Should Be Numbered ``3.1''}
\subsection{I Don't Want This ``0'' for a Non-Existent Subsection}
\end{document}