XSL FO Docbook 内容左边距

7

我正在使用Docbook 5(docbook-xsl-ns),使用Apache FOP生成PDF,我想把所有文本移到左边。

我该怎么做?

源XML如下:

<section>
        <title>Usage</title>
        <programlisting>mvn archetype:generate -DarchetypeGroupId=cz.csob.javor -DarchetypeArtifactId=javor-archetypes-subcomponent -DarchetypeVersion=X.Y.Z</programlisting>
        <para>During the subcomponent project generation you will be asked for the following properties:</para>
        <itemizedlist>
            <listitem>
                <para><emphasis>parent-component-id</emphasis> - ID of the parent component, should be the name of the directory the parent component project is placed in</para>
            </listitem>
            <listitem>...

谢谢。

输入图像描述

感谢。

1
大多数 DocBook 中的元素外观都在 docbook/fo 样式表中的 "param.xsl" 文件中进行控制。检查它,找到需要更改的内容并进行更改。 - Kevin Brown
@Xdg - 你找到解决方案了吗? - Viacheslav Molokov
1个回答

8

通过body.start.indent参数添加段落缩进。

您应该使用度量值来设置此参数的值,因为它在其他XSLT模板中用于计算。例如,下一行将完全删除段落缩进:

<xsl:param name="body.start.indent">0pt</xsl:param>

所有的XSLT定制层应该像这样:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0">
    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
    <xsl:param name="body.start.indent">0pt</xsl:param>
</xsl:stylesheet>

本主题的参考文档

还可以使用其他缩进选项:

  • page.margin.inner - 左侧页面边距
  • page.margin.outer - 右侧页面边距

顶部和底部边距(来自文档)

例如,下面的参数将使此页面布局 3

<xsl:param name="page.margin.inner">20mm</xsl:param>
<xsl:param name="page.margin.outer">10mm</xsl:param>
<xsl:param name="page.margin.top">12.5mm</xsl:param>
<xsl:param name="page.margin.bottom">15mm</xsl:param>

<xsl:param name="region.before.extent">10mm</xsl:param>
<xsl:param name="region.after.extent">5mm</xsl:param>

<xsl:param name="body.margin.top">15mm</xsl:param>
<xsl:param name="body.margin.bottom">15mm</xsl:param>

Resulting page layout


感谢 @Viacheslav。它对正文左边缘做得很好。那么对于正文右边缘我们使用什么呢?没有 body.stop.indent。(我的问题似乎是,我不知道这些东西叫什么。body.margin.leftbody.margin.right 看起来最直观,但是它们是错误的。) - jww
1
你可以使用以下代码:20毫米 10毫米 - Viacheslav Molokov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接