[texhax] TeX's paragraphing engine as an engine for typesetting image blocks

Philip Taylor P.Taylor at Rhul.Ac.Uk
Sun Feb 22 16:27:01 CET 2015


A contributor to a catalogue which I recently typeset asked if I could 
take a subset of the images out of the flow and include them as an image 
block at the end of each major section.  At first I was unconvinced that 
it was even possible, given that each image had no fixed natural size, 
but when I realised that it would be possible to set all images (apart 
from a few outliers [1]) at a consistent height and at their natural 
width for that height, I also realised that the task was indeed 
possible.  However, achieving an optimal layout for each image block 
proved surprisingly difficult.

Basically I treated each block of images as a single paragraph, and each 
image as a single glyph; what I /wanted/ to achieve was a paragraph of 
minimal length, with each line optimally full but with the final line of 
each paragraph allowed to run short.  All images were to be evenly 
distributed within the line in which they appeared, and the left and 
right margins should be identical to the inter-image gutter.

To achieve this was considerably harder than I anticipated, and after 
two days of trial, error and introspection I came up with the following 
parameters :

\tolerance = 9999
\emergencystretch = 0,02 \hsize
\looseness = -\maxdimen
\linepenalty = -\maxdimen
\spaceskip = 0 pt
\xspaceskip = 0 pt
\baselineskip = 0 \vsize
\lineskip = 0\normalbaselineskip
\lineskiplimit = \lineskip
\leftskip = 0 pt plus 0,1 \hsize
\rightskip = 0 pt plus 0,1 \hsize
\gutterskip = 0,02 \hsize plus 0,02 \hsize
\parindent = 0 em
\parfillskip = -\gutterskip
\clubpenalty = 0
\widowpenalty = 0

and this appears (visually) to give the results desired.

	https://www.royalholloway.ac.uk/Hellenic-Institute/Research/LPL/Greek-MSS/Catalogue/Binding-image-outlines-s.pdf [2]

However, I am surprised at the time that it took to come up with this 
particular set of parameters, and am not 100% convinced that they would 
necessarily prove optimal for a different set of images.  What do others 
think ?


Philip Taylor

[1] The outliers are those whose natural width, if set to the 
otherwise-universal height, would exceed \hsize.  Such images are set 
with width = \hsize and their natural height.

[2] Image content suppressed for reasons of copyright.


More information about the texhax mailing list