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.

This question is similar to Error in the PSTricks package pst-poly?.

Consider the following example:

\documentclass{article}

\usepackage{pst-grad,pstricks-add}

\newcommand*\PolyLine{%
  \psarc(C){\RelRadiusB}{!90 \vinkelA add}{180}
  \psline(B)(A)(D)
  \psarc(C){\RelRadiusB}{0}{!90 \vinkelA sub}}


\begin{document}

\begin{figure}
\def\radius{21.65}
\def\vinkelA{12 }
\def\vinkelB{71 }
\pstFPdiv\faktor{1}{3}
\pstFPmul\RelFaktor{2}{\faktor}
\pstFPmul\rammeA{\radius}{\faktor}
\pstFPadd\rammeB{\rammeA}{2.95}
\makeatletter
  \pst@getsinandcos{\vinkelA}
  \pstFPmul\RelRadiusB\faktor{\radius}
  \pstFPmul\MaxLW\RelRadiusB\pst@sin
  \pstFPmul\MaxLW{2}{\MaxLW}
 \psset{unit = 0.5}
  \begin{pspicture}(-\rammeA,-\rammeA)(\rammeA,\rammeB)
    \pst@getsinandcos{\vinkelB}
      \ifnum \vinkelB = 90
       \let \RelLW\MaxLW
      \else
      \ifnum \vinkelB > 90
        \pstFPmul\RelLW{\MaxLW}{\pst@cos}
      \else
        \pstFPmul\RelLW{\MaxLW}{\pst@sin}
      \fi
    \fi
    \pnodes%
      (-\RelRadiusB,-\RelRadiusB){A}%
      (-\RelRadiusB,0){B}%
      (0,0){C}%
      (\RelRadiusB,-\RelRadiusB){D}%
      (!0 \RelRadiusB\space \vinkelA cos mul){T1}
    \pscustom[
      linewidth = 2pt,
      linecolor = red,
      fillstyle = gradient,
      gradbegin = blue!5,
      gradmidpoint = 1,
      gradend = blue!35
    ]{\PolyLine}
    \begin{psclip}{%
      \pscustom[linestyle = none]{
        \PolyLine
        \psline(\RelRadiusB,\RelRadiusB)(!\RelRadiusB\space dup 3 add)%
               (!\RelRadiusB\space dup neg exch 3 add)(-\RelRadiusB,\RelRadiusB)}}
      \rput(!0 \RelRadiusB\space \vinkelA cos mul){%
        \pcline[linecolor = yellow, linewidth = \RelLW, nodesep = -\radius]%
          (0,0)(!\vinkelB dup 90 ne {-1 exch neg Tan neg} {0 -1} ifelse)}
    \end{psclip}
    \pscustom[linewidth = 2pt, linecolor = black!70]{\PolyLine}
    \psline[linestyle = dotted]({-\RelRadiusB,0}|T1)({\RelRadiusB,0}|T1)
    \rput(!\RelRadiusB\space 90 \vinkelA sub PtoC){%
      \pswedge(0,0){1}{!180 \vinkelB sub}{180}
      \uput{1}[!180 \vinkelB 2 div sub](0,0){\footnotesize $\vinkelB^{\ensuremath{\circ}}$}
      \psline[linestyle = dotted](0,0)(!3 180 \vinkelB sub PtoC)}
  \end{pspicture}
\end{figure}

\end{document}

output

As can be seen, the sunbeam doesn't go perfectly through hole in the roof, as it has in the past, but it's shifted slightly to the right. Is this also do to a trailing space?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

use:

\pscustom[
  linewidth = 2pt,
  linecolor = red,
  fillstyle = gradient,
  gradbegin = blue!5,
  gradmidpoint = 1,
  gradend = blue!35
]{\PolyLine}%  <<=======

\pscustom has no \ignorespaces at the end and together with the following \psclip, which has no \pst@killglue at the beginning, the above space is not "eaten" by PSTricks.

share|improve this answer

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.