# qed when cases is the last element of the proof-ending display with svmono class without amsthm and ntheorem

Compiling the following code

\documentclass{svmono}%%% v 5.5
\smartqed
\usepackage{amsmath}
%%% Loading lots of other packages here, marginfix among them.
\begin{document}
\begin{example}[Some example]
\begin{align*}
x & =f(y)\\
z & =
\begin{cases}
a,&\text{if}\ \varphi,\\
b,&\text{otherwise}
\end{cases}
\end{align*}
\par\vspace{-1.7\baselineskip}\qed%%%% Way too hardcoded, and not the best vertical alignment.
\end{example}
Text after the example.
\end{document}


with pdflatex leads to

As we see, the placement of the qed symbol is not ideal and subject to changing when someone (say, editor) decides to change the vertical gaps of the align* or cases environements but forgets to update the qed placement. Is there, perhaps, a more automatic way which would place the qed symbol exactly on the last line of an align* ending with cases?

• Loading amsthm or ntheorem is excluded in this question by definition (Loading them in a full, non-minimal example of mine produces unwanted effects with some other packages. Moreover, SVmono provides its own theorem classes that are to be used according to Springer's Reference Guide. Last but not least, ntheorem is broken in certain ways and seems to be not maintained any more.);

• Plainly copying-and-pasting the code of amsthm doesn't right-flush the qed symbol completely.

The svmono class and its manual are available from Springer's website.

• Maybe ntheorem is broken in some ways, but I never had any problem. Are you sure the unwanted effects you mention (which ones?) do not depend on the loading order? – Bernard May 9 '18 at 12:15

Disclaimer: Dear reader, this is not the most general solution but a specific hack for the situation of the OP. It requires that you don't use \marginnote for its original purpose (but I'll show that you can use marginfix or todonotes for such purposes), and that you have alternating odd and even pages (if not, another hack to cure an internal counter would be needed - please ask this as a new question if you want to see the solution to that). If that suits you (it suits e.g. all the LaTeX projects I personally have done so far), then feel free to use it.

My answer to your other question also works in this case:

• Use \marginnote from the marginnote package, \makebox and \marginparsep to define a macro \marginqed.
• Follow this answer to make it work both on odd and even pages.
• Check that it doesn't collide with your use of the marginfix and todonotes packages.

MWE:

\documentclass{svmono}%%% v 5.5
\smartqed
\usepackage{amsmath}
\usepackage[showframe]{geometry}
\usepackage{marginnote}
\usepackage{marginfix}
\usepackage{todonotes}
\newcommand{\marginqed}{\marginnote{\makebox[0pt][r]{\qed\hspace*{\marginparsep}}}}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@mn@margintest}{\@tempswafalse}{\@tempswatrue}{}{}
\patchcmd{\@mn@margintest}{\@tempswafalse}{\@tempswatrue}{}{}
\makeatother
\begin{document}
Some text\marginpar{Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text }\todo{Does this work together?}
\begin{example}[Some example]
\begin{align*}
x & =f(y)\\
z & =
\begin{cases}
a,&\text{if}\ \varphi,\\
b,&\text{otherwise}\marginqed
\end{cases}
\end{align*}
\end{example}
Text after the example.
\newpage
Some text\marginpar{Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text }\todo{Does this work together?}
\begin{example}[Some example]
\begin{align*}
x & =f(y)\\
z & =
\begin{cases}
a,&\text{if}\ \varphi,\\
b,&\text{otherwise}\marginqed
\end{cases}
\end{align*}
\end{example}
Text after the example.
\end{document}