移除 LaTeX 中的章节编号

11

我在使用latex排版时遇到了一个问题。我想从标题和目录中删除章节编号,但我希望引理、定理等内容仍然保留编号。 我希望最终的结果看起来像这样:

 Section Whatever
   Some unimportant text.

 Section Whatever else
   Another unimportant text.
   Lemma 2.1
   Theorem 2.2 

 Section Whatever again
   Theorem 3.1

我该如何做?我尝试过

 \renewcommand\thesection{}

但是它甚至会从引理和定理中删除数字。非常感谢 :)

1个回答

22

在默认的 article 类下,我们只需添加以下内容即可删除应用于节计数器的格式:

\renewcommand{\thesection}{\arabic{section}}
\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother

添加以下代码到导言部分可以移除所有章节标题的编号(包括 \section\subsection\subsubsection 等等),但保留它们在引用时和使用 \thesection 时的编号。

enter image description here

\documentclass{article}

\newtheorem{theorem}{Theorem}[section]% Theorems numbered by section
\newtheorem{lemma}[theorem]{Lemma}% Lemma uses theorem's counter

\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother

\begin{document}

\section{Section whatever}
Some uninportant text.

\section{Section whatever else}
Another uninportant text.

\begin{lemma}
Some lemma.
\end{lemma}

\begin{theorem}
Some theorem.
\end{theorem}

\section{Section whatever again}
\begin{theorem}
Another theorem.
\end{theorem}

\end{document}

2
你好 :) 那个命令删除了标题中的数字,但在目录中仍然存在。我该如何解决这个问题? - Katarina
5
@Katarina:你可以在导言部分加入\renewcommand{\numberline}[1]{},这将从目录中移除所有章节编号,而不影响原文意思。 - Werner

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接