Sunday, July 22, 2007 Hans Hagen wrote:
the fit assumes operating on a page not in a box;
Ah, didn't know that. I couldn't even tell from the sources, since it uses enclosing box dimensions and not page or paper sizes. I suspect the logic is broken at the page level too though, let me explain why. Currently, if I understand the code correctly, factor=fit expands the figure to have its major direction fit, while factor=max expands the figure to have its minor direction fit. Instead, the behavior I would expect from fit (resp. max) is for the *expansion ratio* to be the minimum (resp. maximum) of the expansion ratios in the two directions (not the sizes in those directions, but the ratio between the sizes of the figure and the container). The difference is noticeable when the container and contained have different aspect ratios. Consider for example a 20x30mm figure in a 50x150mm page (strange numbers, just used to show what I mean): with the current code, using 'fit' would consider the largest dimension (30) and thus calculate a factor of 150/30 = 5, but this gives us an image which is 100x150mm, i.e. an image that doesn't fit! Whereas, if we computed the ratios 50/20 = 2.5 and 150/30 = 5, we would know that the ratio to be picked was 2.5 in 'fit' and 5 in 'max'. Or I misintepreting the meaning of 'fit' and 'max'?
an alternative is:
\framed[width=5cm,height4cm]
{\externalfigure[mill.png][maxwidth=4cm,maxheight=5cm,width=10cm]}
i.e. setting the maximum values
I hadn't thought about using width and maxwidth (and maxheight) at the same time, thanks. Of course, I'd rather have 'fit' and 'max' usable in boxes :) -- Giuseppe "Oblomov" Bilotta