Discussion:
pass optional argument to theorem environment
(too old to reply)
Alan Isaac
2008-02-26 21:08:40 UTC
Permalink
I wanted to color a theorem environment
and precede it with a rule, so I tried:

\newtheorem{xmplint}{Example}

\newenvironment{xmpl}[1][1]{%
\noindent\color{xmpl}\hrulefill
\begin{xmplint}[#1]
}{
\end{xmplint}
}

This does not quite work, most obviously if
I do not pass an optional paramter. (It is
as if I passed a value of 1?)
Can I nicely pass the optional parameter?

Thanks,
Alan Isaac
Ulrich M. Schwarz
2008-02-27 07:55:02 UTC
Permalink
I wanted to color a theorem environment and precede it with a rule, so I
\newtheorem{xmplint}{Example}
\newenvironment{xmpl}[1][1]{%
\noindent\color{xmpl}\hrulefill
\begin{xmplint}[#1]
}{
\end{xmplint}
}
This does not quite work, most obviously if I do not pass an optional
paramter. (It is as if I passed a value of 1?)
Can I nicely pass the optional parameter?
\documentclass{article}
\usepackage{color}
\usepackage{thm-patch, thm-kv}
%^^ http://ctan.org/tex-archive/macros/latex/exptl/thmtools/

\declaretheorem[title=Example]{xmpl}
\addtotheoremprehook[xmpl]{%
\noindent\color{green}\hrulefill
}

\begin{document}

\begin{xmpl}[Ulrich's Example]
This is one example.
\end{xmpl}

This is some uncolored text.

\begin{xmpl}
This is an entirely different example.
\end{xmpl}

\end{document}

The distance from the line to the "Example" looks rather a bit large to
me, that's because a theorem adds vertical space before it, and it's
difficult to get in between without disassembling the entire mechanism.

There's also a package that gives you ruled theorems, but I can't think
of the name right now. Maybe it'll come back to me.

Ulrich
Alan G Isaac
2008-02-27 19:54:05 UTC
Permalink
Post by Ulrich M. Schwarz
\usepackage{thm-patch, thm-kv}
%^^ http://ctan.org/tex-archive/macros/latex/exptl/thmtools/
Cool!
Post by Ulrich M. Schwarz
There's also a package that gives you ruled theorems, but I can't think
of the name right now. Maybe it'll come back to me.
Did not find it.

Thanks!
Alan
Ulrich M. Schwarz
2008-02-28 07:08:18 UTC
Permalink
Post by Alan G Isaac
Post by Ulrich M. Schwarz
There's also a package that gives you ruled theorems, but I can't think
of the name right now. Maybe it'll come back to me.
Did not find it.
Aha: http://dante.ctan.org/CTAN/macros/latex/contrib/thmbox/
was the one I was thinking of. (That's so obviously named for LaTeX
standards that it's hard to find ;) )

I haven't run compat checks against that yet, though.

Ulrich
Alan Isaac
2008-02-28 14:23:32 UTC
Permalink
Post by Ulrich M. Schwarz
http://dante.ctan.org/CTAN/macros/latex/contrib/thmbox/
Also very interesting, although less flexible.
Thanks!
Post by Ulrich M. Schwarz
I haven't run compat checks against that yet, though.
I do not really know what you mean here. Is there
a standard compatability check, or are you checking
defined environments against a data base, or what?

Anyway, your first solution is a good one.

Thanks!
Alan Isaac
Ulrich M. Schwarz
2008-02-28 17:16:31 UTC
Permalink
Post by Ulrich M. Schwarz
http://dante.ctan.org/CTAN/macros/latex/contrib/thmbox/
Also very interesting, although less flexible. Thanks!
Post by Ulrich M. Schwarz
I haven't run compat checks against that yet, though.
I do not really know what you mean here. Is there a standard
compatability check, or are you checking defined environments against a
data base, or what?
No, I was more-or-less muttering to myself. I check thmtools against some
use cases (it'll work with amsthm, theorem, and the standard theorem
mechanism), and thmbox is not amongst those. (And thmtools and thmbox
will break each other at the moment, it appears.)

Ulrich

Loading...