# \qedhere in RTL documents

In RTL documents, the QED symbol typically appear on the left side of the page, at the last line of the proof (flushed). Many proofs end with an equation, and it those cases it is customary to use the \qedhere command which puts the QED symbol in the proper height (where normally it appears one line after the last equation).

However, in RTL documents the \qedhere command, which assumes (correctly!) that equations are still from left to right, shifts the QED symbol to the right side of the page, which looks completely wrong.

I am not sure that the right solution here would be to actually "fix" the \qedhere command in these cases. Perhaps it is better to simply not use it, or try to avoid proofs which end with an equation. I would like to hear your opinion, and, if it is even possible to fix \qedhere easily.

Here's a minimal working example.

\documentclass{article}
\usepackage{amsmath,amsthm}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}

\begin{document}
\begin{proof}
ההוכחה מסתיימת במשוואה הבאה:
\begin{equation*}
x = 3.
\end{equation*}
\end{proof}

\begin{proof}
ההוכחה מסתיימת במשוואה הבאה:
\begin{equation*}
x = 3.\qedhere
\end{equation*}
\end{proof}
\end{document}


Which produces:

• Did you try with ntheorem in the place of amsthm? It has an automatic placement of end-of-theorem symbol, which works well (for left-to-right languages) in displayed equations (even multiline equations). Jul 30 '17 at 15:29

However, in RTL documents the \qedhere command, which assumes (correctly!) that equations are still from left to right, shifts the QED symbol to the right side of the page, which looks completely wrong.

I do not agree. The QED symbol always appears at the end of the line; in the first case, lines start from right to left so the QED symbol should appear at the end of the line which is left. On the other hand, in the second case line starts from left to right so the QED symbol is also at the end of the line which is right and that is perfectly correct.

This does what you asked but I find it odd and ugly.

\documentclass{article}
\usepackage{amsmath,amsthm}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
\makeatletter
\def\displaymath@qed{%
\relax
\ifmmode
\ifinner \aftergroup\linebox@qed
\else
\leqno % was \eqno
\let\eqno\relax \let\leqno\relax \let\veqno\relax
\hbox{\qedsymbol}%
\fi
\else
\aftergroup\linebox@qed
\fi
}
\@xp\let\csname equation*@qed\endcsname\displaymath@qed
\makeatother
\begin{document}
\begin{proof}
ההוכחה מסתיימת במשוואה הבאה:
\begin{equation*}
x = 3.
\end{equation*}
\end{proof}

\begin{proof}
ההוכחה מסתיימת במשוואה הבאה:
\begin{equation*}
x = 3.\qedhere
\end{equation*}
\end{proof}
\end{document}