Math & Scienceamsthm: How to put a horizontal rule after theorem env.

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
bugmenot2
Posts: 2
Joined: Sun Aug 08, 2010 2:44 pm

amsthm: How to put a horizontal rule after theorem env.

Post by bugmenot2 »

Hi,

I'm using amsthm for typesetting theorems. Now I want to put a horizontal rule below "theorem"-Environments. I know how to place rules, what I don't know is how to tell amsthm to write something below each theorem-Environment. The \newtheoremstyle command isn't of any help here, since it does not provide a parameter for that.

So far I have thought of two solutions:

The first is redefining the theorem environment to something like

Code: Select all

\renewenvironment{theorem}[1]{\begin{old_theorem}[#1]}{\end{old_theorem}\rule..}
But I don't know how to reference the old definition of theorem within my new definition. (One would have to rename the old environment before defining the new one, I guess, but I don't know how to archive this)

My other idea was to search amsthm.sty for the code that produces the end-of-theorem code, which I guess is

Code: Select all

\def\@endtheorem{\endtrivlist\@endpefalse }
and replace it with my own version. (Preferably without having to copy amsthm.sty and change it in-place.) But I don't know how to do this either.
Last edited by bugmenot2 on Mon Aug 09, 2010 9:32 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

amsthm: How to put a horizontal rule after theorem env.

Post by gmedina »

Hi,

the following example could give you some ideas:

Code: Select all

\documentclass{article}
\usepackage{amsthm}

\newtheorem{mytheo}{Theorem}

\newenvironment{theo}
  {\begin{mytheo}}
  {\par\noindent\hrulefill\end{mytheo}}

\begin{document}

\begin{theo}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{theo}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
bugmenot2
Posts: 2
Joined: Sun Aug 08, 2010 2:44 pm

amsthm: How to put a horizontal rule after theorem env.

Post by bugmenot2 »

Quite simple. Thank you!

Edit: Ok. Figured out what went wrong in my approaches: My first one would have worked had I used \def and \let:

Code: Select all

\let\oldendtheorem\endtheorem
\def\endtheorem{MyStuff. \oldendtheorem}
My second one needs \makeatletter:

Code: Select all

\makeatletter
\def\@endtheorem{\hfill\rule{3ex}{0.3mm}\endtrivlist@endpefalse}
\makeatother
Post Reply