I'm using the \begin{proof}
of the amsthm
package. And I want to change the style of the Proof
word that is added in the beginning. By default it is italic, I want to make it bold. How can I do it?
5 Answers
How about:
\renewenvironment{proof}{{\bfseries Proof}}{*something*}
*something* - something to be executed after environment argument is processed (possibly empty).
More here: http://en.wikibooks.org/wiki/LaTeX/Customizing_LaTeX.
-
2
-
14As a slight improvement for those who like to put
\begin{proof}[Proof of the Lemma] ... \end{proof}
, you can do\renewenvironment{proof}[1][\proofname]{{\bfseries #1.}}{*something*}
. Jan 1, 2011 at 23:21 -
7if you're using
amsthm
, all these redefinitions are too simple-minded; you will lose the ability to use\qedhere
to adjust the placement of the "tombstone" if the proof ends with a list or display. Jul 24, 2012 at 14:08 -
3@barbarabeeton You don't. I just tried, and \qedhere works perfectly with amsthm and the adjustment given by Bruno Le Floch.– user7013Mar 25, 2014 at 21:30
If you don't mind changing the name of the environment, just use a variant of the following code. Change \ttfamily \scshape \large #1 (yes, "#1")
to something more sensible: #1
denotes the "Proof" word.
\newenvironment{myproof}[1][\proofname]{%
\proof[\ttfamily \scshape \large #1 (yes, ``#1'')]%
}{\endproof}
\begin{myproof}
Hi.
\end{myproof}
The proof environment takes one argument and puts it in italics (by default this argument is Proof
in English). Our new environment also takes one argument, denoted #1
(with the same default), and feeds it to the proof
environment after transforming it a bit (or a lot). Here I decided to write the "proof" word in typewriter small-caps, large, and I even put it twice: "Proof, (yes, 'Proof')". Anything can be done with it.
If you want to redefine the proof
environment itself, you can do
\documentclass{article}
\usepackage{amsthm}
\expandafter\let\expandafter\oldproof\csname\string\proof\endcsname
\let\oldendproof\endproof
\renewenvironment{proof}[1][\proofname]{%
\oldproof[\ttfamily \scshape \large #1 (yes, ``#1'')]%
}{\oldendproof}
\begin{document}
\begin{proof}[Foobar]
Some example text.
\end{proof}
\end{document}
When we redefine the proof
environment, we are in fact defining \proof
and \endproof
. The primitive \let
makes \oldproof
into an exact copy of what \\proof
means initially, so that we can use it for defining \proof
. Otherwise, \proof
would expand to \proof[...]
, which would expand to \proof[...]
, etc, looping forever.
EDIT: revised the last code snippet, which was completely wrong.
-
Thanks for a very detailed answer. But the
an_ant
answer with a\renewenvironment
looks simpler to me.– jutkyJan 1, 2011 at 22:17 -
1
an_ant
's way has a drawback: the\qed
symbol won't always be placed properly (AFAIK, the ams packages work hard to do get spacing and everything right). Also, it removes the optional argument. [...] In fact, this can easily be fixed (see my comment onan_ant
's answer. Jan 1, 2011 at 23:19 -
Your second example (redefining proof) results in "LaTeX Error: Command \proof already defined." And changing it to use \renewenvironment creates an infinite loop and crashes LaTeX due to memory overflow :-(– Max HornFeb 27, 2014 at 18:05
-
@Max Sorry for the delay in fixing that. My fix is ugly but should now work. Mar 5, 2014 at 21:01
A better and simpler solution is to redefine \proofname
:
\usepackage{amsthm}
\let\oldproofname=\proofname
\renewcommand{\proofname}{\rm\bf{\oldproofname}}
This is better than redefining the proof
environment because the environment goes to considerable lengths to position the \qed
mark correctly, and to respect the indentation style used in theorems (which is not necessarily the same as for normal paragraphs). It also works fine with the babel
package which is helpful if you work in more than one language, or are writing a style file that might be used with multiple languages.
-
3See Does it matter if I use
\textit
or\it
,\bfseries
or\bf
, etc. and Will two-letter font style commands (\bf
,\it
, …) ever be resurrected in LaTeX? on the use of old font macros like\rm
and\bf
.– Werner ♦Jul 23, 2012 at 16:57 -
1You cannot use
\textit
or\textbf
because they're block-level and you need the bold effect to propagate beyond the\oldproofname
(which is 'Proof' in English) so that the full stop is also in bold. TeX's modal \rm and \bf commands do that. It might have been better had I used\upshape\bfseries
instead of\rm\bf
as they're the LaTeX versions, but to be honest, I don't see a big difference.– richardJul 24, 2012 at 21:07 -
The proposed link(s) provide a reason behind the choice to stick to LaTeX-related commands. It may not be evident from your example, but in general it is a good idea to avoid the two-letter font commands. True, using
\upshape\bfseries
would act as switches in analogue to\rm\bf
compared to macros that gobble their arguments (as does\textbf
and company). To that extent, you don't need to group\oldproofname
, since neither\rm
not\bf
takes an argument.– Werner ♦Jul 24, 2012 at 21:46 -
1If you redefine
\proofname
only then the dot after proof name will remain non-bold italic.– SmylicNov 18, 2013 at 23:52 -
I expected to be able to put those commands in the preamble, but when I did, they had no effect. When I moved them to the body of the document (immediately after
\begin{document}
), then everything was fine. Aug 22, 2015 at 18:47
many of the fonts in the ams document classes and amsthm.sty are "frozen", even though they are changed in publication-specific classes to effect a different style. for the next upgrade of the ams-latex collection, we are considering assigning "logical" names to most such fonts, to simplify the ability to make changes such as the one requested here. the "proofheadfont" will be among the fonts to be generalized.
If you're able and happy to modify your amsthm.sty, then find the command that begins \newenvironment{proof}
(close to the end of the file), and change itshape
to bfseries
.
Alternatively, just paste the following into the preamble of your document:
\makeatletter
\renewenvironment{proof}[1][\proofname] {\par\pushQED{\qed}\normalfont\topsep6\p@\@plus6\p@\relax\trivlist\item[\hskip\labelsep\bfseries#1\@addpunct{.}]\ignorespaces}{\popQED\endtrivlist\@endpefalse}
\makeatother
Then the proof environment will behave exactly as before in terms of spacing, optional argument, \qedhere and so on, but you'll have bold rather than italic.
-
7
-