7

I am fairly new to LaTeX and I am looking for a particular style: I want to number my theorems/propositions/corollaries/definitions together and by section. For example, Definition 1.1, Theorem 1.2, Corollary 1.3, Theorem 1.4 etc. for results that are all in the first section. However, I would like to use the $\S$ symbol in the section heading, eg:

enter image description here

But this means that I get Theorems and Propositions which include the $\S$ symbol:

enter image description here

Which obviously, looks awful. Can anybody explain to me how I might get what I want? Thanks in advance

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Mar 7 '14 at 11:43
  • Do you want § also before subsection numbers? – egreg Mar 7 '14 at 11:44
6

Load the package titlesec and add this line to your preamble:

\titleformat{\section}{\normalfont\Large\bfseries}{\S\thesection}{1em}{}[]

MWE:

\documentclass{article}
\usepackage{titlesec}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{defn}[theorem]{Definition}

\titleformat{\section}{\normalfont\Large\bfseries}{\S\thesection}{1em}{}[] 

\begin{document}

\section{A section}

\begin{defn}
definition
\end{defn}
\begin{proposition}
proposition
\end{proposition}
\begin{theorem}
theorem
\end{theorem}

\end{document} 

Output

enter image description here

4

If you would like to have the \S as a feature of the section number everywhere else that it occurs (such as cross-references), then you can define \thesection to contain a \S symbol first, and then define \thetheorem, etc. to remove this symbol as a part of creating the theorem number.

Preamble.

Consider the following minimal preamble:

\documentclass{article}
\usepackage{amsthm}

\renewcommand\thesection{\S\arabic{section}}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}

\makeatletter
\newcommand\setTheoremCounterStyle[1]{%
    \expandafter\renewcommand\csname the#1\endcsname{%
        \expandafter\@gobble\thesection.\arabic{#1}}}
\makeatother

\setTheoremCounterStyle{theorem}
\setTheoremCounterStyle{proposition}
\setTheoremCounterStyle{definition}

The first several commands are fairly standard. The macro \setTheoremCounterStyle takes one argument consisting of a theorem-like environment thmenv (though any counter name will do), and defines the command \thethmenv to consist of \thesection — with the first symbol of it (in this case, \S) stripped away — followed by a dot and \arabic{thmenv}.

Sample code.

A sample document using that preamble:

\begin{document}

\section{A section}
\label{sec:foo}
This is Section~\ref{sec:foo}.

\begin{definition} A definition. \end{definition}
\begin{proposition} A proposition. \end{proposition}
\begin{theorem} A theorem. \end{theorem}

\end{document}

Output.

Output from code above

2

An option which produces the same result as in karlkoeller's answer, but without using titlesec:

\documentclass{article}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{defn}[theorem]{Definition}

\makeatletter
\newcommand\addmark@section{\S}
\renewcommand*\@seccntformat[1]{%
  \csname addmark@#1\endcsname
  \csname the#1\endcsname\quad
}
\makeatother

\begin{document}

\section{A section}

\begin{defn}
definition
\end{defn}
\begin{proposition}
proposition
\end{proposition}
\begin{theorem}
theorem
\end{theorem}

\end{document} 

enter image description here

The above redefinitin of \@seccntformat will add \S just to sections; if you want to prepend the symbol to all sectional units, the redefinition would be

\makeatletter
\renewcommand*\@seccntformat[1]{%
  \S\csname the#1\endcsname\quad
}
\makeatother

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.