1 minute read

I was looking for a code that has a visualization of equation parameter description like the following.

Then I found this awesome collection of Tikz Examples and I just modified a little from their code.

First, we need the following packages:


Now, here’s the code that produces this output. You can also check out the output in this overleaf project.

\newcommand{\tm}[1]{\tikz[overlay, anchor=base] \node[red] (#1) {};}
\tikzstyle{every picture}+=[remember picture]

  every path/.style={->, color=green!70!white, thin, rounded corners},
  every node/.style={color=black},
  bx/.style={text width=3cm, font=\footnotesize, minimum height=4ex},
  bxl/.append style={bx, left, align=flush right},
  bxr/.append style={bx, right, align=flush left}]

  \node {
    $\tm{y}y =

  \node[bx, align=center] (preds) at (0.4,1.5)
  {Independent Variables};
  \node[bx, align=center] (tx) at (0.4,-1.5) {Coefficients};

  \path[draw] (y)+(0.5ex,2ex) to[out=90, in=0] +(-\vd,\hd)
  node[bxl] {Dependent variable};
  \path[draw] (x1)+(0.5ex,2ex) to[out=90, in=-90] (preds);
  \path[draw] (x2)+(0.5ex,2ex) to[out=90, in=-90] (preds);
  \path[draw] (xk)+(0.5ex,2ex) to[out=90, in=-90] (preds);
  \path[draw] (b1)+(1ex,-1ex) to[out=-90, in=90] (tx);
  \path[draw] (b2)+(1ex,-1ex) to[out=-90, in=90] (tx);
  \path[draw] (bk)+(1ex,-1ex) to[out=-90, in=90] (tx);
  \path[draw] (b0)+(1ex,-1ex) to[out=-90, in=0] +(-\vd,-\hd)
  node[bxl] {Intercept};
  \path[draw] (er)+(0.5ex,-1ex) to[out=-90, in=180] +(\vd,-\hd)
  node[bxr] {Random Error};


You can find a comprehensive list of Latex resources in the following post:

Latex Resources in a Nutshell

If you are a new Latex user, check out this post: 20 Most Common Mistakes Made by New Latex Users

You can find all Latex oriented posts of mine in: https://shantoroy.com/categories/#latex

Leave a comment