OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: RE: [docbook-apps] term in <variablelist> is rendered incorrectly in PDF

I knew I should have double-checked the latest stylesheets!  Anyway, I'm
surprised that 0.60 even gives good enough results, but I suppose it depends
a little bit on the nature of the <term/>s.  In our case, most of our terms
are all uppercase, so I used a factor of 0.80, and even that ended up being
too short for terms with less than eight characters, so my longest.term
template takes this into account:

<xsl:template name="longest.term">
  <xsl:param name="longest" select="0"/>
  <xsl:param name="terms" select="."/>
  <xsl:param name="maxlength" select="-1"/>

    <xsl:when test="(0.8 * $longest) &gt; $maxlength and $maxlength &gt; 0">
      <xsl:value-of select="$maxlength"/>
    <xsl:when test="not($terms) and ($longest &gt; 8)">
      <xsl:value-of select="0.8 * $longest"/>
    <xsl:when test="not($terms)">
      <xsl:value-of select="$longest"/>
    <xsl:when test="string-length($terms[1]) &gt; $longest">
      <xsl:call-template name="longest.term">
        <xsl:with-param name="longest" select="string-length($terms[1])"/>
        <xsl:with-param name="maxlength" select="$maxlength"/>
        <xsl:with-param name="terms" select="$terms[position() &gt; 1]"/>
      <xsl:call-template name="longest.term">
        <xsl:with-param name="longest" select="$longest"/>
        <xsl:with-param name="maxlength" select="$maxlength"/>
        <xsl:with-param name="terms" select="$terms[position() &gt; 1]"/>

I also used a provisional-label-separation of 9pt instead of 0.25in, and
that seemed to work a little better.


> -----Original Message-----
> From: Bob Stayton [mailto:bobs@sco.com]
> Sent: Friday, September 05, 2003 11:21 AM
> To: Jeff Beal
> Cc: 'Robert P. J. Day'; docbook apps list
> Subject: Re: [docbook-apps] term in <variablelist> is rendered
> incorrectly in PDF
> On Fri, Sep 05, 2003 at 09:16:01AM -0400, Jeff Beal wrote:
> > FO listitems consist of a "label" part and a "body" part.  
> These correspond
> > directly to the <term/> and the <listitem/> in a DocBook 
> <variablelist/>.
> > FO processors determine the width of the "label" part from the
> > provisional-distance-between-starts (PDBS) and 
> provisional-label-separation
> > (PLS) attributes on the <fo:list-block/> object.
> > 
> > The PDBS specifies the distance from the start-edge (left 
> for English) of
> > the label to the start-edge of the body.  The PLS specifies 
> the distance
> > between the end-edge of the label and the start-edge of the 
> body.  Thus, the
> > width for the label part becomes PDBS - PLS.
> > 
> > The DocBook stylesheets calculate the PDBS by determining 
> the number of
> > characters in the longest term in the stylesheets and 
> specifying that many
> > 'em' units.  That is, if the longest term in your variablelist has 9
> > characters, the PDBS will be '9em'.  However, the PLS is 
> hard-coded to
> > 0.25in, so you only have 9em - .25in space for the term's 
> content.  Also,
> > there is another hard-coded value for the maximum PDBS 
> (12em), so if you
> > have a 15-character term, the PDBS will be 12em.
> > 
> > I found that the best way to deal with this was to 
> experiment.  Copy the
> > template that matches variablelist in the 'vl.as.list' mode 
> from lists.xsl
> > into your customization layer and change the maxlength 
> parameter that is
> > passed to the 'longest.term' template and the PLS value 
> until you get
> > something that looks more like what you want.
> > 
> > There is also the termlength attribute and a processing 
> instruction (<?dbfo
> > term-width="13em"?>) you can use to hard-code the term 
> width into each of
> > your variablelists.  This may be the better approach if you 
> only have one or
> > two problematic variablelists:
> Hi Jeff,
> Actually, this all changed in version 1.62.0 of the
> stylesheets.  I made the maxlength into a new parameter
> 'variablelist.max.termlength'. And I changed the way the
> term character count is converted to a length.  Using em
> was too wide, because a typical character is half an em.
> So I changed the calculation to em * 0.50, but this turns
> out to be just a little too narrow when using a monospace
> font. The em being used is the body font, and it doesn't
> know that the actual term is using an inline monospace font
> property.  So it calculates the width as too small and is
> forced into hyphenating the result.
> So I changed it in CVS to em * 0.60 and now it seems to
> work much better with monospace font inlines.
> As you say, you can always adjust a given variablelist
> with the attribute or PI.
> Bob Stayton                                 400 Encinal Street
> Publications Architect                      Santa Cruz, CA  95060
> Technical Publications                      voice: (831) 427-7796
> The SCO Group                               fax:   (831) 429-1887
>                                             email: bobs@sco.com

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]