Consider the following MWE:
\documentclass[tikz]{standalone}
\usepackage{xcolor}
\usetikzlibrary{calc,positioning,arrows.meta,quotes}
\begin{document}
\begin{tikzpicture}
\node[rectangle, draw=black, inner sep=.4cm](nCrystal) at (0,0) {Crys};
\coordinate(pO) at ($(nCrystal.west)-(4,0)$);
\coordinate(sO) at ($(nCrystal.west)-(2,1)$);
\coordinate(pE) at ($(nCrystal.east)+(4,0)$);
\coordinate(sE) at ($(nCrystal.east)+(2,1)$);
\coordinate(iE) at ($(nCrystal.east)+(1.5,-0.92815)$);
\coordinate[right=of nCrystal](cright);
\draw [-{Latex[width=4mm]},tips=proper,color=green,line width=2mm] (pO) edge["p"] (nCrystal.west);
\draw [-{Latex},tips=proper,color=red, line width=.2mm] (sO) edge["s"] (nCrystal.west);
\draw [-{Latex[]},tips=proper,color=green,line width=.5mm] (nCrystal.east) edge["p"] (pE);
\draw [-{Latex[width=3mm]},tips=proper,color=red,line width=1.7mm] (nCrystal.east) edge["s"] (sE);
\draw [-{Latex[width=3mm]},tips=proper,color=pink,line width=1.5mm] (nCrystal.east) edge["i"] (iE);
\end{tikzpicture}
\end{document}
I have the following questions:
-
How can I get the first arrow (fat green, labeled "p") to end at the box (just like the red arrow does)
-
Why is the fourth (fat red) arrow tip looking so badly?
-
Is here actually a possibility to let the arrow tip scale automatically with the line width but with a smaller factor than the standard (same arrow head for thin lines but for larger lines the default is too thick for me)
I know that asking multiple questions is problematic but they seem to be connected to each other (definitely the latter two are!). Any help is appreciated!
Best Answer
This is an interesting question. I could not understand properly how the keys
length
andwidth
work but I noticed that using the optionangle=<angle>:<dimension><line width factor>
you may obtain the result you want and it also answers all of your questions.I copy the definition of the above's option from the TikZ documentation:
I've assigned the valued
angle=45:5pt 2
to all the arrows based on your question 3 (i.e. scaling according to the line width, in this case by a factor "2", by default it is 4.5). You can adjust those values as you wish:Just a quick note,
tikz
loadsxcolor
automatically so no need to add\usepackage{xcolor}
in the preamble.