LaTeX forum ⇒ General ⇒ Wrapper for subcaptionbox: automatic vertical alignment Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
woj-k
Posts: 15
Joined: Wed Jul 28, 2010 7:25 pm

Wrapper for subcaptionbox: automatic vertical alignment

Hello everyone,

I got stuck on designing easy-to-use command wrappers for multipanel floats (i.e. subfigures/subtables) built around the subcaption package. The problem has to do with vertical alignment of the individual panels of the float: the 'default' behaviour I have observed is bottom-alignment, but I would like the users to be able to specify rows where the panels are verticaly centered or top-aligned. This would require raising some of the panels by an amount which is dependent on the height of the 'tallest' panel in the given row.

In the MWE below I have omitted top-aligned panels for brevity.

The panel-environment evaluates its contents and dumps them into a macro \panelcontents. Although it does nothing with this value, it does evaluate the contents' height and stores it in \currentpanelheight---I imagine the final version will have to do it anyway, to decide which panel is the tallest automatically.

The problem disappears if I specify the tallest panel's height by hand (line 89 of the MWE). It is to have LaTeX determine this value automatically for each row that poses a problem. I considered a solution where each panel exports a value to an external file, and a separate macro selects the tallest panel on a subsequent run, rather than on-the-fly. There is probably a more elegant way to do it, but I am missing a piece of the puzzle. Can anyone offer any advice?

Last edited by woj-k on Mon Jun 17, 2013 2:27 pm, edited 1 time in total.

Tags:

woj-k
Posts: 15
Joined: Wed Jul 28, 2010 7:25 pm
Fixed up a solution using the \VerbatimOut facility of the fancyvrb package, with export of each row to an external file and using the code twice---once to determine the size and once to print the correctly aligned row. It all happens on the same run. Had to redefine \panel for the size-determination step, and for some reason I could not simply return it to the previous version using \global\let---had to use \renewcommand again instead. Here's a top-aligned and centred example.
