2

How can I set customized separators for theorem counters? For example in

enter image description here

The chapter, section and number are separated with dot. How can I change these dots to other symbols? For instance how can I change the first dot with dash and the second dot with comma?

This is a code extracted from this site which produced the picture above:

\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}
  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Henri Menke Feb 7 '15 at 18:41
  • an example code added. – user62181 Feb 7 '15 at 18:44
3

Change the representation of the counters:

\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}

enter image description here

  • It seems the code you put does the produce your output. – user62181 Feb 7 '15 at 18:57
  • @MinimusHeximus Oh, sorry! Pasted wrong version! Fixing in a moment. – egreg Feb 7 '15 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.