[OS X TeX] [External] alignment of subfigures

Herbert Voss Herbert.Voss at fu-berlin.de
Wed Jun 11 01:22:31 EDT 2025



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



More information about the MacOSX-TeX mailing list