On Thu, 31 May 2007 16:58:11 +0200
Henning Hraban Ramm <[EMAIL PROTECTED]> wrote:

> This was asked, but not answered before...

[long text deleted]

Hi Hraban,

I investigated time in your problem and found a better (with lots of
things to be done) solution.

\input rotatesplit

\startsetups caption:rotatedcaption

\setupcaptions
  [location={middle,left},
   command={\rotate[rotation=-90]},
   width=max,
   align=middle]

\stopsetups

\startsetups caption:normalcaption

\setupcaptions
  [location=bottom,
   command=,
   width=fit,
   align=]

\stopsetups

\def\rotatedcaption
  {\ifnum\floatrotation=90
     \setups{caption:rotatedcaption}
   \else\ifnum\floatrotation=270
     \setups{caption:rotatedcaption}
   \else
     \setups{caption:normalcaption}
   \fi\fi}

%\setupfloats[before=\rotatedcaption]

\showframe

\starttext

\dorecurse{10}{\input knuth\relax}

\chardef\floatrotation=90

\rotatedcaption

\placetable
  [90,split]
  [tab:religionen]
  {Götter}
  {\bTABLE[width=5cm]
   \dorecurse{100}{\bTR\bTD Text\eTD\eTR}
   \eTABLE}

\chardef\floatrotation=0

\rotatedcaption

\placetable
  [split]
  [tab:religionen]
  {Götter}
  {\bTABLE[width=5cm]
   \dorecurse{100}{\bTR\bTD Text\eTD\eTR}
   \eTABLE}

\dorecurse{10}{\input knuth\relax}

\stoptext

Wolfgang
\unprotect

