[pstricks] Rotate Text on PS side
Christoph Bersch
usenet at bersch.net
Fri Aug 17 09:35:35 CEST 2007
Herbert Voss schrieb:
> Christoph Bersch wrote:
>> Herbert Voss wrote:
>>
>>> Christoph Bersch wrote:
>>>
>>>> \ncput[nrot=:U]{Flipped}
>>>>
>>>>
>>> \ncput[nrot=:D]{Flipped}
>>>
>>> see page 94 in the PSTricks book
>>>
>> I think, I didn't explain it good enough:
>>
>> The problem is, that I have a macro containing the
>> \ncline and \ncput stuff. Within this macro the text should be flipped
>> if necessary (based only on the node coordinates).
>>
>
> possible with modifying the PostScript procedure
[code]
Hi,
is it possible to redefine InitNC locally in the testput commands?
I tried something like
File 'mypstheader.pro' contains the new InitNC:
/InitNCnew {
/b ED /a ED % second and first node
/NodeSepTypeB ED /NodeSepTypeA ED
/NodeSepB ED /NodeSepA ED
/OffsetB ED /OffsetA ED
tx at NodeDict a known tx at NodeDict b known and dup {
/NodeA a load def /NodeB b load def
NodeA GetCenter NodeB GetCenter % xA yA xB yB
4 copy pop exch pop lt % xA xB
{ /yB ED /xB ED /yA ED /xA ED }
{ /yA ED /xA ED /yB ED /xB ED } ifelse
} if } def
The TeX file is as follows:
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pstricks}
\usepackage{pst-node}
\pstheader{mypstheader.pro}
\makeatletter
\def\testput(#1)(#2)#3{%
\addto at pscode{tx at NodeDict begin /InitNCold InitNC def /InitNC
InitNCnew def end }
\ncline{#1}{#2}
\ncput[nrot=:U]{#3}}
\addto at pscode{tx at NodeDict begin /InitNC InitNCold def end }
\makeatother
\begin{document}
\begin{pspicture}[showgrid=true](5,4)
\pnode(0,0){A}
\pnode(2,4){B}
\pnode(5,0){C}
\pnode(3,4){D}
\testput(A)(B){Normal}
\testput(C)(D){Flipped}
%
\end{pspicture}
\end{document}
Unfortunately this does not work.
Am I doing something fundamentally wrong, or is it only a question of
correct syntax?
Thank you,
Christoph
More information about the PSTricks
mailing list