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}
2
  • 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}. Commented Feb 7, 2015 at 18:41
  • an example code added. Commented Feb 7, 2015 at 18:44

1 Answer 1

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .