12

I have created my own theorem environment like this

\newtheoremstyle{mythmstyle}{}{}{}{}{\scshape}{.}{ }{}
\theoremstyle{mythmstyle} \newtheorem{mythm}{Theorem}

How do I add the QED symbol (the white rectangle) into this custom environment? The \qedhere should work for it too, in case I need it.

  • 3
    "QED" is added to proof, not to theorem. – yo' Mar 21 '12 at 19:55
  • 1
    please see my answer to this question; it contains pointers to references for placing the qed symbol in places other than at the end of a proof. – barbara beeton Mar 21 '12 at 19:57
6

One option would be to use the thmtools package as a front-end for amsthm:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}

\declaretheoremstyle[
  spaceabove=\topsep, spacebelow=\topsep,
  headfont=\normalfont\scshape,
  notefont=\mdseries, notebraces={(}{)},
  bodyfont=\normalfont,
  postheadspace=1em,
  qed=\qedsymbol
]{mythmstyle}
\declaretheorem[style=mythmstyle]{theorem}

\begin{document}

\begin{theorem}
test
\end{theorem}

\begin{theorem}
test
\[
a\qedhere
\]
\end{theorem}

\end{document}

enter image description here

4

Since you're using the amsthm package, you could simply redefine the package's \@endtheorem macro to include the \qed instruction, which will place an empty square box at the far right end of the theorem's last line. It's necessary to surround such a redefinition with a pair of \makeatletter and \makeatother instructions because the @ symbol is (deliberately) special in LaTeX. The following MWE shows how this may be achieved.

\documentclass{article}
\usepackage{amsthm}
% redefine the \@endtheorem macro
\makeatletter  
\def\@endtheorem{\qed\endtrivlist\@endpefalse } % insert `\qed` macro
\makeatother

\newtheoremstyle{mythmstyle}{}{}{}{}{\scshape}{.}{ }{}
\theoremstyle{mythmstyle} 
\newtheorem{mythm}{Theorem}

\begin{document}
\begin{mythm}[Pythagoras]
Consider a right triangle with sides of length $a$, $b$, and 
$c$, and assume w.l.o.g.\ that $a\le b<c$. Then $a^2+b^2=c^2$. 
\end{mythm}
\end{document}

enter image description here

Note that this approach, though simple, isn't quite perfect because the qed symbol won't be placed correctly if the theorem ends with a displayed equation. In such cases, you should probably follow the approach provided in Gonzalo's answer, which employs the powerful thmtools package.

  • 1
    Will your solution affect all theorem like environments? How to do this only for one kind (example for example, not for the others theorem, corollary, etc...) – Sigur Apr 19 '14 at 16:36
  • 1
    @Sigur - To limit the scope of the proposed solution to a specific theorem style (e.g., mythmstyle), be sure to define all other theorem-like environments of your document before redefining \@endtheorem and setting up any new theorem styles and associated theorem-like environments (e.g., mythm). – Mico Apr 19 '14 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.