【问题】
docbook中,已经实现了正常的pdf输出,其中有等式equation,但是很不好看,没有特殊效果,比如背景色,边框等:
所以想要给等式添加背景色等。
【解决过程】
1.去:DocBook XSL Stylesheets: Reference Documentation –> 2. FO Parameter Reference
中找,看看是否有和equation相关的参数。
找到了一个:
equation.properties — Properties associated with a equation
所以就去把示例代码:
1 | < xsl:attribute-set name = "equation.properties" use-attribute-sets = "formal.object.properties" ></ xsl:attribute-set > |
添加到自己的xsl配置文件docbook_crl.xsl中去。
但是输出的pdf中,还是没效果。
2.后来经过调试,参考了:
Subject: Re: [docbook] equation border and background color
和
PDF reference handbook for your java source documentation
添加了如下代码:
1 2 3 4 5 6 7 8 9 10 11 | <!-- ================= equation setting ================= --> <!-- <xsl:attribute-set name="equation.properties" use-attribute-sets="formal.object.properties"></xsl:attribute-set> --> < xsl:attribute-set name = "equation.properties" use-attribute-sets = "formal.object.properties" > <!-- http://www.dpawson.co.uk/docbook/styling/params.html#d2221e282 --> <!-- <xsl:attribute name="border-color">thin black ridge</xsl:attribute> --> < xsl:attribute name = "border-style" >solid</ xsl:attribute > <!-- <xsl:attribute name="border-width">.1mm</xsl:attribute> --> < xsl:attribute name = "border-width" >0.5pt</ xsl:attribute > < xsl:attribute name = "background-color" >silver</ xsl:attribute > </ xsl:attribute-set > |
然后就可以了,效果如下:
【总结】
想要给pdf中equation添加背景色,还是去2. FO Parameter Reference找到对应参数equation.properties,然后设置对应的值,即可。
1 2 3 4 5 | < xsl:attribute-set name = "equation.properties" use-attribute-sets = "formal.object.properties" > < xsl:attribute name = "border-style" >solid</ xsl:attribute > < xsl:attribute name = "border-width" >0.5pt</ xsl:attribute > < xsl:attribute name = "background-color" >silver</ xsl:attribute > </ xsl:attribute-set > |