Code: Select all
\documentclass{svmono}% v5.6 from https://www.springer.com/gp/authors-editors/book-authors-editors/resources-guidelines/rights-permissions-licensing/manuscript-preparation/5636, dated 23 April 2019. If you use "book" instead, define the environment "example" yourself.
\usepackage{newtxtext}
\usepackage[slantedGreek]{newtxmath}%% Should be loaded after the text font according to its manual. The default uppercase Greek letter
\usepackage{lipsum}
\usepackage{tikz}\usetikzlibrary{calc,shapes,positioning}
\usepackage{mathtools}\mathtoolsset{mathic=true} %%% See http://tex.stackexchange.com/a/3496/
\newcommand*{\mathQEDendingNonProofSymbol}{\Box}%%% Alternatives: \square, \boxempty
\newcommand*{\textQEDendingNonProofSymbol}{\(\mathQEDendingNonProofSymbol\)}%%% Alternatives: \square, \boxempty
\makeatletter
\newcommand*{\textQEDendingNonProof}{{\unskip\nobreak\hfil\penalty50\hskip1em\null\nobreak\hfil\textQEDendingNonProofSymbol\parfillskip=\z@\finalhyphendemerits=0\endgraf}}
\makeatother
\newcommand*{\qedEndingNonProofAfterTikzCenter}{\nopagebreak\par\nopagebreak\vspace{-1.57\baselineskip}\nopagebreak\textQEDendingNonProof}%%% -1.57\baselineskip is a wild guess; it is subject to change depending on the font used
\begin{document}
\begin{example}
\lipsum[1][1-2]
\begin{center}
\begin{tikzpicture}[atomicNode/.style={ellipse,draw,inner sep=.3ex,minimum width=3em},startNode/.style={circle,inner sep=.2ex,fill},startText/.style={inner sep=.15ex}]
\node (MThreeText) {\(M_3\):};
\node[startText,below=1ex of MThreeText] (MThreeStartText) {\(x\coloneqq 2\)};
\node[startNode,anchor=north] (MThreeStart) at (MThreeStartText.south) {};
\node[atomicNode] (MThreeSOne) at ($(MThreeStart.south east)+(3em,-4ex)$) {\(S_1\)};
\node[atomicNode,right=5em of MThreeSOne] (MThreeSTwo) {\(S_2\)};
\draw[-latex] (MThreeStart) -- (MThreeSOne);
\draw[-latex] (MThreeSOne) to[bend left]node[above,pos=.55]{\(\{\mathit{odd}(x)\}\,x\coloneqq 2\)} (MThreeSTwo);
\end{tikzpicture}
\end{center}%
\qedEndingNonProofAfterTikzCenter%
\end{example}
\end{document}
My current solution involves finishing the `center` environment, introducing a wildly guessed negative vertical space, putting the box, and continuing from there on. This is fragile: wild guesses break when the general parameters such as the font or the baselineskip change. Instead, we should undo the vertical skip(s) introduced by `\endcenter` in a font-independent way (which boils down to undoing the vertical skip(s) introduced by `\endtrivlist`), put the QED symbol, and redo the vertical skip(s). However, the definition of `\endtrivlist` is a bit too complicated for me to understand. I imagine that `trivlist` is a very standard thing, so, someone has probably already done the job. Any help?
An aside is worth being made. Marginnote-based solutions to place the qed symbol are of second choice, since the package is abandoned and does lead to problems with a large book. Marginpar/marginline sometimes requires manual vertical adjustments, i.e., a no-go for automation. Using `amsthm` or `ntheorem` is also a no-go: `amsthm` clashes with `svmono` in various ways, and `ntheorem` has bugs (e.g., doesn't jive with UTF-8 engines and has other problems, see https://tex.stackexchange.com/questions/tagged/ntheorem) and is both antique and abandoned. The inclusion of `ntheorem` with some options into `svmono.cls` is, in fact, so far from a clever design that I had to turn off `ntheorem` manually. (If you have problems with getting `svmono.cls` for the purpose of trying this very example out, go with the `book` class instead and define `example` via `\newtheorem`).