3

I've got a strange problem (at least for me it is strange). I've put a lot of work in a Tikz-picture and finally it was finished and I was happy with the result my TeXstudio showed me in the preview. But when I opened it in Acrobat Reader there was a little but annoying difference: The dash pattern I used for my \fill command was just ignored. Instead the PDF just showed me horizontal lines.

My first question is: Do you have any idea where this difference comes from?

But my real question is: What can I do to make the dashed pattern appear in the pdf?

I already tried changing my standard-compiler from PdfLaTeX to LaTeX, but that didn't change anything. Below is my picture in a standalone.

Thanks in advance for your input.

Update: I imported the PDF with Gimp and suddenly the picture appeared with dashed lines. Maybe that's only a problem with the Adobe Reader?

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{patterns}

\begin{document}

\begin{tikzpicture}

\fill[pattern=horizontal lines, dash pattern=on 2pt off 2pt on 3pt off 2pt on 1pt off 2pt] (0.8,0) arc (-75:210:3.18) arc (30:-30:3) arc (150:435:3.18) -- cycle;
\draw[] (0.8,0) arc (-75:210:3.18) arc (30:-30:3) arc (150:435:3.18) -- cycle;
\draw[fill=white] (0,3.1) circle (3) node {+};
\draw[fill=white] (0,-3.1) circle (3) node {+};

\end{tikzpicture}

\end{document}

Picture with a filling of definitely-not-dashed lines

  • I can reproduce the issue with Adobe Reader, however it works fine with Evince, xpdf, Okular. – Marijn Jan 22 '18 at 14:55
  • 1
    you haven't dashed the pattern you basically defined a dash pattern and then filled with horizontal solid lines. Whatever you are seeing as dashed is the wrong behavior. – percusse Jan 22 '18 at 15:31
2

Thanks to percusse, who got me the right hint.

When I do something like:

\pgfdeclarepatternformonly[4pt]{MyHorizLines}{\pgfqpoint{-4pt}{-4pt}}{\pgfqpoint{12pt}{12pt}}{\pgfqpoint{4pt}{4pt}}%
{
\pgfsetcolor{\tikz@pattern@color}
\pgfsetlinewidth{0.3pt}
%\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
%\pgfpathlineto{\pgfqpoint{0pt}{\GridSize}}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{2.1pt}{0pt}}
\pgfusepath{stroke}

}

and use it as pattern:

\fill[pattern=MyHorizLines]

adobe shows me the dashed lines too.

Many thanks!

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.