On 12/6/2012 10:58 AM, Mikael P. Sundqvist wrote:
On Wed, Nov 3, 2010 at 7:51 AM, Wolfgang Schuster
<schuster..wolfg...@googlemail.com
<mailto:schuster.wolfg...@googlemail.com>> wrote:


    Am 03.11.2010 um 05:47 schrieb Vladimir Lomov:

     > Hi.
     >
     > Some answers I found myself :)
     >
     > P.S. I have feeling that feature like 'hangaround' doesn't fit well
     > with tex (page layout ...?) model.

    Hangaround is a very robust command and works in more cases than
    \placefigure[left] but you have a conflict with the \item command
    which place the itemize symbol before the following text which
    is indented in your case.

    \unprotect

    \def\stophangaround
       {\endgraf
        \egroup}

    \def\starthangaround
       {\dosingleempty\dostarthangaround}

    \def\dostarthangaround[#1]%
       {\doifelse{#1}{\v!right}
          {\dostartrighthangaround}
          {\dostartlefthangaround }}

    \def\dostartlefthangaround
       {\noindent\bgroup
        \dowithnextbox
          {\ifdim\nextboxht>\strutht\setbox\nextbox\tbox{\flushnextbox}\fi
           \setbox\nextbox\hbox{\flushnextbox\hskip\@@hadistance}%
           \getboxheight\scratchdimen\of\box\nextbox
           \getnoflines\scratchdimen
           \nextboxht\strutht
           \nextboxdp\strutdp
           \hangindent\nextboxwd
           \hangafter-\noflines
           \llap{\flushnextbox}\ignorespaces}
        \hbox}

    \def\dostartrighthangaround
       {\noindent\bgroup
        \dowithnextbox
          {\ifdim\nextboxht>\strutht\setbox\nextbox\tbox{\flushnextbox}\fi
           \setbox\nextbox\hbox{\hskip\@@hadistance\flushnextbox}%
           \getboxheight\scratchdimen\of\box\nextbox
           \getnoflines\scratchdimen
           \nextboxht\strutht
           \nextboxdp\strutdp
           \hangindent-\nextboxwd
           \hangafter-\noflines
           \rlap{\hskip\hsize\llap{\flushnextbox}}\ignorespaces}
        \hbox}

    \protect

    \starttext

    \starthangaround{\externalfigure[cow][scale=500]}
    \input tufte
    \stophangaround

    \blank

    \starthangaround[right]{\externalfigure[cow][scale=500]}
    \input tufte
    \stophangaround

    \stoptext

as mkiv has a starthangaround but uses a different parameter handler, this works:

\unexpanded\def\starthangaround
  {\dontleavehmode\bgroup
   \dosingleempty\spac_hanging_around_start}

\def\spac_hanging_around_start[#1]%
  {\edef\m_spac_hanging_location{#1}%
   \dowithnextboxcs\spac_hanging_around_finish\hbox}

\def\spac_hanging_around_finish
  {\scratchdistance\directhangingparameter\c!distance\relax
   \ifdim\ht\nextbox>\strutht
     \setbox\nextbox\tbox{\box\nextbox}%
   \fi
   \getboxheight\scratchdimen\of\box\nextbox
   \getnoflines\scratchdimen
   \ht\nextbox\strutht
   \dp\nextbox\strutdp
   \hangafter-\noflines
   \scratchwidth\dimexpr\wd\nextbox+\scratchdistance\relax
   \ifx\m_spac_hanging_location\v!right
     \hangindent-\scratchwidth
     \rlap{\hskip\dimexpr\hsize-\wd\nextbox\relax\box\nextbox}%
   \else
     \hangindent\scratchwidth
     \llap{\box\nextbox\hskip\scratchdistance}%
   \fi
   \ignorespaces}

i adapted the core code

    Wolfgang

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

    maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> /
    http://www.ntg.nl/mailman/listinfo/ntg-context
    webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
    archive  : http://foundry.supelec.fr/projects/contextrev/
    wiki     : http://contextgarden.net
    
___________________________________________________________________________________


Dear ConTeXt list,

I apologize for digging up an old thread. I was searching for
\starthangaround[right] and found this thread. I tried the code that
Wolfgang gave in this thread but I guess something has changed since
then, because it does not work with latest minimals. Would it be
possible to get (a working) version of \starthangaround[right]? I think
it even would be nice to have it in the core.

As a minimal nonworking example, see the email from Wolgang in this thread.

With best regards, Mikael


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

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



--

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

Reply via email to