For this figure, I am using Word and Mathtype to draw but the output is not so nice. How can I draw in in LaTeX? I am just new to package TikZ but I guess that it's power can help me here?enter image description here

  • 1
    Do you really want the frames around the formulæ?
    – Bernard
    Jan 12, 2022 at 21:08
  • 1
    Why is there A,B,C near X,Y,Z ? a start for you \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture} \path (0,0) node[draw] (A) {A} (3,2) node[draw] (B) {B} ; \draw[cyan,->] (A)--(B) node[midway,sloped,above]{$\lambda_1=1.111$} ; \end{tikzpicture} \end{document}
    – Black Mild
    Jan 12, 2022 at 21:13
  • @Bernard. It might be better if I have box but not really necessary.
    – TrungDung
    Jan 12, 2022 at 21:19
  • @BlackMild: Thank you. Based on your code, I will work on to build up the figure. I will post the final code later here.
    – TrungDung
    Jan 12, 2022 at 21:20

3 Answers 3


An attempt to do it quick and simple:


\tikzset{mybox/.style={draw},myarrow/.style={blue,->},myformula/.style={midway,sloped,draw,black,outer sep=4pt}}
\node[mybox](Z) at (0,0) {Z};
\node[mybox](X) at (4,2) {X};
\node[mybox](Y) at (4,-2) {Y};

\node[anchor=east] at (Z.west) {B};
\node[anchor=west] at (X.east) {A};
\node[anchor=west] at (Y.east) {C};

\draw[myarrow] (Z) -- (X) node[myformula,above]{$\lambda_1=-1.115$};
\draw[myarrow] (X) -- (Y) node[myformula,above]{$\lambda_2=-8.273$};
\draw[myarrow] (Z) -- (Y) node[myformula,below]{$\lambda_3=13.232$};

enter image description here


This is very easy to obtain from a simple tabular environment and pstricks:



{\renewcommand{\arraystretch}{4}\centering \begin{tabular}{c!{\qquad}c!{\qquad}c}
                & & \psDefBoxNodes{X}{\fbox{X}}\enspace A\\
              B\qquad \psDefBoxNodes{Z}{\fbox{Z}}& & \\
               & & \psDefBoxNodes{Y}{\fbox{Y}}\enspace C
\psset{arrowinset = 0, arrows =->, linecolor=LightBlue, nodesep=3pt, nrot=:U}


enter image description here

  • How long do you use pstricks? Jan 13, 2022 at 3:10
  • @minhthien_2016: I'm not sure I understand what you mean exactly – since when I use pstricks?
    – Bernard
    Jan 13, 2022 at 9:12

With use of libraries arrows.meta and quotes:

\documentclass[border=3.141592, tikz]{standalone}

every edge quotes/.style = {auto, draw=black, thin,
                            inner sep=2pt, outer sep=2pt, sloped},
\scoped[nodes={draw, outer sep=2pt}]%
\node[label=left:B] (Z) at (0, 0) {Z};
\node[label=right:A](X) at (4, 2) {X};
\node[label=right:C](Y) at (4,-2) {Y};
\path[draw=cyan, thick, -Straight Barb] 
    (Z) edge["$\lambda_1=-1.115$"]  (X)
    (X) edge["$\lambda_2=-8.273$"]  (Y)
    (Z) edge["$\lambda_3=13.232$" '](Y);

enter image description here

  • I like how much different flavors one can have with TikZ, thanks for this solution!
    – TobiBS
    Jan 13, 2022 at 9:11

You must log in to answer this question.

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