Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Because PSTricks does not provide us with dotted and x-like fill styles, I must create my own custom fill style using pst-fill package.

However, the rendering is too slow and sometimes out of memory.

enter image description here

\documentclass[cmyk]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{amsmath}
\usepackage{pstricks,pst-fill}

\psboxfill{%
\psset{unit=1pt}
\begin{pspicture}(3.6,3.6)
\psdot(1.8,1.8)
\end{pspicture}%
}

\begin{document}


\begin{figure}[hbtp]
\centering
\begin{pspicture}[showgrid=false](-2,-2)(2,2)
\pscircle[
    fillstyle=solid,
    opacity=0.25,
    fillcolor=gray,
    fillsep=0.4,
    addfillstyle=boxfill]
    (0,0){2}
\pscircle[
    linecolor=red,
    linestyle=dashed,
    linewidth=2pt]
    (0,0){1}
\end{pspicture}
\caption{The magnetic field $\vec{B}$ is directed perpendicularly out of the page.}
\end{figure}

\end{document}

How to speed up rendering a PSTricks object with a custom fill?

share|improve this question

2 Answers 2

up vote 3 down vote accepted
\psboxfill{%
  \psset{unit=1pt}
  \begin{pspicture}(3.6,3.6)
  \qdisk(1.8,1.8){1.8}
  \end{pspicture}%
}
share|improve this answer

I know the reason why using \psdot runs slowly. When I highlighted the PDF output, there are unnecessary hidden objects as follows. It might be a feature of \psdot.

enter image description here


Thus, to speed up, use \pscircle* instead of \psdot as follows, and the hidden objects disappear.

\documentclass[cmyk]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{amsmath}
\usepackage{pstricks,pst-fill}

\psboxfill{%
\psset{unit=1pt}
\begin{pspicture}(3.6,3.6)
%\psdot(1.8,1.8)
\pscircle*(1.8,1.8){1.8}
\end{pspicture}%
}

\begin{document}


\begin{figure}[hbtp]
\centering
\begin{pspicture}[showgrid=false](-2,-2)(2,2)
\pscircle[
    fillstyle=solid,
    opacity=0.25,
    fillcolor=gray,
    fillsep=0.4,
    addfillstyle=boxfill]
    (0,0){2}
\pscircle[
    linecolor=red,
    linestyle=dashed,
    linewidth=2pt]
    (0,0){1}
\end{pspicture}
\caption{The magnetic field $\vec{B}$ is directed perpendicularly out of the page.}
\end{figure}

\end{document}

Another drawback when using \psdot is: \psdot uses T3Font_0 as follows

enter image description here

This font cannot be embedded to the PDF output, even though you use ps2pdf -dPDFSETTINGS#/prepress input.ps.

share|improve this answer
    
This font is actually embedded in this case. Adobe reader has a strange way of dealing with type 3 fonts. –  Lev Bishop Jul 9 '11 at 15:09
    
@Lev: I think the font is not embedded since pdfcrop also cannot produce correct BB. –  xport Jul 9 '11 at 15:14
    
The font is embedded. I did check before writing. You can check yourself with multivalent, pdffonts or acrobat professional preflight tool (and probably many other tools). Also, pdfcrop produces the correct bbox for me. –  Lev Bishop Jul 9 '11 at 22:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.