1

I want to get a similar and simple effect like this that doesn't involve crazy arrow curves or packages.

enter image description here

4 Answers 4

8

I'm adapting my answer to "How to add arrow in equations and matrix?" to your example; check it out for some explanations. Basically, you have to

  • wrap all parts that you want to reference in the drawing commands into a \tikznode command, which assigns a name to it and stores the size of the box

  • add a tikzpicture environment starting with

    \begin{tikzpicture}[remember picture,overlay,...]
    

    that contains the draw commands.

  • run LaTeX twice to get the positions right.

enter image description here

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\newcommand\tikznode[3][]%
   {\tikz[remember picture,baseline=(#2.base)]
      \node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
   }
\begin{document}
\begin{align*}
  \tikznode{PT}{$P_{T}$} &=
  \tikznode{PB0}{$P^{0}_{B}$}+X_{A}(\tikznode{diff}{$\underbrace{P^{0}_{A}-P^{0}_{B}}$}) \\[2ex]
  \tikznode{y}{$y$} & =  \tikznode{a}{$a$}+ \tikznode{b}{$b$}\cdot x
\end{align*}
\begin{tikzpicture}[remember picture,overlay,cyan,rounded corners,>=stealth,shorten > =1pt,shorten <=1pt,thick]
  \draw[->] (PT) -- (y);
  \draw[->] (PB0) -- (a);
  \draw[->] (diff) -- +(0,-0.5) -| (b);
\end{tikzpicture}
\end{document}
2
  • What do the stealth and shorten parts do?
    – graffe
    Jan 18, 2021 at 6:48
  • 1
    @Anush Remove or change it, and you will see. stealth is a particular type of arrow (looking like these fighter planes, stealth bombers); if you remove >=stealth, you get the default type of arrows. shorten < and shorten > reduce the lines at the beginning and at the end by the given amount. Otherwise the lines would start directly from and end at the borders of the object. For more information, see the tikz manual.
    – gernot
    Jan 18, 2021 at 9:55
4

This is one of many solution to create your image...I have not used TikZ but a simple environment array. Just to be correct considering that the moving of the characters was done manually with \mkern, whenever you added something the arrows would move and not be aligned as in the example.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\begin{document}
\[
\begin{array}{ll}
P_{T} &= P^{0}_{B}+X_{A}(\underbrace{P^{0}_{A}-P^{0}_{B}}) \\[-.4ex]
\downarrow & \quad \downarrow \mkern85mu \swarrow\\
y & =  a+\mkern50mu b\cdot x
\end{array}   
\]
\end{document}

enter image description here

2
  • 1
    Great, but, in the question, the two P^{0}_{B} are the same, and those look more like P_{A}^{0} and P_{B}^{0} to me. This would perfect the answer.
    – user231678
    Jan 17, 2021 at 20:54
  • 1
    @niamulbengali You have right :-(...I often do a mix of the sub-over script :-(
    – Sebastiano
    Jan 17, 2021 at 20:56
3

Here is a possibility with pstricks:

\documentclass[svgnames]{article}
\usepackage{mathtools}
\usepackage{amssymb, bm} 
\newcommand{\mathbsf}[1]{\bm{\mathsf{#1}}}
\usepackage{pst-node} 

\begin{document}

\begin{alignat*}{2}
 \rnode{PT}{P_T} & ={} & \rnode{PB}{P_B⁰} & + X_A\bigl(\underbrace{P_A-P_B^0}_{\pnode[-3pt, 1.5ex]{PAB}}\bigr) \\[1.5ex]
\rnode{y}{\mathbsf{y}} & ={} & \rnode{a}{\mathbsf{a}} & \mathbin{\mathbsf{+}} \rnode{b}{\mathbsf{b}}\cdot \mathbsf{x}
\psset{arrows=->, arrowinset=0.12, linecolor=DeepSkyBlue, nodesep=1pt}
\ncline{PT}{y}
\ncline{PB}{a}
\ncline{PAB}{b}
 \end{alignat*}

\end{document} } 

enter image description here

2

You should be to use the tikz to make arrows in the equation like example below.

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
    \begin{equation}
        \begin{tikzpicture}
        \node (E1) at (0,0.71) {$P_{T} = P^{0}_{B}+X_{A}(\underbrace{P^{0}_{A}-P^{0}_{B}})$};
        \node (E2) at (0,0) {$Y = A + B X$};
        \draw[->,thick] (-0.7,.6)--(-0.1,0.2); 
        \draw[->,thick] (1.2,.5)--(0.6,0.2); 
        \draw[->,thick] (-1.7,.7)--(-1.1,0.2); 
        \end{tikzpicture}
    \end{equation}

\end{document}

Good luck

enter image description here

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.