[pstricks] Moving Image Origin on Page

Jean-Côme Charpentier jean-come.charpentier at wanadoo.fr
Tue Jan 15 19:07:22 CET 2013


Le 15/01/2013 18:33, Rich Shepard a écrit :
>    It's been a long time since I needed to generate figures for a report so
> I've been re-reading Herbert's PSTricks book to re-learn what to do.
>
>    Unfortunately, I'm stuck at the very earliest stage: setting the figure
> size and having it centered on the page. I've tried using the origin
> command, but I'm not putting it in the proper place, properly specifying
> settings, or both.
>
>    Here's the stub for the eventual figure:
>
> \documentclass[letterpaper,10pt]{article}
> \usepackage{pstricks-add}
>
> \begin{document}
>    \begin{pspicture}(-1.5in,-0.5in)(6in,4in)
>      \psgrid[subgriddiv=1in,gridcolor=black!25]
>      \psline[linewidth=2pt](1.25in,1.25in)(3.5in,1.25in)
>    \end{pspicture}
> \end{document}
>
>    The \psgrid is temporary for properly aligning and sizing the figure.

   I don't really understand. The size of this figure is the size of the 
line inside it. Isn't it? So the bounding box is
   (1.25in,1.25in)(3.5in,1.25in)

There is only one (syntaxic) error in this code: subgriddiv isn't a 
dimension: subgriddiv=1in is an error. subgriddiv indicates the number 
of subdivisions in one division, here you have to say
   subgriddiv=1

> When
> that's correct I'll adjust the line size and placement and add the other
> elements needed.
>
>    A clue to what I've not done correctly will be much appreciated.

   Well. Using inches rather centimeter isn't an error as you say in 
your second post. In fact, I don't understand why you want centering in 
a such way... Furthemore, it's not perfectly centering. Using the real 
bounding box and the center (or \centering macro) environment seems to 
me more accurate. My attempt (with inches):

\documentclass[letterpaper,10pt]{article}
\usepackage{pstricks-add}

\begin{document}
   \psset{unit=1in}
   \hspace*{-1.5in}\begin{pspicture}(-1.5,-0.5)(6,4)
     \psgrid[subgriddiv=10,gridcolor=black!25]
     \psline[linewidth=2pt](1.25,1.25)(3.5,1.25)
   \end{pspicture}
   \par\vspace{1in}
   \begin{center}
     \begin{pspicture}(1.25,1.25)(3.25,1.25)
       \psline[linewidth=2pt](1.25,1.25)(3.5,1.25)
     \end{pspicture}
   \end{center}
\end{document}

   Jean-Côme Charpentier


More information about the PSTricks mailing list