I cannot figure out how to get an \overleftrightarrow macro to add no vertical space to what is underneath. I am looking for the spacing between lines to appear as if the arrow does not exist and is smashed with the text beneath.

I have seen the following code which is almost perfect, but it still produces vertical space.


Alternatively, I am trying to use the \overleftrightarrow to denote a line. If you suggest an alternate syntax to avoid messing with the vertical space please let me know.

  • It’s not completely clear, at least to me, what do you mean, exactly, when you say that you don’t want to add any vertical space to the subformula covered by the arrow: do you mean that the arrow itself should be “smashed”, and that the spacing between the current line and the previous one should be computed as if the arrow were not present (with the arrow possibly overprinting the previous line)? – GuM Jul 25 '17 at 23:45
  • @GuM Yes! I have edited the post to clarify. – Davis Rash Jul 25 '17 at 23:48
  • 1
    Or just \smash{\overleftrightarrow{ABC}}? It seems to achieve the effect you want – Troy Jul 26 '17 at 2:25
  • @Troy: Indeed, \smash{\overleftrightarrow{ABC}} is probably the first solution one thinks of; but I felt like insisting on keeping the original height of the “accentee” (ABC in your example) and smashing only the over-arrow. – GuM Jul 26 '17 at 23:05

Here’s a possible solution, with some code borrowed from my halloweenmath package:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.



  % Works like "\mathpalette", but macro passed in #1 must take
  % (at least) three arguments, of which the first _two_ are
  % style selections.
    {#1\displaystyle      \scriptstyle       {#2}}%
    {#1\textstyle         \scriptstyle       {#2}}%
    {#1\scriptstyle       \scriptscriptstyle {#2}}%
    {#1\scriptscriptstyle \scriptscriptstyle {#2}}%
  % #1 := stretchable covering arrow
  % #2 := base style
  % #3 := style for covering arrow
  % #4 := base symbol
    $\m@th\hfil #2#4\hfil$\crcr
   \mkern-7mu \mathsm@sh#4#3$%

    {\@Davis@dblstyle@overarrow@ \@Davis@rightarrowfill@}%
    {\@Davis@dblstyle@overarrow@ \@Davis@leftarrowfill@}%
    {\@Davis@dblstyle@overarrow@ \@Davis@leftrightarrowfill@}%



A line of text, with some descenders: fgjpqy (and~Q).\\
A formula with ``overarrows'':
\( \overleftrightarrow{A+(B+C)} = \overleftrightarrow{(A+B)+C} \).

A line of text, with some descenders: fgjpqy (and~Q).\\
A formula with ``overarrows'':
\( \overDavisleftrightarrow{A+(B+C)} = \overDavisleftrightarrow{(A+B)+C} \).


The expected output:

Output of the code

Probably, giving some thought to the problem it is possible to find a shorter solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.