Next in thread → Next in month →

Re: [docbook-apps] Formatting numbers in List of Figures

From
"Cob Rtayton"
Date
2009-03-07T08:30:45+00:00
ID
005701c99efe$fdde0ec0$6400a8c0@pazu
Thread
Re: [docbook-apps] Formatting numbers in List of Figures
Using spaces for alignment is only accurate with a 
monospace font. You'll find that "10." will not line up with "20."  To get 
a true alignment, you would need to use an fo:table with two columns and 
text-align="end" in the first column, or an fo:list-block with text-align="end" 
in the fo:list-item-label. Each toc line can be in its own fo:list-block as 
long as the provisional-distance-between-starts property is consistent across 
them.  To get you started, there is an example of fo:list-block in my 
book:

 

http://www.sagehill.net/docbookxsl/SideBySide.html

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  Mathias Schindler 

  
To:  
  

  
Sent: Thursday, March 05, 2009 2:18 
  AM

  
Subject: [docbook-apps] Formatting 
  numbers in List of Figures

  

  

  
Hello!

  
 

  
I use a figure list in my document, but 
  there’s one small thing that annoys me. The alignment of the separator is 
  wrong.

  
 

  
That’s how it looks right 
  now:

  
8. Data access 
  ........................................................................................................ 
  24

  
9. Overview of the 
  front-end componenents and their dependencies ...................................... 
  25

  
10. The 
  model-view-controller pattern of the default statistics module ................................... 
  27

  
 

  
That’s how it 
  should look:

  
  8. Data 
  access ........................................................................................................ 
  24

  
  9. Overview 
  of the front-end componenents and their dependencies ...................................... 
  25

  
10. The 
  model-view-controller pattern of the default statistics module ................................... 
  27

  
 

  
I customized the toc.line template like 
  this(only the part where the number gets formatted)

  
 

  
<fo:basic-link 
  internal-destination="{$id}">

  
<xsl:if test="$label != 
  ''">

  
<xsl:if test="$label &lt; 
  '10'">

  
<fo:inline 
  color="#FFFFFF"><xsl:text>_</xsl:text></fo:inline>

  
                
  <xsl:copy-of select="$label"/>       
  

  
                
  <xsl:value-of select="$autotoc.label.separator"/>

  
          
  </xsl:if>

  
                
    

  
          
  <xsl:if test="$label &gt; '9'">

  
          
       <xsl:copy-of 
  select="$label"/>       

  
          
       <xsl:value-of 
  select="$autotoc.label.separator"/>

  
          
  </xsl:if>

  
                
    

  
     
  </xsl:if>

  
 

  
<xsl:apply-templates select="." 
  mode="title.markup"/>

  
</fo:basic-link>

  
 

  
This works, but I’m sure there must be a 
  better solution J.

  
 

  
Thanks in advance,

  
 

  
Mathias
Next in thread → Next in month →