[pstricks] SStill trying to optimize my postscript

Denis Girou Denis.Girou at idris.fr
Mon Apr 8 23:43:59 CEST 2002


>>>>> "Remi.Coulom" == Remi Coulom <Remi.Coulom at free.fr> writes:

    Remi.Coulom> I still have some questions, though. First, I noticed that pstricks generates
    Remi.Coulom> coordinates with an accuracy of 0.0001 dots when converting units from
    Remi.Coulom> centimeters. Is there a way I could limit it to an accuracy of, say, 1 dot or
    Remi.Coulom> 0.1 dots?

  You can truncate the decimal part. Here, I keep only the first digit.

  N.B. You must verify that such change in an internal macro used everywhere
has no bad side effect somewhere. I test it only on this example...

\documentclass[a4paper]{article}

\usepackage{multido}
\usepackage{pstricks}

\pagestyle{empty}

\begin{document}

% 1300 KB
% \multido{\i=1+1}{5000}{\psline(1,1)(2,2)}

% 150 KB
% \pscustom{%
%   \moveto(1,1)
%   \multido{\i=1+1}{5000}{%
%     \lineto(2,2)}}

\makeatletter

% D.G. modification begin - Apr.  8, 2002
% \def\lineto{\pst at onecoor{lineto}}%
% D.G. modification end

% 130 KB
% \pscustom{%
%   \def\lineto{\pst at onecoor{L}}%
%   \moveto(1,1)
%   \multido{\i=1+1}{5000}{%
%     \lineto(2,2)}}

% D.G. modification begin - Apr.  8, 2002
% {\catcode`\p=12 \catcode`\t=12 \global\@namedef{pst@@@dimtonum}#1pt{#1}}

{\catcode`\p=12\catcode`\t=12
 \global\@namedef{pst@@@dimtonum}#1pt{\@nameuse{pst@@@@dimtonum}#1..\@nil}}

\def\pst@@@@dimtonum#1.#2.#3\@nil{\pst@@@@@dimtonum#1.#2\@nil}

\def\pst@@@@@dimtonum#1.#2#3\@nil{#1.#2}
% D.G. modification end

% 87 KB
\pscustom{%
  \def\lineto{\pst at onecoor{L}}%
  \moveto(1,1)
  \multido{\i=1+1}{5000}{%
    \lineto(2,2)}}

\makeatother

\end{document}

    Remi.Coulom> Another question I have: is there a pstricks option that allows to select the
    Remi.Coulom> type of line join (setlinejoin, in Postscript). I would like to use bevel join,
    Remi.Coulom> but pstricks seems to be using miter join. I did not manage to find this option
    Remi.Coulom> in the pstricks doc.

  There is not such option accessible by a PSTricks macro or parameter.
You must set it directly in PostScript, as here:

\documentclass[a4paper]{article}

\usepackage{pstricks}

\pagestyle{empty}

\begin{document}

\psset{subgriddiv=0,griddots=5,linewidth=0.3}

\begin{pspicture}(2,2)\psgrid
  \psline(0,0)(1,2)(2,0)
\end{pspicture}
\hfill
\begin{pspicture}(2,2)\psgrid
  \pscustom{%
    \code{1 setlinejoin}
    \psline(0,0)(1,2)(2,0)}
\end{pspicture}
\hfill
\begin{pspicture}(2,2)\psgrid
  \pscustom{%
    \code{2 setlinejoin}
    \psline(0,0)(1,2)(2,0)}
\end{pspicture}

\end{document}


D.G.



More information about the PSTricks mailing list