5

I am searching for the latex code wich produces every numbering before the theorems, propositions, lemmas, corollaries, remark and other simple math equations like the following page of a book: enter image description here

In the above example the section is $1.3$ of chapter $1$. Also note that the numberings are in bold. Thanks for help.

  • You may find an answer at en.wikibooks.org/wiki/LaTeX/Theorems . If not, then ask. In that case please prepare a small complete document that we can copy and edit to show you what to do. – Ethan Bolker May 1 '16 at 14:14
  • \renewcommand{\thetheorem}{(\thesection.\arabic{theorem})} should work if the theorem counter is called theorem – user31729 May 1 '16 at 14:16
  • 1
    using amsthm, \swapnumbers will move the numbers to the beginning of the theorem header. after that, the suggestion by @ChristianHupfer for formatting the numbers is needed to put them in parentheses. finally, fo number theorems consecutively with equations, the equation counter must be specified as the counter used for theorems. consult the amsthm manual for \swapnumber and counter information: texdoc amsthm. – barbara beeton May 1 '16 at 14:32
8

Define suitably the theorem styles; also some trick has to be used for the equation number in boldface.

\documentclass[leqno]{book}
\usepackage{amsmath,amsthm}

\makeatletter
% http://tex.stackexchange.com/a/261647/4427
% detach \eqref and \tag making
\renewcommand{\eqref}[1]{\textup{\eqreftagform@{\ref{#1}}}}
\let\eqreftagform@\tagform@
% equation numbers are boldface
\def\tagform@#1{%
  \maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}%
}
\makeatother

\newtheoremstyle{main}% name
  {\topsep}%   Space above
  {\topsep}%   Space below
  {\itshape}%  Body font (use \slshape if you want slanted type)
  {}%          Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {:}%         Punctuation after thm head
  { }%         Space after thm head: " " = normal interword space;
  {(\thmnumber{#2}) \thmname{#1}\thmnote{ {\normalfont(#3)}}}

\newtheoremstyle{maindefinition}% name
  {\topsep}%   Space above
  {\topsep}%   Space below
  {\upshape}%  Body font
  {}%          Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {:}%         Punctuation after thm head
  { }%         Space after thm head: " " = normal interword space;
  {(\thmnumber{#2}) \thmname{#1}\thmnote{ {\normalfont(#3)}}}%


\numberwithin{equation}{section}
\theoremstyle{main}
\newtheorem{theorem}[equation]{Theorem}
\newtheorem{proposition}[equation]{Proposition}
\theoremstyle{maindefinition}
\newtheorem{definition}[equation]{Definition}

\begin{document}

\chapter{Exactness and intertwining}

\setcounter{section}{2}

\section{Test}

\setcounter{equation}{2}

\begin{definition}
We define \emph{something}
\end{definition}

Some text

\begin{proposition}
Some statement, an equation
\begin{equation}
a+b=c
\end{equation}
and the end of the statement.
\end{proposition}

\begin{theorem}[With note]
Something
\end{theorem}

\end{document}

enter image description here

  • why do you write two codes, maindefinition style and theorem style? – MathStudent May 1 '16 at 15:04
  • 2
    @dulalnarugopal Because, in my opinion, the text in a definition should be upright and not italics. – egreg May 1 '16 at 15:05
  • In the OP's screenshot, the theorem body font appears to be slanted-roman rather than italic. – Mico May 1 '16 at 19:21
  • @Mico That's an easy modification. With due respect to Donald Knuth, I dislike slanted type. – egreg May 1 '16 at 19:32
  • I'm not a big fan of slanted-roman type either. I just wanted to point out this minor detail. :-) – Mico May 1 '16 at 19:49
3

You also can do that with thmtools+amsthm or with nthm alone. Concerning the equation numbers, it's the leqno option in the document class. Of course you should comment the part of the code you don't want to use:

\documentclass[leqno]{book}
\usepackage{xcharter}
\usepackage{mathtools}
%%% Code for amsthm
\usepackage{amsthm, thmtools}
%
\declaretheoremstyle[%
headfont=\normalfont\bfseries,
within=chapter, headformat = swapnumber, headpunct={:}, spaceabove = 8pt,spacebelow = 8pt]%
{mythm}
\declaretheorem[name=Theorem, style=mythm, %
preheadhook={\renewcommand \theTheorem{(\thesection.\arabic{Theorem})}}]{Theorem}

%%% Code for ntheorem
\usepackage{ntheorem}
\theoremstyle{change}
\theoremseparator{:}
\newtheorem{Theorem}{Theorem}[chapter]
\renewcommand \theTheorem{(\thesection.\arabic{Theorem})} 
%%%%%%%

\begin{document}

\setcounter{chapter}{3}
\section{A first section}
\begin{Theorem}
  The following assertion is true: %
  \begin{equation}\label{testeq}
    a = a\end{equation}
    \end{Theorem}

\end{document}

enter image description here

Note thmtools also works with ntheorem, but isn't required here. With amsthm, it eases the definition of new theorem styles.

  • I think the Theorem counter should be reset to 0 whenever \section is encountered. However, \renewcommand \theTheorem{(\thesection.\arabic{Theorem})} doesn't achieve this. Add something like \makeatletter\@addtoreset{equation}{section} \makeatother? Or, \numberwithin{equation}{section}. – Mico May 1 '16 at 18:33
  • @Mico: It is enough to code within=section using thmtools, and \newtheorem{Theorem}{Theorem}[section] for the solution with ntheorem. But do you really think it's better to reset the theorem at sections? I didn't implement a common counter for theorems, definitions, remarks, &c. – Bernard May 1 '16 at 18:47
  • I can't be 100% sure for the case at hand. In general, though, it seems to be more common practice to restart all subordinate counters every time \section is encountered than it is to let the counters be incremented monotonically. – Mico May 1 '16 at 18:49
2

For the sake of completeness, here's a solution that uses the ntheorem package without other helper packages to define a custom look for the theorem headers.

enter image description here

\documentclass{report} % use a class that features chapter-level headers

%% Customize the appearance of equation numbers
\usepackage[leqno]{mathtools} % for \newtagform and \usetagform macros
\numberwithin{equation}{section}
\newtagform{bold}[\bfseries]{(}{)} % bold equation numbers
\usetagform{bold}
\renewcommand\eqref[1]{\textup{(\ref{#1})}} % but non-bold cross-references


%% Customize the appearance of theorem-like environments
\usepackage[amsmath]{ntheorem}
\makeatletter
\newtheoremstyle{mythm}%
   {\item[\hskip\labelsep\theorem@headerfont(##2) ##1\theorem@separator]}%
   {\item[\hskip\labelsep\theorem@headerfont(##2) ##1 [##3]\theorem@separator]}
\makeatother    
\theoremstyle{mythm}  % switch to the newly-defined theorem style
\theorembodyfont{\slshape}
\theoremseparator{:}  
\newtheorem{thm}{Theorem}[equation]
\newtheorem{prop}[equation]{Proposition}
\newtheorem{defn}[equation]{Definition}

\begin{document}

\setcounter{chapter}{1}  % just for this example
\setcounter{section}{3}
\setcounter{equation}{2}

\begin{defn} 
A \emph{tame corestriction on $A$} (relative to $E/F$) is a \dots 
\end{defn}
\begin{prop} 
(i) Let $\psi_E$, $\psi_F$ be continuous additive characters \dots There exists a unique map $s\colon A\to B$ such that
\begin{equation} \label{eq:co}
\psi_A(ab)=\psi_B(s(a)b), \quad a\in A, b\in B.
\end{equation}
\end{prop}

\end{document}
  • (+1) @Mico: For the equation number, wouldn't it be simpler to use the \newtagform command, from mathtools? – Bernard May 1 '16 at 16:56
  • @Bernard - Thanks. Indeed, \newtagform is an option, say, \newtagform{bold}[\bfseries]{(}{)} followed by \usetagform{bold}. However, something still has to be done to avoid having cross-referenced equation numbers show up in bold. – Mico May 1 '16 at 17:10
  • \renewcommand\eqref[1]{(\ref{#1})} does the trick. Does it have any side effect? – Bernard May 1 '16 at 17:26
  • @Bernard - Many thanks for this suggestion. I'll edit my answer to use the variant form \renewcommand\eqref[1]{\textup{(\ref{#1})}}. – Mico May 1 '16 at 18:12

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.