[NTG-context] two problems with natural tables

Wolfgang Schuster schuster.wolfgang at googlemail.com
Mon Apr 18 19:16:34 CEST 2011


Am 10.04.2011 um 18:40 schrieb Florian Wobbe:

> Hi,
> 
> 1) I tried the following minimal example from http://archive.contextgarden.net/message/20110109.151431.f774696a.en.html
> 
> \placetable[split]{Test}
> {\bTABLE[split=yes]
> \dorecurse{60}{
> \bTR \bTD hello \eTD \eTR
> }
> \eTABLE}
> 
> with the current context versions which works fine. However, if I insert the code in a big project with many setups it fails with the attached error message. So there are setups which cause this error. Unfortunately I couldn't figure out what causes the problem.

The error comes from the \floatcaptionattribute and \destinationattribute commands. \destinationattribute expects a number as argument (which is stored in the \currentfloatattribute macro) but with a split float it gets a empty argument.

A split float sets \usesamefloatnumber to true and there \currentfloatattribute is \empty.

\long\def\docompletefloat#1#2#3#4#5% #1:floatclass #2:reference #3:optionlist #4:caption #5:box number
  {\presetfloatvariables{#1}{#3}{#2}{#5}% check this one
   \bgroup
   % prepare structure data
   %
   % \dofloatcomponent[\c!name=#1,\c!reference=#2,\c!bookmark=,\c!title={#4}][]% ifnofloatnumber ifnofloatcaption \tracefloatnumber{#1}%
   %
   \ifconditional\usesamefloatnumber
      \globallet\currentfloatnumber     \previousfloatnumber
      \globallet\currentfloatattribute  \empty
      \globallet\currentfloatsynchronize\relax
   \else
   …


As simple fix is to check for a split float when the attribute is set:

\setupinteraction[state=start]

% original defintion from strc-flt.mkiv
%
%\def\floatcaptionattribute
%  {\iflocation \ifnofloatnumber \else \ifnofloatcaption \else
%     attr \destinationattribute \currentfloatattribute
%   \fi \fi \fi}

% patched definition with check for split float

\def\floatcaptionattribute
  {\iflocation \ifnofloatnumber \else \ifnofloatcaption \else \ifinsidesplitfloat \else
     attr \destinationattribute \currentfloatattribute
   \fi \fi \fi \fi}

\starttext
\placetable[split]{Caption}
  {\bTABLE\dorecurse{60}{\bTR\bTD text\eTD\eTR}\eTABLE}
\stoptext


Wolfgang



More information about the ntg-context mailing list