29

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

enter image description here

43

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.

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

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.

| improve this answer | |
  • \rotatebox? Really? ;-) – egreg Nov 24 '14 at 21:09
5

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}
| improve this answer | |
0

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

| improve this answer | |

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.