39

\downarrow command is available in directory but it has fixed length. How can I elongate its length?

enter image description here

4 Answers 4

58

The \downarrow symbol is an extensible delimiter:

\documentclass{article}

\newcommand{\xdownarrow}[1]{%
  {\left\downarrow\vbox to #1{}\right.\kern-\nulldelimiterspace}
}

\begin{document}

$
\downarrow
\big\downarrow
\Big\downarrow
\bigg\downarrow
\Bigg\downarrow
\xdownarrow{2cm}
$

\end{document}

enter image description here

You can use the same method also for \uparrow, \updownarrow, \Downarrow, \Uparrow and \Updownarrow.

4
  • Your arrow isn't 2cm height. Its total height is approximately 2*(2cm-A), where A is math axis height.
    – wipet
    Apr 13, 2015 at 10:23
  • @wipet Did I say it is? But thanks for noting, it can help readers.
    – egreg
    Apr 13, 2015 at 16:10
  • Looking at the tip it seems as if the unscaled and scaled arrows are different glyphs. May 29, 2016 at 16:25
  • @HenriMenke Correct.
    – egreg
    May 29, 2016 at 16:26
8

You can define your own command, for example:

enter image description here

The code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\newcommand\xdownarrow[1][2ex]{%
   \mathrel{\rotatebox{90}{$\xleftarrow{\rule{#1}{0pt}}$}}
}

\begin{document}

\[
\xdownarrow\quad
\xdownarrow[30pt]\quad
\xdownarrow[2.5cm]
\]

\end{document}

The default length is 2ex and you can control it using the optional argument for \xdownarrow.

With the above definition, the arrow tip will sit on the baseline, you can change the definition to

\newcommand\xdownarrow[1][2ex]{%
   \mathrel{\rotatebox[origin=c]{90}{$\xleftarrow{\rule{#1}{0pt}}$}}
}

for a vertically centered symbol.

1
  • \rotatebox? Really? ;-)
    – egreg
    Nov 24, 2014 at 21:09
6

You can also draw it with tikz which gives you a lot of flexibility should you desire any customization such as arrow styles, colors, and line styles:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{xparse}% So that we can have two optional parameters

\NewDocumentCommand\DownArrow{O{2.0ex} O{black}}{%
   \mathrel{\tikz[baseline] \draw [<-, line width=0.5pt, #2] (0,0) -- ++(0,#1);}
}

\begin{document}

\[ a
\DownArrow b 
\DownArrow[30pt][>=latex,red, ultra thick] c
\DownArrow[2.5cm][>=stealth,blue, thick, dashed] b
\]

\end{document}
2

A (similar) alternative, using gathered environment:

\documentclass{article}

\usepackage{amsmath}

\newcommand{\xdownarrow}[2][]{%
\left.{#1}\right\downarrow{#2}}

\begin{document}

$
\xdownarrow[\begin{gathered}
    \vspace{5cm}
    \end{gathered}]{}
$

\end{document}

If you want, it can be used with linebreaks inside:

$
\xdownarrow[\begin{gathered}
    \\
    \\
    \\
    \end{gathered}]{}
$

Usually I use this scheme to place a specific down-arrow across multirows in a table:

\documentclass{article}

\usepackage{amsmath}
\usepackage{multirow}

\newcommand{\xdownarrow}[2][]{%
\left.{#1}\right\downarrow{#2}}

\begin{document}

  \begin{tabular}{cc}
  \hline
  {Lower}   & Text 1\\
  \multirow{2}{*}{$\xdownarrow[\begin{gathered}
  \hfill \\
  \hfill \\
  \hfill \\
  \end{gathered}]{}$ }
            & Text 2\\
            & Text 3\\
            & Text 4\\
            & Text 5\\
  {Higher}  & Text 6\\
  \hline
  \end{tabular}

\end{document}

enter image description here

You must log in to answer this question.

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