Re: [xep-support] Different text alignment in one block

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Wed Sep 01 2010 - 12:39:48 PDT

At 2010-09-01 21:06 +0200, Bastian Kroll wrote:
>I´ve a problem with text-blocks and different
>alignments in this block - often different alignments in one line.
>Quick description of my problem:
>I´ve got a block-container and in there is a block.
>In this block there is/are one/some inline
>elements. The block is set to
>text-align="justify" text-align-last="left". So
>far, so good. BUT: in the last line, there have
>to be a additional inline-element that have to
>be aligned right!! And if there is no space for
>this last inline-element in the last line, this
>last element have to be moved to the next line.
>So the line before is aligned left, the last
>(with this last inline-element) aligned right.
>Is there a solution in XEP (XSL-FO) to solve this?

Certainly there is an easy solution in XSL-FO ...
I use the following technique in the student list
of the name tents for the students of my XSLT,
XQuery and XSL-FO classes, which applied in your
situation would look like the following:

   <block text-align="justify" text-align-last="justify">
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah<leader leader-length.minimum="0pt"
keep-with-previous="always"/><leader
leader-length.minimum="0pt" keep-with-next="always"/>Author
   </block>

When I do this on my name tents I start with:

   <block text-align="justify" text-align-last="justify">
   name<leader leader-length.minimum="0pt"
keep-with-previous="always"/><leader
leader-length.minimum="0pt" keep-with-next="always"/>address
   </block>

And to force the breaks (as I think you will have
to do with the author value but not the paragraph text), I refine this to:

   <block text-align="justify" text-align-last="justify">
   <inline
keep-together.within-line="always">name</inline><leader
leader-length.minimum="0pt"
keep-with-previous="always"/><leader
leader-length.minimum="0pt"
keep-with-next="always"/><inline
keep-together.within-line="always">address</inline>
   </block>

And I see:

   John Smith Sydney, Australia
   Jane Doe
        New Westminister, Canada
   Jim Jones London, England

If I make the two leaders visible for you, using
"-" for the first one and "_" for the second one, the lines look like this:

   John Smith-_Sydney, Australia
   Jane Doe---------------------
   _____New Westminister, Canada
   Jim Jones---__London, England

I see your problem as simply a version of the
above problem, so I think this will work for you.

It is based on the principle that a leader grows
on a justified line as long as it can, and in
sync with other leaders on the line, until the
line is full, and before any spaces are expanded for justification.

So, in all, your solution would look like:

   <block text-align="justify" text-align-last="justify">
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah blah blah blah blah blah blah blah blah blah blah blah
   blah<leader leader-length.minimum="0pt"
keep-with-previous="always"/><leader
leader-length.minimum="0pt"
keep-with-next="always"/><inline
keep-together.within-line="always">Author</inline>
   </block>

I hope this helps. This is covered in my class
on XSL-FO, and those readers of the archive who
have my XSL-FO book, this is illustrated in the
figure on page 167 of the Seventh Edition.

. . . . . . . . . . . . . .Ken

--
XSLT/XQuery training:   after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/f/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/f/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html
Received on Wed Sep 1 12:54:45 2010

This archive was generated by hypermail 2.1.8 : Wed Sep 01 2010 - 12:54:46 PDT