5

I'm using the pst-node package. Is it possible to let the first node name from \pnodes[*] start at, say, P8 instead of P0? (In general, something other than P0.)

[*] See page 39 of the manual.

Update

Here is the code that I produced quite a long time ago. I think it can be made somewhat simpler without changing much if I can use \pnodes with the first node name starting a $P_i$ for $i \neq 0$.

% pdflatex -shell-escape test.tex

\documentclass{article}

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

\begin{document}

\begin{pspicture}(-0.8,0)(11.4,15.8)
 \pnode(0,0){P1}
 \pnode(0,9.5){P2}
 \pnode(1.05,9.5){P3}
 \pnode(1.05,11.6){P4}
 \pnode(0,11.6){P5}
 \pnode(0,15){P6}
 \pnode(10.5,15){P7}
 \pnode(10.5,5.7){P8}
 \pnode(11.4,4.8){P9}
 \pnode(10.5,4.8){P10}
 \pnode(10.5,1.2){P11}
 \pnode(11.4,0.3){P12}
 \pnode(10.5,0.3){P13}
 \pnode(10.5,0){P14}
 \pnode(9.6,0){P15}
 \pnode(9.6,0.9){P16}
 \pnode(8.7,0){P17}
 \psline(P17)(P1)(P2)(P3)
 \psline(P4)(P5)(P6)(P7)(P8)
 \psline(P9)(P10)(P11)
 \psline(P12)(P13)(P14)(P15)(P16)
 \psIntersectionPoint(P1)(P7)(P6)(P14){P18}
 \rput(P18){\textbf{Studie}}
 \pnode(4.5,9){P21}
 \pnode(4.5,14){P22}
 \pnode(9.5,14){P23}
 \pnode(9.5,9){P24}
 \pspolygon(P21)(P22)(P23)(P24)
 \psIntersectionPoint(P21)(P23)(P22)(P24){P25}
 \rput(P25){\text{Sofagruppe}}
 \pnode(7,2.5){P31}
 \pnode(7,7.5){P32}
 \pnode(8.5,7.5){P33}
 \pnode(8.5,2.5){P34}
 \pspolygon(P31)(P32)(P33)(P34)
 \psIntersectionPoint(P31)(P33)(P32)(P34){P35}
 \rput{90}(P35){\text{Diskussionspanel}}
 \pnode(2,2){P41}
 \pnode(2,3.2){P42}
 \pnode(3.6,3.2){P43}
 \pnode(3.6,2){P44}
 \pspolygon(P41)(P42)(P43)(P44)
 \psIntersectionPoint(P41)(P43)(P42)(P44){P45}
 \rput(P45){\parbox{0.2\textwidth}{\centering\small Nyheds-\\ pult}}
 \pnode(!14 5 div 4 5 div 6 3 sqrt add mul){P46}
 \psdot(P46)
 \uput[90](P46){\text{Kamera}}
 \pnode(2.8,3.2){P47}
 \pcline[linestyle=dashed](P46)(P47)
 \ncput*{$d$}
\psset{
  linestyle=dotted
}
 \psline(P46)(P42)
% dist(P46,P42) = dist(P46,P43) = 8/5*sqrt(2+sqrt(3)) = 3,09
 \psline(P46)(P43)
 \psarc(P2){1.05}{0}{90}
 \psarc(P5){1.05}{270}{360}
 \psarc(P10){0.9}{0}{90}
 \psarc(P13){0.9}{0}{90}
 \psarc(P15){0.9}{90}{180}
\psset{
  arrows=|-|,
  linestyle=dashed,
  offset=12pt,
  nrot=:U
}
 \pcline(P1)(P6)
 \ncput*{15{,}0}
 \pcline(P6)(P7)
 \ncput*{10{,}5}
\end{pspicture}

\end{document}

If someone (Herbert?...) can make the drawing with some much simpler code, I will gladly see it.

Update 2

Here is what I have now, adapting Herbert's idea.

\documentclass{article}

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

\def\door(#1,#2)#3{%
  \psline[
    linecolor=white,
    linewidth=5\pslinewidth,
    dimen=middle
  ](#1,#2)(!#1 #2 #3 add)
  \psline(#1,#2)(!#1 #3 add #2)
  \psarc[
    linestyle=dotted
  ](#1,#2){#3}{0}{90}
}

\begin{document}

\begin{pspicture}(-0.8,0)(11.4,15.8)
 \psframe(0,0)(10.5,15)
 \rput[lb]{90}(9.6,0){\door(0,0){0.9}}
 \door(10.5,0.3){0.95}
 \door(10.5,4.8){0.95}
 \door(0,9.5){1.05}
 \rput(5.25,7.5){\textbf{Studie}}
 \rput(0,11.6){\psscalebox{1 -1}{\door(0,0){1.05}}}
 \psTextFrame(4.5,9)(9.5,14){Sofagruppe}
  \psTextFrame(7,2.5)(8.5,7.5){\rotatebox{90}{Diskussionspanel}}
 \psTextFrame(2,2)(3.6,3.2){\parbox{0.1\textwidth}{\centering\small{Nyheds-\\ pult}}}
 \pnode(!2.8 0.8 6 3 sqrt add mul){P}
 \psdot(P)
 \uput[90](P){Kamera}
\psset{linestyle=dotted}
 \psline(P)(2,3.2)
 \psline(P)(3.6,3.2)
 \pcline[
   linestyle=dashed
 ](P)(2.8,3.2)
 \ncput*{$d$}
\psset{
  arrows=|-|,
  linestyle=dashed,
  offset=12pt,
  nrot=:U
}
 \pcline(0,0)(0,15)     \ncput*{15{,}0}
 \pcline(0,15)(10.5,15) \ncput*{10{,}5}
\end{pspicture}

\end{document}

Can the non-Herbert part be drawn even simpler?

  • The feature you requested is too localized. :-) Zero-based index should be enough for most cases. – kiss my armpit Apr 17 '13 at 1:46
  • @Bugbusters That was a shame. Thank you for the explanation. – Svend Tveskæg Apr 17 '13 at 2:05
  • 1
    what exactly do you want to do? – user2478 Apr 17 '13 at 19:12
  • @Herbert I have a drawing, made a long time ago when I started learning PSTricks, and the code and be made somewhat simpler without changing anything (almost). (I'll update my question with a MWE in a few minutes.) – Svend Tveskæg Apr 17 '13 at 19:19
4
 \pnodes{P}(0,0)(0,0)(0,9.5)(1.05,9.5)(1.05,11.6)(0,11.6)(0,15)(10.5,15)(10.5,5.7)%
    (11.4,4.8)(10.5,4.8)(10.5,1.2)(11.4,0.3)(10.5,0.3)(10.5,0)(9.6,0)(9.6,0.9)(8.7,0)

saves a lot of keystrokes. Double (0,0) to get the old counting. Defining a macro \door makes also life easier. psTextFrame can be used for text in a frame. Here is an example:

\documentclass{article}
\usepackage{auto-pst-pdf,pstricks-add}

\def\door(#1,#2)#3{%
  \psline[
    linecolor=white,
    linewidth=5\pslinewidth](#1,#2)(!#1 #2 #3 add)
  \psline(#1,#2)(!#1 #3 add #2)
  \psarc[
    linestyle=dotted
  ](#1,#2){#3}{0}{90}}
\begin{document}

\begin{pspicture}(-0.8,0)(11.4,15.8)
 \psTextFrame(0,0)(10.5,15){\textbf{Studie}}
 \rput[lb]{90}(9.6,0){\door(0,0){0.9}}
 \door(10.5,0.3){0.95}
 \door(10.5,4.8){0.95}
 \door(0,9.5){1.05}
 \rput(0,11.6){\psscalebox{1 -1}{\door(0,0){1.05}}}
 \psTextFrame(4.5,9)(9.5,14){Sofagruppe}
 \psTextFrame(7,2.5)(8.5,7.5){\rotatebox{90}{Diskussionspanel}}
 \psTextFrame(2,2)(3.6,3.2){\parbox{0.1\textwidth}{\small Nyheds-\\ pult}}
 \pnode(!2.8 0.8 6 3 sqrt add mul){P}
 \psdot(P) \uput[90](P){Kamera}
 \psline[linestyle=dotted](3.6,3.2)(P)(2,3.2)
 \pcline[linestyle=dashed](P)(2.8,3.2)\ncput*{$d$}
\psset{
  arrows=|-|,
  linestyle=dashed,
  offset=12pt,
  nrot=:U}
 \pcline(0,0)(0,15)     \ncput*{15{,}0}
 \pcline(0,15)(10.5,15) \ncput*{10{,}5}
\end{pspicture}

\end{document}

enter image description here

  • \psTextFrame(0,0)(10.5,15){\textbf{Studie}} for the first frame and only one psline for the dotted one. See edit – user2478 Apr 17 '13 at 21:49
  • All open curves except for \psellipticarc have dimen=middle by default so dimen=middle in the door wastes keystrokes. :-) – kiss my armpit Apr 18 '13 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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