# [NTG-context] lmtx-20210118 | Corruption with rotated floats

Hans Hagen j.hagen at xs4all.nl
Sat Jan 23 22:43:10 CET 2021

On 1/23/2021 12:10 PM, Pablo Rodriguez wrote:
> On 1/23/21 8:59 AM, Richard Mahoney wrote:
>> [...]
>> \placetable[here,90]
>>
>> results in the trashing of all subsequent body text in the PDF.
>> [...]
>> This error has been occurring for some time now, and unfortunately,
>> while I would like to keep up the recent releases of LMTX, it is
>> essential that I should be able to rotate tables and images. Does
>> anyone know of a fix?
>
> Richard,
>
> a minimal sample with images would read:
>
>    \setupexternalfigures[location=default]
>    \starttext
>    \placefigure[90, here]{Rotated sample}{\externalfigure[hacker.jpg]}
>    \input zapf
>    \stoptext
>
> I don’t know why, but both MkIV and current latest (LMTX from
> 2021.01.22 09:41) place the rotated figure on a different page (with 90
> and 270).
>
> LMTX misplaces next paragraph on next page with both 90 and 270.
>
> To show the issues with tables, a minimal sample would help. I’m afraid
> I don’t have any experience rotating tables.
The code is not different from mkiv but instead we swap dimens using a
primitive. When you set \overloadmode=4 (which can be interesting as it
might reveal issues in a style) the run will quit with an error ... this
is a fix:

\def\strc_floats_set_page_variant
{\bgroup
\strc_floats_set_local_hsize
\ifcase\c_strc_floats_rotation\else
% Swapping fails in overloadmode and is also wrong (as it then is
persistent due
% to global being inherited).
%\swapdimens\hsize\vsize
\scratchdimen\hsize
\hsize\vsize
\vsize\scratchdimen
\fi

(it also indicates that we're cheating with the sizes which when it
happens global is pretty dangerous ... it works but i admit that it is
not nice)

Hans

-----------------------------------------------------------------