TeX - LaTeX Asked by Pece on June 5, 2021
I’m trying to have an old fashioned style of (sub)section numbering as in EGA (Eléments de Géométrie Algébrique, by A.Grothendieck and J.Dieudonné). For a LaTeX written example, see here.
I did it with the use of the titlesec package, and the following problem arrises : if a section has the shape runin and an amsthm environment follows immediately, the environment creates a line break as usual, which I do not want.
Here is a minimal working example :
documentclass{article}
usepackage{titlesec}
usepackage{amsthm}
titleformat{subsection}[runin]{normalsizebfseries}{(thesubsection)}{5pt}{}
newtheorem*{thm}{Theorem}
begin{document}
section{A section}
subsection{}
begin{thm}
Foo bar.
end{thm}
end{document}
In this MWE, the line break after (1.1) to begin the thm environment : I would like Theorem to be right after (1.1) on the same line.
How can I do that ?
The style is really old fashioned. ;-)
Define thm
to share the subsection
counter and modify how the theorem headers are printed.
documentclass{article}
usepackage{titlesec}
usepackage{amsthm}
makeatletter
defthmhead#1#2#3{%
(thmnumber{@upn{#2})@ifnotempty{#1}{ }}%
thmname{#1}%
thmnote{ {thethm@notefont(#3)}}}
makeatother
titleformat{subsection}[runin]{normalsizebfseries}{(thesubsection)}{5pt}{}
newtheorem{thm}[subsection]{Theorem}
begin{document}
section{A section}
Some introductory text.
subsection{}
A subsection
begin{thm}
Foo bar.
end{thm}
begin{thm}[Someone]
Foo bar.
end{thm}
end{document}
Correct answer by egreg on June 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP