4

i try to define arrow's head size by using ˙\pgflinewidth`:

\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, calc}

\begin{document}
    \begin{tikzpicture}
\draw (0cm,0cm) grid ($(2cm,3cm)-(\pgflinewidth,\pgflinewidth)$);       % this works

\draw[very thick, -{Triangle[length=3\pgflinewidth]}] (0,0) -- (2,3);   % this doesn't work!
    \end{tikzpicture}
\end{document}

error: ! Missing \endcsname inserted..

what is wrong in my attempt?

3

Try:

Triangle[length=3*\the\pgflinewidth]

MWE

\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, calc}
\begin{document}
    \begin{tikzpicture}
\draw (0cm,0cm) grid ($(2cm,3cm)-(\pgflinewidth,\pgflinewidth)$);       % this works

\draw[very thick, -{Triangle[length=3*\the\pgflinewidth]}] (0,0) -- (2,3);   % this doesn't work!
    \end{tikzpicture}
\end{document}

enter image description here

EDIT

The same output can be obtained with the following line also:

\draw[very thick, -{Triangle[length=0pt 3]}] (0,0) -- (2,3); 
  • May be a bit of an explanation would add great value to this answer! – Raaja Dec 5 '18 at 9:37
  • 2
    this solution not cause error, however, arrows head is far to big (about 8 times). this means that it not consider width of used rule. – Zarko Dec 5 '18 at 9:40
  • @Zarko I don't know why it is like that. But replacing 3\the\pgflinewidth with 3*\the\pgflinewidth seems to solve the problem. – nidhin Dec 5 '18 at 9:51
  • @nidhin, thank you very much. now works correctly.. – Zarko Dec 5 '18 at 13:20
  • @Zarko You can actually use Triangle[length=0pt 3] to get the desired output. – nidhin Dec 5 '18 at 13:26

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.