[OS X TeX] [External] alignment of subfigures
Nitecki, Zbigniew H.
Zbigniew.Nitecki at tufts.edu
Wed Jun 11 12:55:56 EDT 2025
Thanks, that helpd me understand some things better.
I had started to write a long exposition about my continuing confusion, but (since writing something out isthe best way of forcing oneself to pay very close attention to details) I think I now understand. I’m glad I wrote my question in a way that commingled your “hack” with that of Martin, because your comment that \alpha gives the
units local to the (first) subfloat but \beta affects the units of the coordinate system inside the pspicture is, I think,
the source of my confusion.
I had originally set the first grid using pspicture[unit=3cm](0,0)(3,3) and the second using pspicture[unit=1cm](0,0)(9,9), thinking that coordinates given in each case defined the coordinates inside the pspicture, not the
placement of the pspicture in the reserved box for the subfloat. So I had assumed that the two pspictures would
both be the same size ( 3,3) times 3cm is 9cm x 9, as is (9,9) times 1cm.
Though I am still not sure why the diagonally opposite corner of the pspicture, which is in both cases the origin,
still does not align.
With my (well, your) new interpretation, what I overlooked was the likelihood that the pspicture is either centered in the reserved square or otherwise placed with some indentation with respect to the edges of the
reserved square, and this gets changed by the rescaling.
You suggested moving the unit declaration for the first pspicture to precede the pspicture (thereby setting the
units for the coordinates in the subfloat box, and therefore affecting the placement of the pspicture inside that
box.
Martin instead left everything alone except changing the second coordinate in the specification of the first pspicture from (3,3) to (9,9).
Both changes worked to align the two grids.
I have a different though somewhat related question which I will ask separately.
On Jun 11, 2025, at 01:22, Herbert Voss <Herbert.Voss at fu-berlin.de> wrote:
Am 10.06.25 um 22:18 schrieb Nitecki, Zbigniew H.:
Two different hacks, one suggested by _Herbert Voss_ and the other by _Martin Costabel_, both
fix the alignment—*thank you both*.
But I am still confused about how this works (and haven’t been able to figure it out from either Latex Companion III or Herbert’s PSTricks book).
In the sequence of commands
\subfloat[Level ]{
\psset{unit=\alpha}
\begin{pspicture}[unit=\beta](\gamma.\gamma)(\delta,\delta)
\psgrid[subgriddiv=m, gridlabels=0](0,0)(n,n)
\end{pspicture}
}\\
- unit=\alpha sets the current unit to \alpha, eg 3cm
- unit=\beta sets the current unit locally to the pspicture
environment to \beta. If you have relative units, eg unit=2,
then the _current_ unit will be multiplied by 2.
- \gamma.\gamma)(\delta,\delta) defines the rectangle (box) which
will be used by TeX for the typesetting.
- \psgrid[subgriddiv=m, gridlabels=0](0,0)(n,n)
m is the number of sublines for the grid and (0,0)(n,n) are the
coordinates of the grid inside the reserved rectangle (box) of
pspicture
In your above example you should only use the unit setting
with \psset:
\documentclass{article}
\usepackage{pstricks}
\usepackage{subfig}
\begin{document}
\begin{figure}
\centering
\subfloat[Level $2$]{%
\psset{unit=3cm}% local to \subfloat
\begin{pspicture}(0,0)(3,3)
\psgrid[subgriddiv=3, gridlabels=0](0,0)(3,3)
\end{pspicture}
}
\subfloat[Level $3$]{%
\begin{pspicture}(0,0)(9,9)
\psgrid[subgriddiv=3, gridlabels=0](0,0)(9,9)
\end{pspicture}
}
\caption{Level $2$ and Level $3$,}\label{fig}
\end{figure}
\end{document}
Herbert
What exactly do the units \alpha and \beta control? I had assumed that having both was redundant (that they were automatically equal, and gave the units for the space alotted to the subfigure. But then what is the role
of \gamma and \delta? My best guess is that alpha is the /a priori/ unit for coordinatizing the space for the subfigure, and withing that, gamma and delta tell us where the lower left and upper right corners of the
pspicture are in the alpha-controlled coordinates. If the space allotted to the subfigure is fixed, where is its origin? Then what is beta? It seems to control the size of the spaces
between the lines dividing the grid (or…the sides of the grid are always at (successive) integer values of the
coordinates inside the pspicture, for which the unit is beta). Clearly n controls the major division lines in the
grid, and m specifies how many subdivision lines are in each cell of the major division. But then I would expect
that if alpha and gamma are the same for two successive subfigures (and the first set of coordinates in \psgrid
is (0,0) ) then the actual grids should line up at least on the left. Maybe someone can point me to the appropriate pages of LC III or PSTricks where this is explained.
On Jun 10, 2025, at 05:53, Herbert Voss <Herbert.Voss at fu-berlin.de> wrote:
Am 10.06.25 um 03:31 schrieb Nitecki, Zbigniew H.:
I’m clearly misunderstanding some of the parameters for floats,
pspicture, and \psgrid.
The code below yields two grids of the same size (with different
subdivisions).
Should I have set the two pspicture parameters differently?
From what I understand,
the two pspictures are both 9cm x 9cm boxes, so why are they aligned
differently?
% !TEX TS-program = latex
\documentclass{article}
\usepackage{pstricks}
\usepackage{subfig}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}
\begin{center}
%
\subfloat[Level $2$]{
\begin{pspicture}[unit=3cm](0,0)(3,3)
That setting is too late for (3,3). Use
\subfloat[Level $2$]{%
\psset{unit=3cm}
\begin{pspicture}(0,0)(3,3)
\psgrid[subgriddiv=3, gridlabels=0](0,0)(3,3)
\end{pspicture}
}
You can also run the document with lualatex, then you'll get directly
the PDF.
Herbert
----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://www.tug.org/mactex/faq/index.html
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Caution: This message originated from outside of the Tufts University organization. Please exercise caution when clicking links or opening attachments. When in doubt, email the TTS Service Desk at it at tufts.edu<mailto:it at tufts.edu> or call them directly at 617-627-3376.
----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://www.tug.org/mactex/faq/index.html
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://www.tug.org/mactex/faq/index.html
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20250611/d77ac4ae/attachment.htm>
More information about the MacOSX-TeX
mailing list