3

Consider the following diagram:

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{shapes.arrows, positioning}
\tikzset{->,>=stealth}

\begin{document}

\begin{tikzpicture}
        \node (A) at (1, 0) {$A$};
        \node (P) at (4, -4) {$P$};
        \node (C) at (9, -2) {$C$};
        \node (Z) at (9, 2) {$Z$};
        \node (D) at (4, 4) {$D$};
        \node (D') at (-2, 4) {$D'$};
        \node (PL) at (-2, -4) {$PL$};
        \node (L) at (-7, -2) {$L$};
        \node (L') at (-7,2 ) {$L'$};
        \draw (A) to (P);
        \draw[densely dotted] (L) to node[above,rotate= 13,black]{\scriptsize Some text here}(A);
        \draw (P) to node[below,rotate= 21,black]{\scriptsize Longer comment.}(C);
        \draw (C) to node[above,rotate= -90,black]{\scriptsize Short comment.}(Z);
        \draw[bend left =15, densely dotted] (PL) to node[ above right=of D,rotate=45,black]{\scriptsize A useful remark here.}(D);
        \draw (D) to (Z);
        \draw (A) to (D);
            \draw[densely dotted] (A) to node[above,rotate= -13,black]{\scriptsize Some more text.}
(C);
        \draw[bend right =15, densely dotted] (D') to node[below right=of A,rotate=-45,black]{\scriptsize More text here, too}(P);
        \draw (PL) to node[below,rotate=52,black]{\scriptsize Text here,too.}(A);
        \draw (L) to node[below,rotate= -21,black]{\scriptsize Some more text.} (PL);
        \draw (D') to (A);
        \draw (L') to (D');
        \draw (L') to node[above,rotate= 90,black]{\scriptsize The last bit of text}(L);
\end{tikzpicture}

\end{document}

Which renders as

enter image description here

I am perfectly happy with the non-curved arrows, but it would be nice if the text curved with the arrows, and could be put in the last third of the arrow. What's the way to do this?

  • (Note: the non-curved has a nice space with respect to the arrows, but thee curved doesn't!) – Pedro Tamaroff Jul 30 at 11:55
  • I have this error: Package PGF Math Error: Unknown function of (in 'of D'). [...ack]{\scriptsize A useful remark here.}(D)]. – Sebastiano Jul 30 at 12:02
  • 1
    @Sebastiano tikz library positioning is required. I've edit the question to make the code snippet a complete example. – muzimuzhi Z Jul 30 at 12:11
  • @muzimuzhiZ Thank you very much. I suggest to use \usetikzlibrary{decorations.text} with the option text along path,text align=center and the option raise=<..>ex, with a number into <...> to give more blank space. – Sebastiano Jul 30 at 12:14
  • 1
    @Sebastiano Looks like one just needs to use |\scriptsize|, though this doesn't work for citations... – Pedro Tamaroff Jul 30 at 16:55
4

I commented the lines of your code without deleting them and just underneath, I put the new code. If you need an explanation, just say so, I'll explain more fully.

screenshot

\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\usetikzlibrary{shapes.arrows, positioning}
\usetikzlibrary{decorations.text}
\tikzset{->,>=stealth}

\begin{document}

\begin{tikzpicture}
        \node (A) at (1, 0) {$A$};
        \node (P) at (4, -4) {$P$};
        \node (C) at (9, -2) {$C$};
        \node (Z) at (9, 2) {$Z$};
        \node (D) at (4, 4) {$D$};
        \node (D') at (-2, 4) {$D'$};
        \node (PL) at (-2, -4) {$PL$};
        \node (L) at (-7, -2) {$L$};
        \node (L') at (-7,2 ) {$L'$};
        \draw (A) to (P);
        \draw[densely dotted] (L) to node[above,rotate= 13,black]{\scriptsize Some text here}(A);
        \draw (P) to node[below,rotate= 21,black]{\scriptsize Longer comment.}(C);
        \draw (C) to node[above,rotate= -90,black]{\scriptsize Short comment.}(Z);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- old path ------------------------------------------------------
%        \draw[bend left =15, densely dotted] (PL) to node[ above right=of D,rotate=45,black]{\scriptsize A useful remark here.}(D);
% ---- new path decorated with the text «A useful remark here» --------
        \draw [bend left =15, densely dotted,-latex, postaction={decorate,decoration={raise=3pt,text along path,text align={right,right indent=8mm},text={|\scriptsize|A useful remark here}}}] (PL) to  (D);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \draw (D) to (Z);
        \draw (A) to (D);
            \draw[densely dotted] (A) to node[above,rotate= -13,black]{\scriptsize Some more text.}
(C);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- old path -------------------------------------------------------
%        \draw[blue,bend right =15, densely dotted] (D') to node[below right=of A,rotate=-45,black]{\scriptsize More text here, too}(P);
% ---- new path decorated with the text «More text here, too» ----------
        \draw [bend right =15, densely dotted,-latex, postaction={decorate,decoration={raise=3pt,text along path,text align={right,right indent=10mm},text={|\scriptsize|More text here, too}}}] (D') to  (P);  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      
        \draw (PL) to node[below,rotate=52,black]{\scriptsize Text here,too.}(A);

        \draw (L) to node[below,rotate= -21,black]{\scriptsize Some more text.} (PL);
        \draw (D') to (A);
        \draw (L') to (D');
        \draw (L') to node[above,rotate= 90,black]{\scriptsize The last bit of text}(L);
\end{tikzpicture}

\end{document}
| improve this answer | |
3

This is only a partial answer with the text curved with the arrows because I'm not able to put the \cite{} environments:

\documentclass{article}
\usepackage{tikz}
\usepackage[margin=2cm]{geometry}
\usetikzlibrary{shapes.arrows, positioning}
\usetikzlibrary{decorations.text}
\tikzset{->,>=stealth}

\begin{document}

\begin{tikzpicture}
        \node (A) at (1, 0) {$A$};
        \node (P) at (4, -4) {$P$};
        \node (C) at (9, -2) {$C$};
        \node (Z) at (9, 2) {$Z$};
        \node (D) at (4, 4) {$D$};
        \node (D') at (-2, 4) {$D'$};
        \node (PL) at (-2, -4) {$PL$};
        \node (L) at (-7, -2) {$L$};
        \node (L') at (-7,2 ) {$L'$};
        \draw (A) to (P);
        \draw[densely dotted] (L) to node[above,rotate= 13,black]{\scriptsize Some text here}(A);
        \draw (P) to node[below,rotate= 21,black]{\scriptsize Longer comment.}(C);
        \draw (C) to node[above,rotate= -90,black]{\scriptsize Short comment.}(Z);
        \draw [densely dotted,postaction={decorate,decoration={raise=1ex,text along path,text align=center,text={|\scriptsize|A useful remark here.}}}] (PL) to [bend left=45] (D);
        \draw (D) to (Z);
        \draw (A) to (D);
            \draw[densely dotted] (A) to node[above,rotate= -13,black]{\scriptsize Some more text.}
(C);
\draw [densely dotted,postaction={decorate,decoration={raise=1ex,text along path,text align=center,text={|\scriptsize|More text here, too.}}}] (D') to [bend left=345] (P);
        \draw (PL) to node[below,rotate=52,black]{\scriptsize Text here,too.}(A);
        \draw (L) to node[below,rotate= -21,black]{\scriptsize Some more text.} (PL);
        \draw (D') to (A);
        \draw (L') to (D');
        \draw (L') to node[above,rotate= 90,black]{\scriptsize The last bit of text}(L);
\end{tikzpicture}

\end{document}

enter image description here

| improve this answer | |

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.