9

I'm pretty new to LaTeX. And I don't really understand the following code, it is merely a pasted template from wikipedia.

I'm trying to make a simple theorem style which is identical to the normal theorem style but has a dash after the number. I tried this but I keep getting an error on and off about numbering. As I'm typing it has stopped for a while. Anyway, what is the best way to tell it to do the theorem style? I feel there's probably a very simple way.

\newtheoremstyle{theoremdd}% name of the style to be used
{}% measure of space to leave above the theorem. E.g.: 3pt
{}% measure of space to leave below the theorem. E.g.: 3pt
{}% name of font to use in the body of the theorem
{}% measure of space to indent
{}% name of head font
{}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{ #2'}\thmnote{ (#3)}.}

\theoremstyle{theoremdd}
\newtheorem{thmd}{Theorem}[section]

...

\begin{thmd}[hello]
 jfgh
\end{thmd}

Whilst it would be nice to understand what all the code means, I just desperately need a fix.

Thanks, Richard

Edit/update:

Apart from completely not understanding how the LaTeX code works, I have a working product, but it was completely a workaround. Correct me if I'm wrong, but the #2 represents a number. All I want to do it subtract 1 from the counter. Currently this is my fix:

 \newtheoremstyle{theoremd}% name of the style to be used
  {}% measure of space to leave above the theorem. E.g.: 3pt
  {}% measure of space to leave below the theorem. E.g.: 3pt
  {\em}% name of font to use in the body of the theorem
  {}% measure of space to indent
  {\bf}% name of head font
  {.}% punctuation between head and body
  { }% space after theorem head; " " = normal interword space
  {\thmname{#1}\thmnumber{\addtocounter{thm}{-1} #2}'\thmnote{\textnormal{ (#3)}}}

As you can see I'm clueless. More understanding would be greatly appreciated.

Latest edit:

This is what I've settled for. Comments would definitely be appreciated. I'm still unsure about how it all works but I've learned a lot thanks to you all.

\newtheoremstyle{theoremd}% name of the style to be used
{}% measure of space to leave above the theorem. E.g.: 3pt
{}% measure of space to leave below the theorem. E.g.: 3pt
{\em}% name of font to use in the body of the theorem
{}% measure of space to indent
{\bf}% name of head font
{.}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{\addtocounter{thm}{-1} #2$^\prime$}\thmnote{\textnormal{ (#3)}}}
  • Which part is causing trouble? Similar explanation also here tex.stackexchange.com/questions/38260/… and probably you want to get the ' out of the braces, I mean { #2 }' – percusse Mar 23 '15 at 17:19
  • what theorem package are you using? both amsthm and ntheorem define \newtheoremstyle, and i doubt the definitions are the same. (i'm really familiar with only amsthm.) we need more information, and preferably, a compilable test file beginning with \documentclass and ending with `\end{document}. – barbara beeton Mar 23 '15 at 17:23
  • Consider accepting one of the provided answers. – Dr. Manuel Kuehner Mar 3 at 19:56
13

Just fill in the necessary parameters.

\documentclass{article}
\usepackage{amsthm}

\newtheoremstyle{theoremdd}% name of the style to be used
  {\topsep}% measure of space to leave above the theorem. E.g.: 3pt
  {\topsep}% measure of space to leave below the theorem. E.g.: 3pt
  {\itshape}% name of font to use in the body of the theorem
  {0pt}% measure of space to indent
  {\bfseries}% name of head font
  {. ---}% punctuation between head and body
  { }% space after theorem head; " " = normal interword space
  {\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}

\theoremstyle{theoremdd}
\newtheorem{thmd}{Theorem}[section]

\begin{document}

\section{Whatever}

\begin{thmd}
This is a test theorem.
\end{thmd}

\end{document}

enter image description here

5

So you want a Bourbaki style layout? It's easy to do with the ntheorem package:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[small]{titlesec}
\titleformat{\section}{\normalsize\bfseries}{\thesection.}{0.5em}{}

\usepackage[ thmmarks, thref]{ntheorem}
\usepackage{chngcntr}
\usepackage{cleveref}

\renewcommand\thesection{\arabic{section}}

\theoremstyle{plain}
\theoremheaderfont{\scshape}
\theoremseparator{.~---}
\newtheorem{thm}{Theorem}
\counterwithin*{thm}{chapter}

\pagestyle{plain}

\begin{document}

\section{A first section}
\begin{thm}\label{testthm}
This is a test theorem. 
\end{thm}
We see in \cref{testthm}\dots

\end{document} 

enter image description here

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.