如何为定理计数器设置自定义分隔符?

如何为定理计数器设置自定义分隔符?

如何为定理计数器设置自定义分隔符?例如在

在此处输入图片描述

章节、节和编号用。我怎样才能将这些点改为其他符号?例如,我怎样才能将第一个点改为破折号,将第二个点改为逗号?

这是从中提取的代码本网站产生了上面的图片:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}

\begin{document}
\section{Introduction}
Theorems can easily be defined

\begin{theorem}
Let $f$ be a function whose derivative exists in every point, then $f$ is 
a continuous function.
\end{theorem}

\begin{theorem}[Pythagorean theorem]
\label{pythagorean}
This is a theorema about right triangles and can be summarised in the next 
equation 
\[ x^2 + y^2 = z^2 \]
\end{theorem}

And a consequence of theorem \ref{pythagorean} is the statement in the next 
corollary.

\begin{corollary}
There's no right rectangle whose sides measure 3cm, 4cm, and 6cm.
\end{corollary}

You can reference theorems such as \ref{pythagorean} when a label is assigned.

\begin{lemma}
Given two line segments whose lengths are $a$ and $b$ respectively there is a 
real number $r$ such that $b=ra$.
\end{lemma}

\end{document}

答案1

改变计数器的表示形式:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{siunitx}

\newtheorem{theorem}{Theorem}[section]
\renewcommand{\thetheorem}{\thesection--\arabic{theorem}}

\newtheorem{lemma}[theorem]{Lemma}

\newtheorem{corollary}{Corollary}[theorem]
\renewcommand{\thecorollary}{\thetheorem, \arabic{corollary}}

\begin{document}
\section{Introduction}
Theorems can easily be defined

\begin{theorem}
Let $f$ be a function whose derivative exists in every point, then $f$ is 
a continuous function.
\end{theorem}

\begin{theorem}[Pythagorean theorem]
\label{pythagorean}
This is a theorema about right triangles and can be summarised in the next 
equation 
\[ x^2 + y^2 = z^2 \]
\end{theorem}

And a consequence of theorem \ref{pythagorean} is the statement in the next 
corollary.

\begin{corollary}
There's no right rectangle whose sides measure \SI{3}{cm}, \SI{4}{cm}, and \SI{6}{cm}.
\end{corollary}

You can reference theorems such as \ref{pythagorean} when a label is assigned.

\begin{lemma}
Given two line segments whose lengths are $a$ and $b$ respectively there is a 
real number $r$ such that $b=ra$.
\end{lemma}

\end{document}

在此处输入图片描述

相关内容