I am writing a text where the editor suggested to close all the definitions with a diamond.
So I was wondering, is there a easy way to automatically add a command to all the \end{definition} ? I looked the documentation of \theoremstyle, but it does not really seem to help.
Here is a working example where I did it manually...
\documentclass{article}
\usepackage{amssymb}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newcommand{\xqed}[1]{%
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{\ensuremath{#1}}}
\newcommand{\Endofdef}{\xqed{\lozenge}}
\begin{document}
\begin{definition}
(Stack Overflow) Stack Overflow is a privately held website, the flagship site
of the Stack Exchange Network, created in 2008 by Jeff Atwood and Joel Spolsky,
as a more open alternative to earlier Q\&A sites such as Experts Exchange.\Endofdef
\end{definition}
\end{document}


\xqedcommand seems to come from). My solution there works even for definitions nested inproofenvironments. – egreg Feb 03 '15 at 17:35ftp://ftp.ams.org/pub/author-info/documentation/howto/extra-qed.tex? There is where I read thexqeddefinition. – Paolo.Bolzoni Feb 03 '15 at 17:48amsthm, to be considered the next time that is updated. (but i can't predict when an update might happen.) – barbara beeton Feb 03 '15 at 17:57\pushQEDapproach. – egreg Feb 03 '15 at 18:07\pushQEDis how the end-of-proof mark is implemented, so (of course) that's how we'd implement the comparable feature for theorems. the document cited by the original poster in his comment is just a stopgap until an update toamsthmis undertaken. what do you think of the idea of putting in a test for vertical mode, and issuing a warning if that's true? (maybe even an error, but many variations of "endings" would have to be tested first to make sure we're not backing ourselves into a corner.) – barbara beeton Feb 03 '15 at 19:31\end{<env>}would indeed be disastrous. Users should be made aware of\qedhere. A test should check for vertical mode or nothing in the current horizontal list (the latter is not easy). – egreg Feb 03 '15 at 21:02amsthmrequest list. (we do try to make authors aware of\qedhere, but so many are so proud that they don't ever read documentation!) – barbara beeton Feb 03 '15 at 21:21