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?
6 Answers
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.
- 44,937
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
-
16As 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*}. – Bruno Le Floch Jan 01 '11 at 23:21 -
13if you're using
amsthm, all these redefinitions are too simple-minded; you will lose the ability to use\qedhereto adjust the placement of the "tombstone" if the proof ends with a list or display. – barbara beeton Jul 24 '12 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. – Mar 25 '14 at 21:30
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.
- 720
-
3See Does it matter if I use
\textitor\it,\bfseriesor\bf, etc. and Will two-letter font style commands (\bf,\it, …) ever be resurrected in LaTeX? on the use of old font macros like\rmand\bf. – Werner Jul 23 '12 at 16:57 -
1You cannot use
\textitor\textbfbecause 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\bfseriesinstead of\rm\bfas they're the LaTeX versions, but to be honest, I don't see a big difference. – richard Jul 24 '12 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\bfserieswould act as switches in analogue to\rm\bfcompared to macros that gobble their arguments (as does\textbfand company). To that extent, you don't need to group\oldproofname, since neither\rmnot\bftakes an argument. – Werner Jul 24 '12 at 21:46 -
1If you redefine
\proofnameonly then the dot after proof name will remain non-bold italic. – Smylic Nov 18 '13 at 23:52 -
2I 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. – Rob Kennedy Aug 22 '15 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.
- 88,848
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.
- 416
This was my solution to the same problem.
First, I took the code snippet related to the proof environment in amsthm.sty:
\newenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.}]\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
I copied the snippet to the style files of my own document with a little modifications, just as it should have been implemented to allow the customization of "proofname" style:
\makeatletter
\providecommand{\proofNameStyle}{\itshape}
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\proofNameStyle
#1\@addpunct{.}]\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother
Then, the following command in my document styles customizes the style of "proofname" as expected:
\renewcommand{\proofNameStyle}{\bfseries}
You can use this command if you want to have the "proofname" both italic and bold:
\renewcommand{\proofNameStyle}{\itshape \bfseries}
-
I proposed the same idea time ago. I'm still hoping that the AMS will implement it. https://tex.stackexchange.com/a/477477/4427 – egreg Sep 29 '22 at 16:37
an_antanswer with a\renewenvironmentlooks simpler to me. – jutky Jan 01 '11 at 22:17an_ant's way has a drawback: the\qedsymbol 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. – Bruno Le Floch Jan 01 '11 at 23:19