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?

  • This answer provides code that will automatically add a symbol to the end of a theorem-class object: https://tex.stackexchange.com/a/32394/579 )potential duplicate) – barbara beeton Jan 07 '20 at 23:47

1 Answers1

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}
Vincent
  • 20,157
  • 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 06 '20 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 06 '20 at 16:58