2

I've been Googling for ages and can't find this answer. The only thing that even gets close to asking what I'm wanting is this question but I don't quite get the answer. How in the world does \pgfarrowsdeclarecombine work?

Anyway, I want to make an arrow in a TikZ picture that looks like +---->. Like a normal arrow, but with a plus sign at the beginning.

  • do you want an arrow head as a plus sign? or combine it with something? – percusse Nov 22 '16 at 9:50
  • A line can have an arrow head in either end like this e.g.: <----->. Combining arrowheads looks e.g ----->o>. It does not seem like you want to combine anything. Do not use google - read the manual. – hpekristiansen Nov 22 '16 at 10:30
5

Here is a very simple solution that scales with line width:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\tikzset{+ /.tip = {Bar[sep=1.5pt 2,width=3pt 4]_[sep=0]}}

\begin{document}

\tikz\draw[+->] (0,0) -- (1,0);

\tikz[very thin]\draw[+->] (0,0) -- (1,0);

\tikz[very thick]\draw[+->] (0,0) -- (1,0);

\end{document}

Result

| improve this answer | |
2

Here's a "new-style" arrows.meta version...

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[+/.tip = {%
  .
  _[sep=2pt 2]% Comment out this line for no gap between the line and the +
  Bar[sep=-1.5pt -2, length=0pt 1, width=3pt 3]
  Bar[sep=0pt 0, length=3pt 3,width=0pt 1]
}]
\foreach \i in {1,...,10}
  \draw [line width=\i/10, +-Stealth] (0,\i/2) -- +(1,0);
\end{tikzpicture}
\end{document}

enter image description here

...and an "old-style" arrows version (the old way is deprecated and less flexible than the new arrows.meta stuff - but still work and are a bit simpler to create):

\documentclass[tikz,border=5]{standalone}
\makeatletter
\pgfarrowsdeclare{plus}{plus}
{
  \pgfutil@tempdima=1pt%
  \advance\pgfutil@tempdima by1.25\pgflinewidth
  \pgfarrowsleftextend{+0pt}
  \pgfarrowsrightextend{+3\pgfutil@tempdima}
}
{
  \pgfutil@tempdima=1pt%
  \advance\pgfutil@tempdima by1.25\pgflinewidth%
  \pgfsetdash{}{+0pt}
  \pgfsetmiterjoin
  \pgfsetbuttcap
  \pgfpathmoveto{\pgfqpoint{2.0\pgfutil@tempdima}{-1\pgfutil@tempdima}}
  \pgfpathlineto{\pgfqpoint{2.0\pgfutil@tempdima}{\pgfutil@tempdima}}
  \pgfpathmoveto{\pgfqpoint{1.0\pgfutil@tempdima}{0pt}}
  \pgfpathlineto{\pgfqpoint{3.0\pgfutil@tempdima}{0pt}}
  \pgfusepathqstroke
}
\pgfdeclarearrow{name=+-+, means=plus}
\begin{document}
\begin{tikzpicture}[]
\foreach \i in {1,...,10}
  \draw [line width=\i/10, +-stealth] (0, \i/2)  -- +(1,0);
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
1

With TikZ:

   \documentclass[border=1cm]{standalone}
    \usepackage{tikz}
    \usepackage{graphicx}
    \begin{document}
    \begin{tikzpicture}[]
    \draw[-latex] (0,0) node {+} --++(4,0);
    \end{tikzpicture}
    \begin{tikzpicture}
    \draw[-latex] (0,0) node {\rotatebox{30}{+}} --++(30:4);
      \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.