\def\floathack#1%
  {\globallet\floatrotation\!!zerocount
   \ifparfloat
   \else
     \processallactionsinset
       [#1]
       [ 90=>\globallet\floatrotation\commalistelement,%
        180=>\globallet\floatrotation\commalistelement,%
        270=>\globallet\floatrotation\commalistelement]%
   \fi
   \setbox\scratchbox\hbox{\floatrotation}%
   \floatparameter\c!before}

\def\dodocomplexplacefloat[#1][#2][#3]#4%
  {\flushnotes
   \flushsidefloats % here !
   \ifsomefloatwaiting
     % this was \checkwaitingfloats spread all over
     \doifinsetelse\v!always{#2}
       {\showmessage\m!floatblocks5\empty}
       {\expanded{\doifcommonelse{#2}{\flushfloatslist}}\doflushfloats\donothing}%
     % but which should be done before using box \floatbox
   \fi
   \ifmargeblokken
     \doifinset\v!margin{#2}\endgraf
   \fi
   \global\insidefloattrue
   \begingroup % **
   \ifmargeblokken
     \doifinset\v!margin{#2}{\hsize\@@mbwidth}%
   \fi
   \the\everyinsidefloat
   \let\@@extrafloat\empty
   \presetmorefloatvariables{#2}%
   \dowithnextboxcontent % better a \the\everyfloattoks
     {\setlocalfloathsize
      \floatparameter\c!inner
      \fuzzysnappingfalse
      \postponenotes} % new
     {\doifsomething{\floatparameter\c!criterium}
        {\ifdim\wd\nextbox>\floatparameter\c!criterium\relax
           \edef\forcedfloatmethod{\executeifdefined{\??fl\currentfloat\c!fallback}\v!here}%
         \fi}%
       \xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done
       % we need to carry over the par because of side floats
      \doifnotinset\v!text{#2}{\carryoverpar\endgroup}%
      \global\sidefloatdownshift \zeropoint
      \global\sidefloatextrashift\zeropoint
      \ifparfloat
        \doifinset\v!reset{#2}\forgetsidefloats
        \doinhibitblank
      \fi}% better move this to side floats
     \vbox}

\def\splitrotation
  {\ifnum\floatrotation=90
     \scratchdimen\textwidth
   \else\ifnum\floatrotation=270
     \scratchdimen\textwidth
   \else
     \scratchdimen\textheight
   \fi\fi}

\def\handletsplit
  {\analyzesplitfloatcaption\tsplitcontent
   \global\setfalse\tsplitfirstdone
   \testpage
     [\tsplitminimumfreelines]
     [\dimexpr\tsplitminimumfreespace+\extrasplitfloatlines\lineheight\relax]%
   \setbox\scratchbox\vbox{\tsplitinbetween}%
   \edef\tsplitinbetweenheight{\the\htdp\scratchbox}% etex
   \!!doneafalse
   \doloop
     {\ifinsidecolumns
        % brrr, assumes empty columns
        \global\setfalse\tsplitfirstdone
        \splitrotation
        \!!donectrue
      \else
        \ifconditional\tsplitfirstdone
          \splitrotation
          \!!donectrue
        \else\ifdim\pagegoal<\maxdimen
          \scratchdimen\dimexpr\pagegoal-\pagetotal\relax
          \!!donecfalse
        \else
          \splitrotation
          \!!donectrue
        \fi\fi
      \fi
      \scratchdimen\dimexpr\scratchdimen-\tsplitinbetweenheight-\tsplitminimumfreespace-\extrasplitfloatlines\lineheight\relax
      \ifdim\htdp\tsplittail>\zeropoint
        \advance\scratchdimen-\htdp\tsplittail
      \fi
      \setbox\tsplitresult\vbox
        {\ifdim\ht\tsplithead>\zeropoint
           \unvcopy\tsplithead
           \tsplitinbetween
         \fi}%
      \if!!donea\else\ifdim\ht\tsplitnext>\zeropoint
        \setbox\tsplithead\box\tsplitnext
      \fi\fi
      \!!doneatrue
      \ifdim\ht\tsplitresult>\zeropoint
        \!!donedtrue  % table head
      \else
        \!!donedfalse % no tablehead
      \fi
      \splittopskip\zeropoint
      \doloop
        {\setbox\scratchbox\vsplit\tsplitcontent to \onepoint % \lineheight
         \setbox\scratchbox\vbox{\unvbox\scratchbox}%
         \ifdim\dimexpr\scratchdimen-\htdp\scratchbox-\htdp\tsplitresult\relax>\zeropoint
           \setbox\tsplitresult\vbox
             {\unvbox\tsplitresult
              \tsplitinbetween
              \unvbox\scratchbox}%
           \ifvoid\tsplitcontent \exitloop \fi
         \else\if!!doned
           % we only have a tablehead so far
           \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvbox\scratchbox}%
           \exitloop
         \else\if!!donec
           % we have text height available, but the (one) cell is too
           % large to fit, so, in order to avoid loops/deadcycles we do:
           \setbox\tsplitresult\vbox
             {\unvbox\tsplitresult
              \tsplitinbetween
              \unvbox\scratchbox}%
           \exitloop
         \else
           \setbox\tsplitcontent\vbox
             {\unvbox\scratchbox
              \tsplitinbetween
              \ifvoid\tsplitcontent\else\unvbox\tsplitcontent\fi}%
           \exitloop
         \fi\fi\fi
         \!!donedfalse
         \!!donecfalse}%
      \postprocesstsplit
      \dochecksplitofffloat\tsplitcontent
      \ifvoid\tsplitcontent
        \setbox\tsplitresult\vbox
          {\unvbox\tsplitresult
           \tsplitinbetween
           \unvcopy\tsplittail}%
        \dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}%
        \doifnotinsidesplitfloat\tsplitafter
        \endgraf
        \exitloop
      \else
        % hack
        \ifdim\pagegoal<\maxdimen
          \global\pagegoal\dimexpr\pagegoal+\lineheight\relax % etex
        \fi
        % brrr
        \ifdim\ht\tsplitresult>\zeropoint
          \setbox\tsplitresult\vbox
            {\unvbox\tsplitresult
             \tsplitinbetween
             \unvcopy\tsplittail}%
          \dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}%
          \doifnotinsidesplitfloat\tsplitafter
          \endgraf
        \fi
        \ifinsidecolumns
          \doifnotinsidesplitfloat\goodbreak
        \else
          \doifnotinsidesplitfloat\page
        \fi
      \fi}}

\protect \endinput
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to