3

Consider the following.

Code

% pdflatex -shell-escape test.tex

\documentclass{article}

\usepackage{
  auto-pst-pdf,
  pst-eucl,
  pstricks-add
}
\usepackage{siunitx}

\begin{document}

\begin{figure}
\def\radius{21.65}      % radius
\def\vinkelA{12}        % angle
\def\faktor{0.33333333} % Scaling
\newlength\maksimum \maksimum=2\faktor\radius\psunit % This doesn't work!
 \centering
 \psset{
   unit=0.8cm,
   linecolor=red
 }
  \begin{pspicture}(\maksimum,\maksimum)
   \pnode(0,0){A}
   \pnode(!0 \faktor\space \radius\space mul){B}
   \pnode(!2 \faktor\space \radius\space mul mul \faktor\space \radius\space mul){C}
   \pnode(!2 \faktor\space \radius\space mul mul 0){D}
   \pnode(!\faktor\space \radius\space mul \faktor\space \radius\space mul){E}
   \psline(C)(D)(A)(B)
   \psarc(E){!\faktor\space \radius\space mul}{0}{!90 \vinkelA\space sub}
   \psarc(E){!\faktor\space \radius\space mul}{!90 \vinkelA\space add}{180}
   \psline[linestyle=dashed](B)(C)
   \psarc[linestyle=dashed](E){!\faktor\space \radius\space mul}{180}{360}
  \psset{
    linecolor=blue,
    linewidth=1.5pt
  }
   \psRelLine[angle=!270 \vinkelA\space add](E)(B){1}{P1}
   \psRelLine[angle=!90 \vinkelA\space sub](E)(C){1}{P2}
   \pcline(E)(P1)
   \pcline(E)(P2)
   \pcline[offset=12pt,linestyle=none](P1)(P2)
   \aput*{:U}{Oculus}
   \pcline(P1)(P2)
   \pnode(!\faktor\space \radius\space mul 1 \vinkelA\space cos add \faktor\space \radius\space mul mul){H}
   \pcline(E)(H)
  \psset{
    linecolor=black,
    linewidth=0.5pt,
    MarkAngleRadius=3.7,
    LabelSep=4
  }
   \psRelLine[linestyle=dotted,angle=45]{<->}(E)(C){1}{V}
   \ncline[linestyle=none]{E}{V}
   \naput[nrot=:U]{\small{\SI{\radius}{\m}}}
   \pstMarkAngle{H}{E}{P1}{\scriptsize{\SI{\vinkelA}{\degree}}}
   \pstMarkAngle{P2}{E}{H}{\scriptsize{\SI{\vinkelA}{\degree}}}
   \pstRightAngle{P1}{H}{E}
   \pstRightAngle{P2}{H}{E}
  \end{pspicture}
\end{figure}

\end{document}

Output

None, since the code cannot compile.

Question

I don't get how to use the \psunit; I tried using the same method as in this post by @Herbert but it doesn't work. When that is said, I would also like to simplify the code, but the main problem is the use of \psunit in order to get rid of some of the \spaces.

4
  • 2
    Please always provide a more descriptive, specific, unique title. :-) Commented Apr 26, 2013 at 15:15
  • \maksimum=2\dimexpr\faktor\dimexpr\radius\psunit\relax\relax Commented Apr 26, 2013 at 15:17
  • Seriously you should always use pst-sex package that I provided here. It was heroically invented during my learning on PSTricks. :-) Commented Apr 26, 2013 at 15:22
  • @Bugbusters Then put it on CTAN. ;) Commented Apr 26, 2013 at 15:26

1 Answer 1

2

At first define the PSTricks unit. Then you can use the updated \psunit.

[ ... ]
\psset{
   unit=0.8cm,
   linecolor=red
 }
\def\radius{21.65}      % radius
\def\vinkelA{12}        % angle
\def\faktor{0.33333333} % Scaling
\newlength\maksimum     % define the length
\maksimum=\radius\psunit% set it to the current value/unit 
\maksimum=\dimexpr\faktor\maksimum*2
[ ...]

You must log in to answer this question.

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