RE: [xep-support] Marginalia as a DocBook customisation

From: Victor Mote (vic@portagepub.com)
Date: Thu May 06 2004 - 19:05:29 PDT

  • Next message: Alexander Peshkov: "Re: [xep-support] dont use the resolution of an image"

    Paul A. Hoadley wrote:

    > Here's my first shot. This is in the 'user.pagemasters'
    > template (I'm pasting in more than I need for this problem,
    > as it's already customised to put some static content in
    > region-start and region-end, so some of the changes from the
    > stock stylesheets are due to that):

    I am not familiar with the DocBook stylesheets, but have been wrestling with
    marginalia issues myself today. I'll try to help a bit, then I want to add a
    new wrinkle.
     
    > ---
    > <fo:simple-page-master master-name="body-first-cms"
    > page-width="{$page.width}"
    > page-height="{$page.height}"
    > margin-top="{$page.margin.top}"
    > margin-bottom="{$page.margin.bottom}"
    > margin-left="0pt"
    > margin-right="0pt">
    > <fo:region-body margin-bottom="{$body.margin.bottom}"
    > margin-top="{$body.margin.top}"
    > column-gap="{$column.gap.body}"
    > column-count="{$column.count.body}"
    > padding-left="{$page.margin.inner}"
    > margin-right="{$page.margin.outer}">
    > </fo:region-body>
    > <fo:region-before region-name="xsl-region-before-first"
    > extent="{$region.before.extent}"
    > display-align="before"
    > padding-left="{$page.margin.inner}"/>
    > <fo:region-after region-name="xsl-region-after-first"
    > extent="{$region.after.extent}"
    > display-align="after"
    > padding-left="{$page.margin.inner}"/>
    > <fo:region-start region-name="xsl-region-start-first"
    > extent="0pt"/>
    > <fo:region-end region-name="xsl-region-end-first"
    > extent="{$page.margin.outer}"/>
    > </fo:simple-page-master>
    > ---
    >
    > I want the notes to float on the inside, so I've made
    > margin-left on body-first-cms 0pt. (Once I've got body-first
    > going, the other page types should follow easily.)
    > margin-right is 0pt because of my custom region-end. I've
    > then added the padding-left in region-body (and region-before
    > and region-after) to allow for the zero margin. These
    > changes don't seem to have introduced any problems. Running
    > some DocBook source through this produces a PDF
    > indistinguishable (AFAICS) from the normal stylesheets.

    The essence of the solution documented at the xep/xattic web site
    (previously mentioned in this thread) is:
    1. to decrease the margin (i.e. increase the size of the area) on the side
    opposite from the desired location of the marginalia, so, in your case, the
    outside. So your setting of margin-right="0pt" probably needs to be
    something like margin-right="-100pt" (for example). (I am assuming you are
    starting on a recto page. Mine need to start on either recto or verso, so I
    made a "first-right" and "first-left" page-master). Don't worry that you are
    eating into your region-end, because you are going to get that back in the
    next step. (This step is done on the region-body).
    2. to increase the start-indent and end-indent by the same amount that you
    decreased the margin above. One or the other of these gives you back the
    space you took in step 1. The other makes room for your marginalia. (This
    step is done on the flow). So in essence, you expand one side, then reduce
    both. It is necessary to do it this way because (with but a few exceptions)
    XSL-FO doesn't think much about recto and verso, but the one place it does
    is in setting up the page-masters. So, "two wrongs makes a right" on the
    side we don't care about, allowing us to get the adjustment made on the
    other.

    > My note template is not quite right:
    >
    > ---
    > <xsl:template match="note[@role='marginalia']">
    > <fo:float float="inside"
    > clear="both">
    > <fo:block-container width="20mm" start-indent="-25mm">
    > <fo:block>
    > <xsl:apply-templates/>
    > </fo:block>
    > </fo:block-container>
    > </fo:float>
    > </xsl:template>
    > ---

    The negative on start-indent is probably not what you want. Instead, set the
    start-indent and end-indent values to 0 on the float itself. This will
    override the positive values that you set in step two above on the flow,
    allowing it to occupy the space that we have reserved for it. (The key
    concept here is that margins are not inheritable, while indents *are*
    inheritable).

    > I will admit that I have reached the current limit of my FO
    > expertise---I was really just cutting, pasting and guessing
    > with the start-indent there. That certainly gets a note in
    > the inner margin of the first page, but the left margin is
    > way off the left edge of the page. I can't specify the
    > margin-left, because this block will be on a different side
    > depending on the page number. (Maybe I _should_ move this to
    > docbook-apps, as it's probably difficult to help me without
    > knowing the DocBook stylesheets.)

    I think it is useful here as long as you tell us the values of the
    parameters that are being passed in.

    OK. I have mine working, with one seemingly intractable problem: I have
    footnotes and marginalia on the same page. Specifically, the process
    described above leaves a blank area corresponding to the marginalia in the
    footnotes. The desired result is that the footnotes should use the entire
    inline-progression-dimension that the body text and marginalia use. IOW, it
    should intrude into the marginalia part of the page rather than the
    marginalia intruding into the footnote area.

    I have concluded that this cannot be done within XSL-FO (including in the
    1.1 proposal). I would be glad for someone to persuade me otherwise. If not,
    I propose that an extension be considered that would (I think) handle this
    situation pretty elegantly. If the concepts of start-indent and end-indent
    were to be expanded to inside-indent and outside-indent, with the latter 2
    being mapped internally to one or the other of the former 2, one could
    "undo" the effects of the marginalia adjustments within footnotes. Since XEP
    already supports similar concepts in text-align and text-align-last, I even
    have hopes that it might be a relatively trivial change. (I know that
    nothing is trivial, but I am trying to be optimistic). Or perhaps someone
    has already solved this in a way I haven't thought of.

    Thanks very much.

    Victor Mote

    -------------------
    (*) 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/tos.html



    This archive was generated by hypermail 2.1.5 : Thu May 06 2004 - 19:20:50 PDT