TOC formatting

View: New views
3 Messages — Rating Filter:   Alert me  

TOC formatting

by Tobias Anstett [k15t.com] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

is there a way to modify the toc templates to e.g. making every major
one heading bold and have a padding or margin like this

1. This is a major one heading (BOLD font-weight)
1.1 ... (NORMAL font-weight)
1.2 ... (NORMAL font-weight)
Padding / Margin / Spacing
2. This is a major two heading (BOLD font-weight)
2.1 ... (NORMAL font-weight)
...

I already searched the documentation and the xsl source, but haven't
found a real entry point in the toc.xsl.

Any ideads or suggestions?

Cheers,
Tobias

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: TOC formatting

by Thomas Schraitle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobias,

Sunday 30 August 2009
>
> is there a way to modify the toc templates to e.g. making every major
> one heading bold and have a padding or margin like this
>
> 1. This is a major one heading (BOLD font-weight)

I assume, you mean a title in chapter, appendix, or preface?


> 1.1 ... (NORMAL font-weight)
> 1.2 ... (NORMAL font-weight)
> Padding / Margin / Spacing
> 2. This is a major two heading (BOLD font-weight)
> 2.1 ... (NORMAL font-weight)
> ...
>
> I already searched the documentation and the xsl source, but haven't
> found a real entry point in the toc.xsl.
>
> Any ideads or suggestions?

I think, you can use one of the two methods, depending on how easy it should
be or how much detail you need:

 1. Customize the attribute set "toc.line.properties".
 2. Customize the named template "toc.line".

The first one is easier to use. Use the following code to distinguish between
a chapter and something else. Of course, you can add appendix, glossary, etc.
too, to cover these headings:

 <xsl:attribute-set name="toc.line.properties">
   <xsl:attribute name="font-weight">
     <xsl:choose>
       <!-- Add more xsl:whens or "or"s to cover appendix, preface, etc. -->
       <xsl:when test="self::chapter">bold</xsl:when>
       <xsl:otherwise>normal</xsl:otherwise>
     </xsl:choose>
   </xsl:attribute>
 </xsl:attribute-set>

The second one is a bit more elaborate, but gives you more freedom. Copy the
"toc.line" template from fo/autotoc.xsl into your customization layer and
adapt it to your needs. You can use the above xsl:choose to distinguish
between your different headings and add your spacing/margins/ ...

More information about the latter method can be found here:

http://www.sagehill.net/docbookxsl/TOCcontrol.html#TOClook


Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: TOC formatting

by Tobias Anstett [k15t.com] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tom,

I modified the toc.line template. Thanks for your help :)

Cheers,
Tobias

On Sun, Aug 30, 2009 at 1:39 PM, Thomas Schraitle<tom_schr@...> wrote:

> Hi Tobias,
>
> Sunday 30 August 2009
>>
>> is there a way to modify the toc templates to e.g. making every major
>> one heading bold and have a padding or margin like this
>>
>> 1. This is a major one heading (BOLD font-weight)
>
> I assume, you mean a title in chapter, appendix, or preface?
>
>
>> 1.1 ... (NORMAL font-weight)
>> 1.2 ... (NORMAL font-weight)
>> Padding / Margin / Spacing
>> 2. This is a major two heading (BOLD font-weight)
>> 2.1 ... (NORMAL font-weight)
>> ...
>>
>> I already searched the documentation and the xsl source, but haven't
>> found a real entry point in the toc.xsl.
>>
>> Any ideads or suggestions?
>
> I think, you can use one of the two methods, depending on how easy it should
> be or how much detail you need:
>
>  1. Customize the attribute set "toc.line.properties".
>  2. Customize the named template "toc.line".
>
> The first one is easier to use. Use the following code to distinguish between
> a chapter and something else. Of course, you can add appendix, glossary, etc.
> too, to cover these headings:
>
>  <xsl:attribute-set name="toc.line.properties">
>   <xsl:attribute name="font-weight">
>     <xsl:choose>
>       <!-- Add more xsl:whens or "or"s to cover appendix, preface, etc. -->
>       <xsl:when test="self::chapter">bold</xsl:when>
>       <xsl:otherwise>normal</xsl:otherwise>
>     </xsl:choose>
>   </xsl:attribute>
>  </xsl:attribute-set>
>
> The second one is a bit more elaborate, but gives you more freedom. Copy the
> "toc.line" template from fo/autotoc.xsl into your customization layer and
> adapt it to your needs. You can use the above xsl:choose to distinguish
> between your different headings and add your spacing/margins/ ...
>
> More information about the latter method can be found here:
>
> http://www.sagehill.net/docbookxsl/TOCcontrol.html#TOClook
>
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
> For additional commands, e-mail: docbook-apps-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...