5

I was trying to replace . with : in the proof environment and after trying a lot of answered questions here, I got [I'm using amsmath]

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \itshape
    #1\@addpunct{:}]\ignorespaces}
    {\popQED\endtrivlist\@endpefalse}
\makeatother

but this isn't working very well for me. After dozens of tries, I came up with

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \itshape
    #1\@addpunct{:}]\ignorespaces}
    {\endtrivlist\@endpefalse}
\makeatother

So, what is the problem with \pushQED{\qed} and \popQED? Without both of them, the code works, but I can't get the qed square.

4
  • 1
    What's "not working well" in the first case?
    – egreg
    Jan 29, 2013 at 7:37
  • And welcome to TeX.sx!
    – egreg
    Jan 29, 2013 at 8:06
  • An easier way to get a colon is to say \renewcommand{\proofname}{Proof:}. Something more complex is needed if you use babel, but the idea is the same.
    – egreg
    Jan 29, 2013 at 9:23
  • @egreg Not working well is one of this message per proof "! Undefined control sequence. \\proof [#1]->\par \pushQED {\qed } \normalfont \topsep 6\p@ \@plus 6\p@ \re... l.167 T" Thank you for the good reception! And yes, I think I'm going to need the "something more complex", because I'm using [brazil]{babel}. Also, I commented the babel and tried the solution you gave and I got "Proof:.". Jan 29, 2013 at 11:48

1 Answer 1

4

This seems to work without any problem; note that you must load amsthm.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{amsthm} % for the proof environment

\addto\captionsbrazil{\renewcommand{\proofname}{Demonstra\c{c}\~ao:}}

\begin{document}

\begin{proof}
Exercise for the reader.
\end{proof}

\end{document}

enter image description here

Alternative and perhaps better version:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{amsthm} % for the proof environment

\makeatletter
\renewenvironment{proof}[1][\proofname]
  {\par\pushQED{\qed}%
   \normalfont \topsep6\p@\@plus6\p@\relax
   \trivlist
   \item[\hskip\labelsep
         \itshape
         #1\@addpunct{:}]\ignorespaces}
  {\popQED\endtrivlist\@endpefalse}
\makeatother

\begin{document}

\begin{proof}
Exercise for the reader.
\end{proof}

\end{document}

Another different version with patching (but it's just the same as the one before).

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{amsthm} % for the proof environment

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\proof}{\@addpunct{.}}{\@addpunct{:}}{}{}
\makeatother

\begin{document}

\begin{proof}
Exercise for the reader.
\end{proof}

\end{document}
3
  • Man, thank you. Your post helped me in another direction. I tried to use amsmath and discovered it was conflicting with \usepackage[amsmath,amsthm,thmmarks]{ntheorem} \theoremstyle{change} that I was using to put the number before the newtheorem name. Then, I used the amsthm and \numberswap and I got it solved. Thank you a lot! Jan 29, 2013 at 13:19
  • I have the same problem and same warming (with the suggested correction \renewenvironment....) because I replaced the amsthm package with ntheorem.
    – Noix07
    Dec 1, 2015 at 18:34
  • @user39158 That's a completely different situation and doesn't fit in this question. But I never recommend ntheorem.
    – egreg
    Dec 1, 2015 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .