4

I tried to align text with the top of a figure. The pstricks manual says that I can specify an option to the pspicture environment, but this somehow does not work. I get an error message.

! Package xkeyval Error: ``1' undefined in families ``,pstricks,pst-node'.

\documentclass{article}

\usepackage{pstricks,pst-node}

\begin{document}

Test {\begin{pspicture}(2.6,0)(7.4,4.3)
%\psgrid
\rput[B](3,0){\rnode{Peter}{Peter}}
\rput[B](6,0){\rnode{schlaeft}{sleeps}}
%
\rput[B](6,2){\rnode{v}{V[\begin{tabular}[t]{@{}l@{}}
                          subj ,\\
                          comps ]
                          \end{tabular}}}
\rput[B](3,2){\rnode{np1}{1 NP[{nom}]}}
%
\rput[B](4.5,4){\rnode{vp}{V[\begin{tabular}[t]{@{}l@{}}
                             subj \\
                          comps  ]
                          \end{tabular}}}
%
\psset{angleA=-90,angleB=90,arm=0pt}
%
\ncdiag{v}{schlaeft}
\ncdiag{np1}{Peter}
\ncdiag{vp}{np1}\ncdiag{vp}{v}
%
\end{pspicture}

\end{document}
  • If I remove the open brace before \begin{pspicture}, I get no error. – egreg Jul 24 '13 at 11:54
  • I used \begin{pspicture}[1](2.6,0).... – Stefan Müller Jul 24 '13 at 18:09
2

Use the shift option:

[...]
Test \begin{pspicture}[shift=-4](2.6,0)(7.4,4.3)
\rput[B](3,0){\rnode{Peter}{Peter}}
[...]

-4 is the y coordinate of your first text

2

Not sure if converting the pspicture environment to macro structure will have any adverse effects, but the \belowbaseline command of stackengine will do the trick external to pspicture:

\documentclass{article}

\usepackage{pstricks,pst-node}
\usepackage{stackengine}

\begin{document}

Test 
\belowbaseline[-\ht\strutbox]
{\pspicture(2.6,0)(7.4,4.3)
%\psgrid
\rput[B](3,0){\rnode{Peter}{Peter}}
\rput[B](6,0){\rnode{schlaeft}{sleeps}}
%
\rput[B](6,2){\rnode{v}{V[\begin{tabular}[t]{@{}l@{}}
                          subj ,\\
                          comps ]
                          \end{tabular}}}
\rput[B](3,2){\rnode{np1}{1 NP[{nom}]}}
%
\rput[B](4.5,4){\rnode{vp}{V[\begin{tabular}[t]{@{}l@{}}
                             subj \\
                          comps  ]
                          \end{tabular}}}
%
\psset{angleA=-90,angleB=90,arm=0pt}
%
\ncdiag{v}{schlaeft}
\ncdiag{np1}{Peter}
\ncdiag{vp}{np1}\ncdiag{vp}{v}
%
\endpspicture
}
\end{document}

enter image description here

2

You can give an asterisk to the shift option:

Test \begin{pspicture}[shift=*](2.6,0)(7.4,4.3)
\rput[B](3,0){\rnode{Peter}{Peter}}

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.