# Align QED symbol with last row of a centered table

Compiling the code

\documentclass{svmono}
\smartqed
\usepackage{amsmath}
\begin{document}
\begin{example}[Some example]
This table is centered:
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular}
\end{center}
The table below should be centered, but it's not:
\begin{center}
\begin{tabular}[b]{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular}\qed
\end{center}
\end{example}
Text after the example.
\end{document}


results in

How to get both the centering of the second table and the end-of-the-proof symbol aligned with the last horizontal line of the table? Please don't suggest something like putting \par\vspace{-1.7\baselineskip}\qed after \end{center}, unless you are sure that your solution is robust with respect to the changes of the font families.

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

EDIT: If one wishes to use marginnote for its original purpose in addition to placing the halmos symbol, cf. QED for cases and tables in the presence of margin notes (and todonotes)

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.

I propose to use \marginnote to put the \qed to the margin, a \makebox to remove the automatically inserted space before it, and a shift of of length \marginparsep to the left to have the \qed inside the page margins and not outside. For convenience, I put all three parts to a macro \marginqed:

\usepackage{marginnote}
\newcommand{\marginqed}{\marginnote{\makebox[0pt][r]{\qed\hspace*{\marginparsep}}}}


For the vertical alignment, it is important where you put \marginqed: Put it directly after \end{tabular} for alignment with the last horizontal line, or inside the last row for alignment with the baseline of the text.

So far, this only works for odd pages. To have it work on even pages similarly, I followed this answer and patched a marginnote macro with the help of etoolbox:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@mn@margintest}{\@tempswafalse}{\@tempswatrue}{}{}
\patchcmd{\@mn@margintest}{\@tempswafalse}{\@tempswatrue}{}{}
\makeatother


The qed symbol of \marginqed will now be close to the right-hand margin of the page, both on odd and even pages.

The following MWE demonstrates this both for even and odd pages. And since you use the marginfix and todonotes in your actual document, I added those as well together with a long standard \marginpar and a \todo to show that there is no intereference with marginqed.

\documentclass{svmono}
\smartqed
\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  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]
This table is centered:
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular}
\end{center}
The table below should be centered, but it's not:
\begin{center}
\begin{tabular}[b]{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular}\marginqed
\end{center}
\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  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]
This table is centered:
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular}
\end{center}
The table below should be centered, but it's not:
\begin{center}
\begin{tabular}[b]{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular}\marginqed
\end{center}
\end{example}
Text after the example.
\end{document}


It seems the problems of the svmono class with ntheorem come from svmono defining its own set of theorem-like structures, which therefore conflict with svmono, unless you change the names.

In any case, svmono defines its theorem structures the way ntheorem works, and you have the option nospthms, which deactivate the svmono set of theorems. This set is easily emulated. I did it for example and the following code works fine:

\documentclass[nospthms]{svmono}
\usepackage{amsmath, amssymb}
\usepackage[amsmath, thmmarks]{ntheorem}
\theoremstyle{nonumberplain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\square}}
\newtheorem{example}{Example}

\begin{document}

\begin{example}[Some example]
This table is centered:
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular}
\end{center}
The table below should be centered, but it's not:
\begin{center}
\begin{tabular}[b]{|c|c|c|}
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
Some cell & some cell & some cell\\
\hline
\end{tabular} %
\end{center}
\end{example}
Text after the example.

\end{document}


• @MdAyquassar:You're welcome. If you give another try, don't forget to set the hyperref option, and read §3.1, Interfering document options in the documentation, pp. 15–17. – Bernard Jun 7 '18 at 18:25
• Why this downvote, without any explanation? – Bernard Jul 20 '18 at 15:24