2

I'm trying to get a construction like

\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}
\begin{align*}
  a &= b \\
    &\Downarrow \\
  a &= c
\end{align*}
\end{document}

enter image description here

to look good. The problem is that the \Downarrow is not horizontally centered between the = signs. While I understand why this happens and why a \mathrel{\Downarrow} doesn't help, I don't know how to fix it. I'm aware of the \ArrowBetweenLines[\Downarrow] function in mathtools, but that is for having the arrow to the left of the aligned lines. I would ideally want something that works the same way \vdotswithin{=} does (from mathtools). Does that exist somewhere? Or would it be difficult to manually "create a box corersponding to {}={} and typeset a" \Downarrow "centered inside it"?

2 Answers 2

1

Here's the definition of \vdotswithin from mathtools:

\newcommand\vdotswithin[1]{%
  {\mathmakebox[\widthof{\ensuremath{{}#1{}}}][c]{{\vdots}}}}

You can update this to something called \symbolwithin{<symbol>}{<within symbol>} (say):

enter image description here

\documentclass{article}

\usepackage{mathtools}

\newcommand\symbolwithin[2]{%
  {\mathmakebox[\widthof{\ensuremath{{}#2{}}}][c]{{#1}}}}

\begin{document}

\begin{align*}
  a &= b \\
    &\symbolwithin{\Downarrow}{=} \\
  a &= c
\end{align*}

\end{document}
3
  • In my opinion that exact function would have been a nice addition to mathtools (with a corresponding version for less vertical spacing).
    – tanh
    Commented Feb 11, 2016 at 19:49
  • I can't find \mathmakebox{} documented anywhere, and don't see how it behaves differently than '\makebox'. It seems to be part of mathtools but it's not explained in the manual. Do you know if it makes a difference here?
    – tanh
    Commented Feb 11, 2016 at 19:53
  • 1
    @tanh: \makebox defaults to setting its contents using \textstyle when using $..$ for setting math, while \mathmakebox checks the current math mode and conditions accordingly without having to use $..$.
    – Werner
    Commented Feb 11, 2016 at 19:57
2

Here, I put the downarrow in a box the size of an equals sign

\documentclass{article}
\usepackage{amsmath,mathtools,calc}
\begin{document}
\begin{align*}
  a &= b \\
    &\makebox[\widthof{${}={}$}]{$\Downarrow$} \\
  a &= c
\end{align*}
\end{document}

enter image description here

3
  • 1
    I'm not sure the optional argument [c] is necessary. Isn't it the default?
    – Bernard
    Commented Feb 11, 2016 at 19:22
  • 1
    @Bernard Correct. It was vestigial and I have removed it. Commented Feb 11, 2016 at 19:24
  • @StevenB.Segletes Perfect, thank you. This kind of makes me wish \vdotswithin{=} were generalized to something like \symbolwithin{\vdots}{=} with a corresponding \shortsymbolwithin{}{} version for less vertical space (which I imagine is more complex).
    – tanh
    Commented Feb 11, 2016 at 19:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .