12

I'd like to be able to write a LaTex document with numbered theorems and equations, but I would like not to have them numbered automatically, but rather put in by hand. Ideally, I'd like to be able to write something like

\begin{thm-handnumbered}{3.1416}.  
The number $\pi$ is rational.
\end{thm-handnumbered}

As a consequence,
\begin{equation-handnumbered}{2.718}
e^{\pi i} = -1.003+0.014 i.
\end{equation-handnumbered}

and so produce "Theorem 3.1416", and an equation numbered "(2.718)".

(I can create a new theorem type for each numbered theorem (\newtheorem{thm-3.1416}...), but I've got a lot of them. I can handcraft a "thm-handnumbered" command, but it looks ugly...)

lockstep
  • 250,273
Charles Rezk
  • 175
  • 2
  • 8
  • Why would you want to do this? – Seamus Sep 06 '10 at 09:44
  • 6
    It's useful for refereeing papers, where one wants to quote a few equations with the original numbering. – Chris Johnson Sep 07 '10 at 07:57
  • 4
    It's also useful for students like me. I use a theorem environment for typing up exercises in my homework, and so I need the flexibility to manually fill in the appropriate exercise numbers. – bcat May 11 '11 at 02:53

2 Answers2

14

And here's a solution for hand-numbered theorems.

\documentclass{article}

\usepackage{amsthm}
\usepackage{thmtools}
\declaretheoremstyle[notefont=\bfseries,notebraces={}{},%
    headpunct={},postheadspace=1em]{mystyle}
\declaretheorem[style=mystyle,numbered=no,name=Theorem]{thm-hand}

\begin{document}

\begin{thm-hand}[3.1416]
Some text.
\end{thm-hand}

\end{document}
lockstep
  • 250,273
  • Looks good, thank you! (Took a few minutes to get thmtools installed correctly ... after you run "latex thmtools.ins", you need copy all the *.sty files into the texmf tree, not just the ones it tells you to copy ...) – Charles Rezk Sep 05 '10 at 20:54
  • Thanks for accepting my answer - but don't forget that frabjous provided the solution for equations. (There's this button for useful answers.) – lockstep Sep 05 '10 at 21:03
  • 1
    I don't see a useful answer button ... or do you mean upvoting? (I don't have rep to do that yet.) – Charles Rezk Sep 05 '10 at 21:15
  • Yes, I meant upvoting. I forgot its reputation requirement. – lockstep Sep 05 '10 at 21:22
  • This doesn't allow having a note after the theorem number as usual, right? – Bach Dec 12 '19 at 06:13
9

For the second one, you could use \tag from the amsmath package:

\begin{equation}\tag{2.718}
e^{\pi i} = -1.003+0.014 i.
\end{equation}

For the first, I'd use ntheorem with a no-number style and then use the optional name:

\usepackage{ntheorem}
\theoremstyle{nonumberplain}
\newtheorem{handnum-theorem}{Theorem}

And in the body:

 \begin{handnum-theorem}[3.1416]
     This result is interesting.
 \end{handnum-theorem}

See the ntheorem documentation for more info.

frabjous
  • 41,473