Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
2  
"QED" is added to proof, not to theorem. –  tohecz 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
add comment

2 Answers

up vote 6 down vote accepted

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

share|improve this answer
add comment

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.

share|improve this answer
    
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 3 hours ago
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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