ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \hangindent and R2L alignment
Date: Wed, 23 Sep 2015 23:15:38 +0200	[thread overview]
Message-ID: <5603167A.9080302@wxs.nl> (raw)
In-Reply-To: <5603087F.5040000@gmail.com>

On 9/23/2015 10:15 PM, Wolfgang Schuster wrote:
> Hi,
>
> there was a question on the Stackexchange site [*] with a problem
> for the \starthanging environment when the alignment is R2L.

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

(maybe the content of the hang blob will becoem l2r)

> Here is shortened version of the example:
>
> %%%% begin example
> \useMPlibrary[dum]
>
> \starttext
>
> \starthanging[location=left]{\externalfigure[dummy][width=4cm,height=3\lineheight]}
>
> \input tufte
> \stophanging
>
> \blank
>
> \startalignment[righttoleft]
> \starthanging[location=left]{\externalfigure[dummy][width=4cm,height=3\lineheight]}
>
>      \input tufte
>      \stophanging
> \stopalignment
>
> \stoptext
> %%%% end example
>
>
> The problem is that \hangindent behaves the same for L2R and R2L
> alignment unlike
> the other formatting commands (\hangindent or \leftskip) for paragraphs.
>
> %%%% begin example
> \showframe[text][text]
>
> \setuphead
>    [subject]
>    [align=lefttoright,
>     indentnext=yes]
>
> \starttext
>
> \startbuffer
>
> \subject{Normal paragraph}
>
> \input ward
>
> \subject{Leftskip}
>
> \start
>      \leftskip 4em
>      \input ward\par
> \stop
>
> \subject{Parindent}
>
> \start
>
>      \parindent 4em
>      \input ward\par
>
> \stop
>
> \subject{Hangindent}
>
> \start
>      \hangindent 4em
>      \hangafter -2
>      \input ward\par
> \stop
>
> \stopbuffer
>
> \title{Left to right}
>
> \startalignment[lefttoright]
> \getbuffer
> \stopalignment
>
> \title{Right to left}
>
> \startalignment[righttoleft]
> \getbuffer
> \stopalignment
>
> \stoptext
> %%%% end example
>
>
> [*]
> http://tex.stackexchange.com/questions/268688/correct-inconsistent-image-placement-across-direction-boundaries-in-context
>
>
> Wolfgang
> ___________________________________________________________________________________
>
> 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	other threads:[~2015-09-23 21:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 20:15 Wolfgang Schuster
2015-09-23 21:15 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5603167A.9080302@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).