0

My proof redefinition command does not work on some cases and I cannot see the pattern nor the reason. These are the more reduced MN(N)E I could get. They were reproduced on Overleaf.

MWE 1:

\documentclass{article}

\usepackage{amssymb,amsmath,amsthm}

\begin{document} \begin{proof} I'm a froop \end{proof} \end{document}

MNWE 1:

\documentclass{article}

\usepackage{amssymb,amsmath,amsthm}

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

\begin{document} \begin{proof} I'm a froop \end{proof} \end{document}

That would seem to indicate that my redefinition is not working. However, by adding the preamble in a separate file things seem to work fine.

The following is the main file.

\documentclass{article}
\usepackage{Preamble}

\begin{document} \begin{proof} I'm a froop \end{proof} \end{document}

MWE 2 (Preamble):

\ProvidesPackage{Preamble}

\usepackage{amssymb,amsmath,amsthm}

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

\makeatletter \makeatother

MNEW 2 (Preamble):

\ProvidesPackage{Preamble}

\usepackage{amssymb,amsmath,amsthm}

\makeatletter \makeatother

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

The point of knowing what's happening is to know where I can or cannot place my redefinition on the preamble.

Gilgamesh
  • 267
  • 3
    You need \makeatletter ... \makeatother around the \renewenvironment (that is to say \makeatletter needs to go before the entire redefinition block and \makeatother after the block, putting the two commands directly after each other has basically no effect). If you put the redefinition into a .sty file that you then load with \usepackage the \makeatletter ... \makeatother is implicit. (Generally \makeatletter/\makeatother should be avoided when writing .sty files.) – moewe Oct 15 '21 at 17:56
  • 1
    Related https://tex.stackexchange.com/q/8351/35864 – moewe Oct 15 '21 at 17:57
  • The \makeatletter ... \makeatother intended to represent another definition, that's why there where outside. I now understand (https://tex.stackexchange.com/questions/62583/is-it-really-bad-to-use-makeatletter-and-makeatother-in-a-package-or-class-fil) the problem is that I shouldn't use the \makeatother command on .sty files (and if I do I should re-start it for other definitions and packages with \makeatletter). Is that correct? Thank you for your comment and the reference. – Gilgamesh Oct 15 '21 at 18:12
  • 2
    Yes. In general you should not use \makeatletter ... \makeatother in .sty files and in MNEW 2 the \makeatother is exactly the problem. A related issue is discussed in https://tex.stackexchange.com/q/62583/35864. In your examples there is absolutely no reason for \makeatletter or \makeatother in the .sty file, so you can just drop them. – moewe Oct 15 '21 at 18:19

0 Answers0