Subject: Re: [docbook-apps] Wide verbatim shading overflowing into right margin in PDF
Hi Mark,The DocBook schema does not include a pgwide attribute on programlisting. DocBook 5.0 allows it on example, equation, figure, informalfigure, table, and informaltable. Recogizing the inconsistency there, DocBook 5.1 will add informalexample and informalequation.
The stylesheets have long supported the <?dbfo pgwide="1"?> processing instruction for some elements, but it is not universally recognized in all elements. I've found the best solution for programlisting is to use this markup:
<informalexample> <?dbfo pgwide="1"?> <programlisting>Wide listing that needs full-page width ... (see http://www.sagehill.net/docbookxsl/FittingText.html#FullWidthExamples). Bob Stayton Sagehill Enterprises email@example.com From: Mark Craig Sent: Friday, July 12, 2013 4:12 AM To: Bob Stayton Cc: DocBook AppsSubject: Re: [docbook-apps] Wide verbatim shading overflowing into right margin in PDF
Thanks Bob,I see now that it's documented, http://docbook.sourceforge.net/release/xsl/1.76.1/doc/fo/monospace.verbatim.font.width.html, and also that I can reach a sort of compromise with this. Maybe forcing width, if specified, to some known value that will force alignment with the right margin.
If writers want the stylesheets to treat wide programlisting elements like wide tables, in the style of pgwide="1", how should they go about it?
There doesn't seem to be a pgwide attribute on programlisting. Even in the current docs <?dbfo pgwide?> looks like it applies only to equation and example.
Regards, Mark On Jul 11, 2013, at 7:09 PM, Bob Stayton wrote: Hi Mark,That shading is the background color of the fo:block-container that contains a programlisting with width. The width of the block-container is computed as follows:
@width * $monospace.verbatim.font.widthwhere $monospace.verbatim.font.width is one of the DocBook parameters, whose default value is 0.60em. You can adjust either the width or the param to get a narrower box.
Bob Stayton Sagehill Enterprises firstname.lastname@example.org From: Mark Craig Sent: Thursday, July 11, 2013 8:59 AM To: DocBook AppsSubject: [docbook-apps] Wide verbatim shading overflowing into right margin in PDF
Hello,What is the correct way to avoid wide verbatim shading from overflowing into the right margin in PDF?
In the attached .png, the "CVS program listing" example has width="92". I'd like to stop the shading at the right margin, just as it starts at the left. Instead the shading runs to the right edge of the page.
<missing-right-margin.png> The build uses the v1.76.1 stylesheets with the following customization: <xsl:param name="shade.verbatim" select="1"/> <xsl:attribute-set name="shade.verbatim.style"> <xsl:attribute name="background-color">#d4d4d4</xsl:attribute> <xsl:attribute name="border">0.5pt dashed #626d75</xsl:attribute> <xsl:attribute name="padding">3pt</xsl:attribute> <xsl:attribute name="wrap-option">no-wrap</xsl:attribute> <xsl:attribute name="font-size">0.75em</xsl:attribute> </xsl:attribute-set> Thanks for your advice. Regards,Mark