I am looking for explanation of how pstricks deals with measurement units. I am trying to write my custom postscript-only drawing commands, to be used within the \pspicture environment. For explanation why I need that, read at the end.
I need to start by writing a postscipt command that draws segments. However, when I draw a segment of length 72 postscript units, I do not get the same result as when drawing a 1-inch \psline. What is going on? How does pstricks measure units?
[Edit for clarification:] The first two commands are supposed to produce equal length lines but they don't. Why?
\documentclass{article}
\usepackage{auto-pst-pdf}
\usepackage{pst-plot}
\begin{document}
\psset{xunit=1cm, yunit=1cm}
\begin{pspicture}(0,0)(1,1)
\psline(0,0.1)(2.54,0.1)
\pstVerb{newpath 0 0 moveto 72 0 lineto stroke}
\pstVerb{newpath 0 -600 moveto 7200 -600 lineto stroke}
\pstVerb{newpath 0 -1400 moveto 8000 -1400 lineto stroke}
\end{pspicture}
\end{document}
I tried reading the source pstricks.tex but I find it unreadable.
I am trying to write a package that draws fancy things such as 3d vector field graphics, etc. Previously, for such purposes I've been using the \multido macro, and I've found it to be so poorly designed that I prefer doing everything in postscript directly.
I've used already available packages (for example, pst-3dplot) and I've found them to be very much wanting and completely unreliable. As a result I prefer to write everything myself.
To do more complicated things such as vector fields/surfaces, I need to be able to plot 2d segments correctly.
On a related note, what does the \pst@number\psyunit in the pstricks.tex file do/stand for? [Edit: to elaborate] The code:
\makeatletter
\pst@number \psxunit
\makeatother
prints a numerical value of 28.45274. From the naming of the variable, I would expect that it measure the postscript units needed to draw 1cm, but those are 72/2.54 = 28.346456693. So, this variable must stand for something else. What?
bp. – egreg Sep 02 '14 at 00:22pt) is slightly smaller than a PostScript point (called a big point (bp) in TeX).1in = 72bp = 72.27pt(see this question's answers or the TeXbook for full detail and explanation). So the number printed (28.45274) is 72.27/2.54, not 72/2.54. There is a slight discrepancy if you actually do the division, caused by TeX's well-known difficulties providing precise results for floating-point arithmetic. – Paul Gessler Sep 02 '14 at 01:54