This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
RE: [docbook-apps] term in <variablelist> is rendered incorrectly in PDF
- From: Jeff Beal <jeff dot beal at ansys dot com>
- To: 'Bob Stayton' <bobs at sco dot com>, Jeff Beal <jeff dot beal at ansys dot com>
- Cc: "'Robert P. J. Day'" <rpjday at mindspring dot com>, docbook apps list <docbook-apps at lists dot oasis-open dot org>
- Date: Fri, 5 Sep 2003 13:35:14 -0400
- 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:choose>
<xsl:when test="(0.8 * $longest) > $maxlength and $maxlength > 0">
<xsl:value-of select="$maxlength"/>
</xsl:when>
<xsl:when test="not($terms) and ($longest > 8)">
<xsl:value-of select="0.8 * $longest"/>
</xsl:when>
<xsl:when test="not($terms)">
<xsl:value-of select="$longest"/>
</xsl:when>
<xsl:when test="string-length($terms[1]) > $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() > 1]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<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() > 1]"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
I also used a provisional-label-separation of 9pt instead of 0.25in, and
that seemed to work a little better.
Jeff
> -----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
>
>
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org.