## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Condense Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

On 08/07/2016 18:32, Javier Bezos wrote:
> I'm working on basic support (very basic) for bidi text and
> I'm facing a problem with \list because it relies on \parshape.
> I copy a message I sent to the luatex list:
>
> -----------------------------
> sure. The problem is \parshape is used for two different
> purposes: (a) fancy paragraphs (a heart, the map of The
> Netherlands, wrapping some text around a figure, etc.);
> (b) an alternative to \left/rightskip and \parindent.
> While mirroring the latter makes sense, mirroring
> The Netherlands seems a bit odd. I wonder if an
> alternative could be \parshape dir XXX, like boxes.
> ----------------------------
>
> I'd like not to touch the core at all (until now I've
> managed to do it), and on the other hand many packages
> emulate what LaTeX does. Suggestions?
>
> Javier
>

For context, that was dev-luatex list not the main luatex list at tug

https://mailman.ntg.nl/pipermail/dev-luatex/2016-July/005769.html

I'd have thought that your example isn't convincing, and that parshape
should always follow the writing direction. Even if the shape is a map
of the Netherlands if writing left to right or right to left, specifying
a sequence of starting points and line lengths would seem reasonable,
although of course the actual numbers would be different depending on
whether you are specifying offsets from the left or right.

even if luatex's primitive \parshape doesn't get a flag, you could
define it in lua, I put at the end an \xparshape that uses indents from
the other side (if I got it right) with a bit more care you could
overload both definitions onto the \parshape csname and query internally
the current direction to use whichever form you need. It should also
print using a fixed catcode, but not this evening:-) Actually it could
probably set the paragraph shape from lua rather than writing out a tex
\parshape, I'd need to check...

David

David

\parindent=0pt
\hsize 11cm
%\outputmode=1 % No difference with 0

\let\oldparshape\parshape
\def\xparshape{\directlua{%
local n = token.scan_int()
print('\string\nn: ' .. n)
local lngth = {}
local indx = {}
for i = 1,n do
indx[i]=token.scan_dimen()
lngth[i]=token.scan_dimen()
end
tex.print('\string\\oldparshape ')
tex.print( n .. ' ')
for i = 1,n do
tex.print((tex.hsize - lngth[i] - indx[i]) .. 'sp ')
tex.print(lngth[i] .. 'sp ')
end
}}

00Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod
tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex
ea commodi consequat.

{\leftskip1cm
LLLLorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod
tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex
ea commodi consequat.\par}

{\parshape 2 0cm 10cm 1cm 10cm
PPPLorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod
tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex
ea commodi consequat.\par}

{\xparshape 2 0cm 10cm 1cm 10cm
XXXLorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod
tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex
ea commodi consequat.\par}

\bye

________________________________

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:

Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Microsoft Office 365.

________________________________