4

我在 Ubuntu 13.04 上使用 DockBook 4.5 和 Apache FOP 1.1。Docbook 翻译由 Ubuntu 提供,FOP 直接从 Apache 下载。

第一个问题:有人能告诉我如何确保图像的标题或说明与图像对齐吗?例如:

 Figure X: YYYYYY
 +---------------+
 |               |
 |     Image     |
 |               |
 +---------------+

我知道我可以imagedata与以下内容保持一致:

<figure id="figure-xxx">
<title>YYYYY</title>

  <mediaobject>
    <imageobject>
      <imagedata align="center" fileref="xxx.png" scale="75"/>
    </imageobject>
    <caption>XXX/caption>
  </mediaobject>
</figure>

但是,align="center"会产生如下内容:

 Figure X: YYYYYY
           +---------------+
           |               |
           |     Image     |
           |               |
           +---------------+

align="right"更糟的是:

 Figure X: YYYYYY
                     +---------------+
                     |               |
                     |     Image     |
                     |               |
                     +---------------+

当我尝试将align标签添加到figuretitlemediaobjectimageobjectcaption时,我收到类似于以下内容的错误:

element figure: validity error : No declaration for attribute align of element figure

和:

element mediaobject: validity error : No declaration for attribute align of element mediaobject

也许我又做错了什么。尝试在图像周围排列文本后(Block Image Right 和 Flow Text Around It?)并将标题与图像对齐(this question)之后,我想知道 DocBook 是否可以在现实生活中处理图像。

所以我的第二个问题:有人知道 DocBook 是否支持现实生活中的图像?

编辑:对于第二个问题的答案,问题在于 Apache FOP 而不是 DocBook。

4

1 回答 1

4

我认为“Docbook 翻译”是指docbook-xsl(我认为确切的版本在这里并不重要,但它通常很重要)。

formal.title.properties您可以通过自定义属性集来解决标题对齐问题。将此添加到您的自定义层:

<xsl:attribute-set name="formal.title.properties">
 <xsl:attribute name="text-align">
  <xsl:variable name ="align">
    <xsl:value-of select=".//imagedata/@align"/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="self::figure and $align !=''">
     <xsl:value-of select="$align"/>
    </xsl:when>
   <xsl:otherwise>left</xsl:otherwise>
  </xsl:choose>
 </xsl:attribute>
</xsl:attribute-set>  

含义:如果元素align上有值 imagedata,则使用该值作为图形标题,否则使用“left”。

另见http://www.sagehill.net/docbookxsl/TitleFontSizes.html#FormalTitleProperties

于 2013-11-05T08:27:24.397 回答