Alignment of implication arrows with text on top
The \stackrel
command is defined as
#1#2 → \mathrel{\mathop{#2}\limits^{#1}}
so you could use \smashoperator
from the mathtools
package to get rid of the space introduced by the left half of the superscript.
I'm defining \smashstackrel
below, a version of \stackrel
that incorporates \smashoperator
. I think \smashstackrel[l]
does precisely what you want.
I also defined \feliximplies{<text>}
to make life simpler.
\documentclass{article}
\usepackage{mathtools}
\newcommand*\smashstackrel[3][lr]{%
\mathrel{\smashoperator[#1]{\mathop{#3}^{#2}}}
}
\newcommand*\feliximplies[1]{\smashstackrel[l]{\textnormal{#1}}{\implies}}
\begin{document}
\begin{align}
&\text{First Statement}\\
&\implies \text{Second Statement}\\
&\smashstackrel[l]{\text{Explanation}}{\implies}\text{Third Statement}\\
&\feliximplies{Explanation} \text{Fourth Statement}
\end{align}
\end{document}
Notes:
The optional argument of
\smashstackrel
can be either[l]
,[r]
or[lr]
depending on whether you want to ignore the left side or the right side or both sides of the superscript for spacing purposes.\implies
is defined as\DOTSB\;\Longrightarrow\;
and\;
produces a space that can be stretched (but not shrunk, by default). This space will no longer be stretchable if\stackrel
(or\smashstackrel
) is used, so doing so feels slightly dubious. I think something like\;\mkern-\thickmuskip\stackrel{<text>}{\implies}\;\mkern-\thickmuskip
might be more appropriate than just
\stackrel{<text>}{implies}
. This reinserts precisely the amount of stretchability that was lost. (The same remark applies to\smashstackrel
and\noLstackrel
, which is defined below.)In this case it doesn't matter though, since here the space won't be stretched anyway. It would matter if this command were used inline rather than in a display environment.
Brief explanation:
\;
is defined as\mskip\thickmuskip
and inserts a horizontal space of length\thickmuskip
, which by default is5mu
but can be stretched to10mu
if necessary.\mkern
is similar to\mskip
, but it doesn't allow for stretching. So\mkern-\thickmuskip
removes a horizontal space of5mu
in this case so that we end up with a horizontal space of0mu
that can be stretched to up to5mu
. See this answer for more information on spacing commands.A possible disadvantage of
\smashstackrel
compared to\stackrel
is that it always typesets things in\displaystyle
. I've included a version of\smashstackrel[l]
that doesn't do this below because I had already written it before I suddenly remembered the existence of\smashoperator
.\makeatletter %% <- make @ usable in command names \newcommand*\noLstackrel[2]{\mathpalette\noLstackrel@{{#1}{#2}}} \newcommand*\noLstackrel@[2]{\noLstackrel@@{#1}#2} \newcommand*\noLstackrel@@[3]{% #1 = \displaystyle etc., #2 = top, #3 = bottom \begingroup %% <- limit scope of boxes \sbox0{$\m@th#1\stackrel{#2}{#3}$}% %% <- put stackrel construction in box 0 \sbox2{$\m@th#1#3$}% %% <- put base symbol in box 2 \hskip.5\wd2 \hskip-.5\wd0 %% <- remove excess width on the left \mathrel{\usebox0}% %% <- print box 0 \endgroup } \makeatother %% <- revert @
Usage:
\noLstackrel{<stuff on top>}{\implies}
.
Reading the documentation on mathtools after learning about \smashoperators
from Circumscribes answer, I found another possible solution: \xRightarrow
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align}
&\text{Statement}\\
&\implies \text{implies arrow}\\
&\xRightarrow{\text{Explanation}}\text{xRightarrow}\\
&\xRightarrow{(*)} \text{xRightarrow}\\
&\;\xRightarrow{(*)}\; \text{xRightarrow with ;}\\
&\implies \text{implies arrow}\\
&\;\xRightarrow{}\; \text{xRightarrow with ;}\\
&\;\Rightarrow\; \text{Rightarrow with ;}
\end{align}
\end{document}
Resulting in:
The advantage of this solution is, that it utilizes a command from a known package, which probably has less errors than a home cooked solution. And it allows for underscript too.
The disadvantage is probably clear from the picture. \implies
inserts a space before the arrow, which xRightarrow
does not do.
(EDIT: this can be fixed with \;
at the sides as Circumscribes points out but it is still noticeable that xRightarrow is based on Rightarrow, as you can see from the default length when there is no input)
So instead of \implies
you would probably have to use \Rightarrow
instead. Secondly I am not sure if I visually prefer different length arrows over explanations which overflow the width of the usual \implies
arrow.