3

In my project, I added this code \AtBeginDocument{\renewcommand\proofname{\underline{Proof}}}.

When I use the proof environment, the proofname goes like $\underline{\textit{Proof}}.$

But what I want is the underline extends to the end of the dot like this $\underline{\textit{Proof.}}$

So how can I do this without affecting the rest of the project ?

Here is my full code

\documentclass[13pt,a4paper]{report}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}

\AtBeginDocument{\renewcommand\proofname{\underline{Proof}}}

\begin{document}

\begin{proof} abc \end{proof}

\end{document}

PermQi
  • 187
  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for the users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – samcarter_is_at_topanswers.xyz Dec 12 '23 at 12:39
  • 2
    you should never put formatting in \....name macros they were introduced specifically to have macros just with pure text and no formatting so that it allows translation by babel and other packages just translating text with formatting being still supplied by the document class. – David Carlisle Dec 12 '23 at 12:45
  • @DavidCarlisle so what code should I use in particular ? – PermQi Dec 12 '23 at 12:48
  • 3
    you are still making it hard to answer you have added dozens of packages most of which are unrelated to the question, and no actual example of a prrof environment you appear to be using amsthm so you can declare a new proof enviornment using the declarations of that package – David Carlisle Dec 12 '23 at 12:50
  • @DavidCarlisle I edited my post – PermQi Dec 12 '23 at 12:58

2 Answers2

3

You shouldn't underline: the italic shape is sufficient to make the label visible.

Anyway, knowing how proof is defined you can do

\documentclass[12pt,a4paper]{report}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}

\AtBeginDocument{\renewcommand\proofname{\underline{Proof.}\spacefactor5000 }}

\begin{document}

\begin{proof} abc \end{proof}

\end{document}

Note that there is no 13pt option for report. I used twocolum in order to make a smaller picture.

enter image description here

If you want something better, where you can also use the optional argument to proof in order to get something different,

\documentclass[12pt,a4paper,twocolumn]{report}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{xpatch}

\makeatletter \xpatchcmd{\proof}{#1@addpunct{.}}{\underline{#1@addpunct{.}}}{}{} \makeatother

\begin{document}

\begin{proof} abc \end{proof}

\end{document}

egreg
  • 1,121,712
2

It seems not perfect, but it works:

\documentclass[12pt,a4paper]{report}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}

\begin{document}

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

\begin{proof} abc \end{proof}

\end{document}

MadyYuvi
  • 13,693