7

Example picture with arrows and text below them

How can I create arrows with a text below the arrows like in this picture? I tried it with LaTeX, but it didn't work like that in this picture.

3
  • 1
    Welcome to TeX.SE! Could you please add a little example of what you tried?
    – CarLaTeX
    Nov 14, 2022 at 18:08
  • @CarLaTeX 0=x^2 {{-4x}_{\displaystyle\uparrow_{p}}}+{{3}_{\displaystyle\uparrow_{q}}}
    – Celo
    Nov 14, 2022 at 18:35
  • 6
    Consider editing your question and including this snippet of code. Better yet, proivde a minimal working example (MWE). Nov 14, 2022 at 18:36

5 Answers 5

12
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
0 = x^{2}
    - \underset{\displaystyle p}{\underset{\uparrow}{4}}x
    + \underset{\displaystyle q}{\underset{\uparrow}{3}}
\]
\end{document}

enter image description here

10

This is a nice use case for stackengine:

\documentclass[border=10pt]{standalone}
\usepackage{stackengine}

\begin{document}
$ 0=x^2 -{} \stackMath\Shortunderstack{{4} {\uparrow} {p}}x + \stackMath\Shortunderstack{{3} {\uparrow} {q}} $
\end{document}

enter image description here

4

One of the many possible ways to add arrows in the desired manor is

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
0 = x^2 - &4 \, x + 3 \\
& \uparrow  \hspace{6mm} \uparrow \\
& p \hspace{6mm} q
\end{align*}

\end{document}

which gives the result enter image description here

4

A small variation of @Jasper Habicht answer:

  • for arrows are used arrows.meta library of tikz package
  • \stackMath is moved to begin of equation
\documentclass[margin=3mm, varwidth]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\newcommand\tikzuparrow{\tikz\draw[-{Straight Barb[scale=0.8]}] (0,0) -- ++ (0,0.5);}
\usepackage{amsmath}
\usepackage{stackengine}

\begin{document}
\[\stackMath
0 = x^2 - \Shortunderstack{4 {\tikzuparrow} p} x
        + \Shortunderstack{3 {\tikzuparrow} q}
\]
\end{document}

enter image description here

4

An important aspect is that the arrow and the descriptor should not add horizontal space (but it's up to you to avoid clashes in other situations).

\documentclass{article}
\usepackage{amsmath}

\newcommand{\subdesc}[2]{%
  % #1 = main part, #2 = subdescriptor
  \begin{array}[t]{@{}c@{}}
  #1 \\
  \noalign{\vspace{-0.6ex}}
  \hidewidth \scriptstyle\uparrow \hidewidth \\
  \noalign{\vspace{-0.3ex}}
  \hidewidth #2 \hidewidth
  \end{array}%
}

\begin{document}

\[
0 = x^3 - \subdesc{4}{p}x^3 + \subdesc{3}{q}
\]

\[
0 = x^3 - \subdesc{4}{a}x^3 + \subdesc{3}{b}
\]

\[
0 = x^3 - \subdesc{4}{u-v}x^3 + \subdesc{3}{b}
\]

\end{document}

The arrow is in \scriptstyle to make it less prominent, but this requires fixing a bit the vertical spacing.

enter image description here

You must log in to answer this question.

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