2

is it possible to use the command draw to generate a sequence of + symbols in line?

The output should be the same of a dotted line where the dots are replaced with + symbols (i.e. + + + + + + + + + +). I tried to use it as a marker but did not work.

Thanks

4

I adapted the example in the tikz manual (48.5: Arbitrary Markings):

\documentclass{article}

\usepackage{polyglossia}
\setdefaultlanguage{english}

\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}
    \begin{tikzpicture}[decoration = {
            markings,
            mark = 
                between positions 0 and 1 step 5mm % adjust step size here
                with
                {
                    % adjust size of plus signs here
                    \draw (0pt, 2pt) -- (0pt, -2pt);
                    \draw (-2pt, 0pt) -- (2pt, 0pt);
                }
            }
        ]
        \path[decorate] (0, 0) -- (2, 0);
    \end{tikzpicture}
\end{document}

With this, you get

enter image description here

You can adjust the step to get closer or more widely spaced plus signs.

As pointed out in the comments, the two drawing commands can be replaced by a simple \node{+};, which could be simpler.

  • Many thanks, I will employ this solution (y) – Fabio Caraffini Jan 25 '17 at 10:21
  • You can replace the code of yourwith by a simple with {\node{+};} – JLDiaz Jan 25 '17 at 10:25
  • @JLDiaz you are right, thanks for the hint. – pschulz Jan 25 '17 at 10:42

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.