1

How to draw arcs. How to add the blue arcs in a simple way? enter image description here

Or in a simple line with 3 nodes.

I have problem with the final lines

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[x11names,table]{xcolor}
\usepackage{mathpazo}

\usepackage{tikz} \usetikzlibrary{calc}% to calculate auxilary coordinates \newcommand\tikznode[3][]{% \tikz[remember picture,baseline=(#2.base)] \nodeminimum size=0pt,inner sep=0pt,#1{#3};% }

\tikzstyle{arrow}=[thick,->,>=stealth] \tikzstyle{arrowr}=[red,thick,->,>=stealth] \tikzstyle{arrowg}=[Green4,thick,->,>=stealth] % \usetikzlibrary{shapes,snakes}

\begin{document} \begin{center} \begin{tabular}{ccc} \tikznode{diasupp}{} & \tikznode{cochupp}{} & \tikznode{mecupp}{} \ \tikznode{diasup}{} & \tikznode{cochup}{} & \tikznode{mecup}{} \ \tikznode{dias}{\underline{Días}} & \tikznode{coch}{\underline{Coches}} & \tikznode{mec}{\underline{Mecanicos}} \ %\midrule 2 & 5 & 4 \ 8 & 30 & $x$ \end{tabular} \end{center}

\begin{tikzpicture}[remember picture,overlay,red,thick] \draw [arrowr] (dias) -- (diasupp)--(mecupp)node[midway,sloped,left,rotate=0]{\raisebox{-.0\height}[46pt][50pt]I}--+(mec); \draw [arrowg] (coch) -- (cochup)--(mecup)node[midway,sloped,left,rotate=0]{\raisebox{-.0\height}[48pt][52pt]D}--+(mec);

% The next lines is where the trouble is. %\path[->] (dias) edge [bend left=-20] node[above] {$1$} (coch); %\path[->] (coch) edge [bend left=-20] node[above] {$2$} (mec); %\path[->] (dias) edge [bend left=-36] node[above] {$3$} (mec); \end{tikzpicture}

\end{document}

Mika Ike
  • 3,751

3 Answers3

3
  1. Loading tikz library babel will resolve the problem in using \path[->] ...;
  2. Your \tikznode actually is re-implementing utilities in package tikzmark. In general cases, this package is very useful.
  3. In your case, the tikz \matrix command is particularly helpful.
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[x11names,table]{xcolor}
\usepackage{mathpazo}

\usepackage{tikz} \usetikzlibrary{babel, matrix, arrows.meta}

\tikzstyle{arrow}=[thick,->,>=stealth] \tikzstyle{arrowr}=[red,thick,->,>=stealth] \tikzstyle{arrowg}=[Green4,thick,->,>=stealth]

\begin{document}

\begin{tikzpicture} \matrix (table) [matrix of nodes] { \underline{Días} & \underline{Coches} & \underline{Mecanicos} \ 2 & 5 & 4 \ 8 & 30 & $x$ \ };

\draw[arrowr] (table-1-1.north) -- ++(0,1) -| node[pos=.25, above] {I} (table-1-3); \draw[arrowg] (table-1-2.north) -- ++(0,.3) -| node[pos=.25, above] {D} (table-1-3); \draw[blue,>={Triangle[scale=.8]}] (table-3-1) edge[bend right, ->] (table-3-2) edge[bend right=45, ->] (table-3-3) (table-3-2) edge[bend right, ->] (table-3-3); \end{tikzpicture}

\end{document}

enter image description here

muzimuzhi Z
  • 26,474
  • 2
    Nice. Notice however that there are (still) bugs with spanish babel. The author suggested to use \usepackage[english, spanish, es-noshorthands, shorthands=off]{babel} --- see https://github.com/latex3/babel/issues/38 and https://github.com/latex3/babel/issues/39 (they have been moved, but are still not fixed. Admittedly the second one is difficult to hit, but...) – Rmano Feb 02 '21 at 08:39
  • @Rmano Thanks for pointing out that. I do found using every edge/.style={->} is still buggy hence had to use edge[..., ->] in my answer. – muzimuzhi Z Feb 02 '21 at 18:27
2

Spanish produces an error see here

I fixed it. It should now draw your arrows.

\documentclass[12pt,spanish]{article}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[x11names,table]{xcolor}
\usepackage{mathpazo}

\usepackage{tikz} \usetikzlibrary{babel} \usetikzlibrary{calc}% to calculate auxilary coordinates \newcommand\tikznode[3][]{% \tikz[remember picture,baseline=(#2.base)] \nodeminimum size=0pt,inner sep=0pt,#1{#3};% }

\tikzstyle{arrow}=[thick,->,>=stealth] \tikzstyle{arrowr}=[red,thick,->,>=stealth] \tikzstyle{arrowg}=[Green4,thick,->,>=stealth] % \usetikzlibrary{shapes,snakes}

\begin{document} \begin{center} \begin{tabular}{ccc} \tikznode{diasupp}{} & \tikznode{cochupp}{} & \tikznode{mecupp}{} \ \tikznode{diasup}{} & \tikznode{cochup}{} & \tikznode{mecup}{} \ \tikznode{dias}{\underline{Días}} & \tikznode{coch}{\underline{Coches}} & \tikznode{mec}{\underline{Mecanicos}} \ %\midrule 2 & 5 & 4 \ 8 & 30 & $x$ \end{tabular} \end{center}

\begin{tikzpicture}[remember picture,overlay,red,thick] \draw [arrowr] (dias) -- (diasupp)--(mecupp)node[midway,sloped,left,rotate=0]{\raisebox{-.0\height}[46pt][50pt]I}--+(mec); \draw [arrowg] (coch) -- (cochup)--(mecup)node[midway,sloped,left,rotate=0]{\raisebox{-.0\height}[48pt][52pt]D}--+(mec);

% The next lines is where the trouble is. \path[->] (dias) edge [bend left=-20] node[above] {$1$} (coch); \path[->] (coch) edge [bend left=-20] node[above] {$2$} (mec); \path[->] (dias) edge [bend left=-36] node[above] {$3$} (mec); \end{tikzpicture}

\end{document}

Roland
  • 6,655
1

You may liked:

enter image description here

Above image is based on your code. Produced is by use of the tikzmark and babe library. Latter solve your.

\documentclass[12pt, spanish]{article}
\usepackage{babel}
\usepackage[x11names,table]{xcolor}
\usepackage{mathpazo}

\usepackage{tikz} \usetikzlibrary{arrows.meta, quotes, tikzmark, babel} \tikzset{ arr/.style = {draw=#1, very thick, -Stealth}, arr/.default = blue, every edge/.style = {arr, bend right=30}, every edge quotes/.style = {font=\small, anchor=center, fill=white, inner sep=1pt} }

\begin{document} \begin{center} \setlength\tabcolsep{12pt} \renewcommand\arraystretch{1.5} \begin{tabular}{@{} ccc @{}} \tikzmarknode{A}{\underline{Días}} & \tikzmarknode{B}{\underline{Coches}} & \tikzmarknode{C}{\underline{Mecanicos}} \ 2 & 5 & 4 \ 8 & 30 & $x$ \ \end{tabular}

\begin{tikzpicture}[remember picture,overlay] \draw[arr=red] (A) -- ++(0,1.2) -| node[pos=.25, above] {I} (C.60); \draw[arr=green] (B) -- ++(0,0.6) -| node[pos=.25, above] {D} (C.120); \draw (A) edge["1"] (B) (B) edge["2"] (C) (A) edge[bend right=45, "3"] (C); \end{tikzpicture} \end{center} \end{document}

However, In question you show images of desired result, where blue arrows connect numbers in the last row of tables. It can be produced by:

\documentclass[12pt, spanish]{article}
\usepackage{babel}
\usepackage[x11names,table]{xcolor}
\usepackage{mathpazo}

\usepackage{tikz} \usetikzlibrary{arrows.meta, quotes, tikzmark, babel} \tikzset{ arr/.style = {draw=#1, very thick, -Stealth}, arr/.default = blue, every edge/.style = {arr, bend right=30}, every edge quotes/.style = {font=\small, anchor=center, fill=white, inner sep=1pt} }

\begin{document} \begin{center} \setlength\tabcolsep{12pt} \begin{tabular}{@{} ccc @{}} \tikzmarknode{A}{\underline{Días}} & \tikzmarknode{B}{\underline{Coches}} & \tikzmarknode{C}{\underline{Mecanicos}} \ 2 & 5 & 4 \ \tikzmarknode{D}{8}
& \tikzmarknode{E}{30} & \tikzmarknode{F}{$x$} \ \end{tabular}

\begin{tikzpicture}[remember picture,overlay] \draw[arr=red] (A) -- ++(0,1.2) -| node[pos=.25, above] {I} (C.60); \draw[arr=green] (B) -- ++(0,0.6) -| node[pos=.25, above] {D} (C.120); \draw (D) edge["1"] (E) (E) edge["2"] (F) (D) edge[bend right=45, "3"] (F); \end{tikzpicture} \end{center} \end{document}

which produce:

enter image description here

Zarko
  • 296,517