Graphics, Figures & TablesArrow to Text Label on another Arrow

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pjmiller_57
Posts: 20
Joined: Tue Nov 08, 2011 4:37 pm

Arrow to Text Label on another Arrow

Post by pjmiller_57 »

Hello All,

I'm drawing some path diagrams using TikZ. I'd like to draw an interaction in some of the diagrams. Trouble is, I can't quite see how to do it.

Below is some simple code that illustrates what I'm trying to do.

Code: Select all

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,shapes.geometric}

\tikzstyle{rect}=[rectangle,draw=black,font=\small\sffamily\bfseries,inner sep=9pt]
\tikzstyle{arr}=[-latex,black,line width=0.5pt]

\begin{document}
  \begin{tikzpicture}[auto]
    \node[rect] (X1) at (12, 0) {$X_1$};
    \node[rect] (X2) at (18, 5) {$X_2$};
    \node[rect] (Y)  at (24, 0) {$Y$};

    \draw[arr] (X1)  to node[pos=.33,font=\scriptsize] {$\beta_1$} (Y);
  \end{tikzpicture}
\end{document}
Can anyone show me how to get an arrow from X2 to beta1?

Thanks,
Paul
Last edited by localghost on Thu Sep 19, 2013 7:01 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Arrow to Text Label on another Arrow

Post by localghost »

pjmiller_57 wrote:[…] Can anyone show me how to get an arrow from X2 to beta1? […]
Give that node a name and simply draw an arrow.

Code: Select all

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,shapes.geometric}

\usepackage{hyperref}
\hypersetup{
  pdfstartview={XYZ null null 1.00},
  pdfview={XYZ null null 1.00}
}

\tikzstyle{rect}=[rectangle,draw=black,font=\small\sffamily\bfseries,inner sep=9pt]
\tikzstyle{arr}=[-latex,black,line width=0.5pt]

\begin{document}
  \begin{tikzpicture}[auto]
    \node[rect] (X1) at (12, 0) {$X_1$};
    \node[rect] (X2) at (18, 5) {$X_2$};
    \node[rect] (Y)  at (24, 0) {$Y$};

    \draw[arr] (X1) to node[pos=.33,font=\scriptsize] (b1) {$\beta_1$} (Y);
    \draw[arr] (X2) to (b1);
  \end{tikzpicture}
\end{document}
Remarks:
  • In future questions please mark longer passages of code in a body not as in-line code by the button but as block code by the [Code] button. So we don't have to always correct that.[/list]


    Thorsten
pjmiller_57
Posts: 20
Joined: Tue Nov 08, 2011 4:37 pm

Re: Arrow to Text Label on another Arrow

Post by pjmiller_57 »

So simple! Thanks localghost!
Post Reply