[pstricks] Post-processing placement of typeset text

Alan Ristow ristow at ece.gatech.edu
Tue Sep 21 17:21:37 CEST 2004


Hi,

I have a text placement problem that I am having a difficult time
solving. I have begun working on a set of contour plotting commands that
I plan to package and release once I have them working satisfactorily.
The contour plotting part is in good shape, but I can't even begin to
figure out how to place the text labels. I have a feeling that I am
making the problem harder than it needs to be, but regardless, I need
some advice.

The way I have set up the contour plotting, the mathematics is all done
in Postscript code. TeX and LaTeX simply read the data from a file and
insert them into the PS routine, and the locations of the contour lines
are not known until the PS file is executed. As a result, I cannot use
\rput or \uput to place the contour labels -- they must be placed by the
PS code. However, I want the labels to be typeset by TeX/LaTeX a step
before I know where to put them.

So my problem is this: On the TeX/LaTeX side, I need to typeset my
labels without knowing where to place them and put them someplace that
Postscript can manipulate them. On the Postscript side, I need to locate
the typeset labels and place them appropriately.

Currently I am forcing the user to specify the contour levels to plot;
even if I switch to something more automated, I think \pst at divide can
handle the required mathematics, so the values to be typeset will always
been known when TeX/LaTeX runs. It is only placement that needs to be
done on the PS side.

It appears to me that \rput places its text into an \hbox at the origin,
typesets it, then translates it to the required location. The approach
that seems most obvious to me is to place each typeset contour label
into a PS array, then get each label from the array and translate it
upon execution of the PS file. Problem is, I'm not sure how to put the
labels into the PS array. I'm also interested in other algorithms, if
anybody has any ideas. Clearly I'm treading into unfamiliar territory
here, and I'm afraid I might be thinking too much like a C programmer to
find an efficient solution.

Of course, if I ever manage to package and release this thing, all
contributions will be fully credited.

Alan




More information about the PSTricks mailing list