2

I recently got attached to the idea of finishing definitions, remarks, and observations with something “dual” to qed as appended to \proof environments – I currently define \newcommand{\fin}{\hfill\blacklozenge} and append this manually.

Is there any way to modify my \newtheorem{obs}[theorem]{Observation} declaration to automatically append \fin?

2

You could use the etoolbox package to append the \fin command to the end of the obs environment.

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{etoolbox}
\newcommand{\fin}{\hfill\ensuremath{\blacklozenge}}
\newtheorem{obs}{Observation}
\AtEndEnvironment{obs}{\fin}
\begin{document}
\begin{obs}
Test observation.
\end{obs}
\end{document}
|improve this answer|||||
  • No, if the \hfill is chosen as a line break point, the lozenge will be typeset at the beginning of the next line. A \strut does nothing to prevent the problem. – egreg Jan 6 at 16:50
  • 1
    Oh, thanks for pointing it out, I corrected my answer. I had made a test and it worked, so I thought it would solve the problem. I guess I have just been lucky with the placement of the line break. – Vincent Jan 6 at 16:58

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.