4

TEXstudio is the only MAC software (although not originally designed for MAC) that has a PDF viewer that renders perfectly well dashed and hatched lines drawn with tikz. What does TEXstudio do that all the other softwares (TEXshop, TEXnicle, Preview, Acrobat Reader) don't do ? Does TEXstudio bring with it the perfect PDF encoding ? Is tikz sending ambiguous PDF instructions ?

    \documentclass[]{article}
    \usepackage{tikz}
    \usetikzlibrary{patterns}
    \usepackage[most]{tcolorbox}

    % code taken from Arberto Sartori:  http://www.albertosartori.it/latexother.php
    \makeatletter
    \pgfdeclarepatternformonly[\LineSpace,\LineWidth]{my north east lines}
        {\pgfqpoint{-\LineWidth}{-\LineWidth}}{\pgfqpoint{\LineSpace}{\LineSpace}}
        {\pgfqpoint{\LineSpace}{\LineSpace}}%
        {
            \pgfsetcolor{\tikz@pattern@color}
            \pgfsetlinewidth{\LineWidth}
            \pgfpathmoveto{\pgfqpoint{-\LineWidth}{-\LineWidth}}
            \pgfpathlineto{\pgfqpoint{\LineSpace + 0.1pt}{\LineSpace + 0.1pt}}
            \pgfusepath{stroke}
        }
    \makeatother

    \newdimen\LineSpace
    \newdimen\PointSize
    \newdimen\LineWidth
    \tikzset{
        line space/.code={\LineSpace=#1},
        line space=3pt
    }
    \tikzset{
        point size/.code={\PointSize=#1},
        point size=.5pt
    }
    \tikzset{
        pattern line width/.code={\LineWidth=#1},
        pattern line width=.4pt
    }


    \tcbset{dash/.style={%
    enhanced,%
    frame style={pattern=my north east lines,pattern color=blue!80!white,
    line space=9pt,pattern line width=3pt,dashed},%
    leftrule=5mm,rightrule=5mm,toprule=5mm,bottomrule=0.3mm}} %

    \tcbset{hatch/.style={%
    enhanced,%
    frame style={pattern=my north east lines,pattern color=red!80!white,
    line space=9pt,pattern line width=3pt},%
    leftrule=5mm,rightrule=5mm,toprule=5mm,bottomrule=0.3mm}} %

    \begin{document}


    \begin{tcolorbox}[dash]
    North east DASHED lines
    \end{tcolorbox}


    \begin{tcolorbox}[hatch]
    North east HATCHED lines
    \end{tcolorbox}


    \end{document}

Perfect PDF result viewed (zoom-independent) in TEXStudio: enter image description here

TEXshop / failure dash + hatch: enter image description here3

TEXshop / zoom on / failure dash, but OK hatch: enter image description here

TEXnicle / failure dash + hatch: enter image description here

TEXnicle / zoom-on / failure dash + hatch: enter image description here

Preview (OS 10.10) / same result as TEXnicle / failure dash + hatch: enter image description here

Preview (OS 10.10) / zoom on / same result as TEXnicle / failure dash + hatch: enter image description here

Acrobat Reader 11.0.09/ failure dash, but hatch OK enter image description here

Acrobat Reader 11.0.09 / zoom on / failure dash, but hatch OK enter image description here

9
  • 2
    Looks perfect with evince, I mean identical to TEXstudio.
    – Tarass
    Commented Nov 17, 2014 at 6:44
  • If you change the order hatch before dash all is red. Looks like in TeXStudio with TeXworks viewer. Doesn't work with SumatraPDF and PDFX-change viewer.
    – Ignasi
    Commented Nov 17, 2014 at 7:39
  • Acrobat should be fine from your screenshot. Play with the zoom level.
    – percusse
    Commented Nov 17, 2014 at 8:33
  • Sorry:"red" and "blue" were another issue, not the main one for that question / I updated my screen shots and question accordingly.
    – SDrolet
    Commented Nov 17, 2014 at 16:03
  • 1
    I don't have any problems with sumatra and Acroread with regular patterns. It has been always an issue with other viewers that is asked elsewhere on this site. I'll take a look
    – percusse
    Commented Nov 18, 2014 at 22:13

1 Answer 1

2

The rendering is performed by the PDF rendering engine/library used by the program. For example:

  • TeXstudio uses poppler.
  • SumatraPDF uses MuPDF.
  • Adobe uses its own proprietary engine.
  • OSX has its own PDF engine (not an expert here but I assume Preview uses the builtin PDF capabilities of Quartz)

I don't know the details of the PDF specification here. Either it's ambigous or not all engines implement it strictly. Either way, the different engines interpret your example differently.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .