Re: A few questions about converting DITA to PDF

Hussein Shafie <[email protected]> Mon, 27 May 2024 18:29:14 +0200
Newsgroups gmane.editors.xxe.general
Message-ID <[email protected]>
Z. wrote:
> 
> I have been using xe-usr-10.7 for more than one month. Overall, I like
> it because I have figured out how to customize headers and footers and
> the default PDF output mostly suits my needs. I think I made the right
> choice. However, I do have some questions:

(1), (2) and (tall image bug) are the work of the XSL-FO processor used 
to convert the XSL-FO we, XMLmind, generate to PDF.

By default, this XSL-FO processor is free, open source, Apache FOP.

If you switch to a different XSL-FO processor (e.g. commercial products 
RenderX XEP or Antenna House Formatter), the output will likely be 
different.

The only thing you can do is try to find workarounds for the 
"peculiarities" of the XSL-FO processor you use.

What follows are just *hints* to get better results for (1), (2) and 
(tall image bug).





> 
> (1) I found out that sometimes I/O is rendered with I/ on one line and
> O on the next line. Is there a way to force I/O to always stay
> together
> in the same line? 

"I/O" split between lines: sorry, no clue.




> On the other hand, sometimes I have a long symbol
> like word1_word2_word2 and I would like a line break can be added
> after _ (underline symbol). Not sure if this is possible.
> 

"word1_word2_word2" split after "_": insert a ZERO WIDTH SPACE character 
(U+200B) after each "_".

You can use the Characters tool of XMLmind XML Editor to do this. See 
attached screenshot. (XMLmind XML Editor makes the ZERO WIDTH SPACE 
visible on screen which is handy, but this character will *not* appear 
in the PDF.)




> (2) I noticed that sometimes a row in a table is split into two pages.
> Is this possible to keep a row within the same page?  If a row only
> takes
> a couple of lines, it is awkward to split them into two pages I think.
> Maybe I can add a page break to make the whole table to start in a new
> page?

Yes. Force a page break by inserting a <?pagebreak?> 
processing-instruction in the topic source between paragraphs, notes, 
tables, lists, etc.

See 
https://www.xmlmind.com/ditac/_distrib/doc/manual/webhelp/xsltParams.html#xsltParams__I_aojskl_

OR

Add attribute
keep-together.within-column="always"
to the attribute-set called "row" using the "XMLmind XSL Customizer" 
helper application.

See https://www.w3.org/TR/xsl/#keep-together

See "Options", "Customize Configuration" menu, "Customize Document 
Conversion Stylesheets" menu item, 
https://www.xmlmind.com/xmleditor/_distrib/doc/help/customizeConfigurationMenu.html




> 
> (3) I noticed that "xref href" is rendered in blue color. I wonder if
> it can be changed to use black color because I am not sure it will
> look good in
> black-write printing.

This one is easy. Please use the "XMLmind XSL Customizer" helper 
application to change the color of the attribute-set called 
"link-style". See attached screenshot.

See "Options", "Customize Configuration" menu, "Customize Document 
Conversion Stylesheets" menu item, 
https://www.xmlmind.com/xmleditor/_distrib/doc/help/customizeConfigurationMenu.html

Alternatively add attribute color = #000000 to a attribute-set "xref" 
which "inherits" from attribute-set "link-style".

=========================================================================
The question here is how to determine which attribute-set to modify 
using  the "XMLmind XSL Customizer" helper application?

Answer: there is no other way than looking at the XSL code found in 
XXE_INSTALL_DIR/addon/config/dita/xsl/fo/

For example, XXE_INSTALL_DIR/addon/config/dita/xsl/fo/body.xsl
---
    <!-- xref 
============================================================== -->

    <xsl:attribute-set name="xref" use-attribute-sets="link-style">
    </xsl:attribute-set>

    <xsl:template match="*[contains(@class,' topic/xref ')]">
      <xsl:choose>
        <xsl:when test="@type eq 'fn'">
        ...
---
=========================================================================




> 
> (4) My book has three volumes. Is it possible to make the first
> chapter in the second and third volumes to start from a number other
> than
> one?
> 

Sorry, I cannot help you here. Changing the way the PDF is paginated is 
quite complex.

You may want to take a look at 
XXE_INSTALL_DIR/addon/config/dita/xsl/fo/pagination.xsl





> Finally, I think I encountered a bug. I use ditamap and dita files.
> One dita file has the following layout:
> 
> paragraph A
> paragraph B
> figure X in PNG format.
> 
> The PNG file takes one full page. There is more than enough space in
> the page that contains paragraph A. And paragraph
> B has only one sentence. But the final PDF puts paragraph B in its own
> page that only contains two lines of text. To "fix" this,
> I can move paragraph B to the end of paragraph A to make them one paragraph.
> 
> My dita file looks like this:
> 
>      <topic id="xxxxxxxxxxxxxxxxxxxx">
>        <title>xxxxxxxxxxxxxxxxxxxx</title>
> 
>        <body>
>          <p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:</p>
> 
>          <ol>
>            <li><p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>            xxxxx.</p></li>
> 
>            <li><p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</p></li>
>          </ol>
> 
>          <p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</p>
> 
>          <-- I have plenty of space in this page
> 
>          <p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</p>
> 
>          <-- The above takes one page.
> 
>          <fig id="figure-xxxx">
>            <title>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</title>
> 
>            <image href="xxxxxxx.png"/>
> 
>          <-- a large PNG takes one page
>          </fig>
> 
>          <p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:</p>
> 
>      ...
>      </topic>

May be forcing a page break would help here too.

See the <?pagebreak?> processing-instruction in 
https://www.xmlmind.com/ditac/_distrib/doc/manual/webhelp/xsltParams.html#xsltParams__I_aojskl_





> 
> Any suggestions, advice, and leads are appreciated. I am totally new
> to DITA publishing, but I do have a programming background,
> so I can learn to edit those .xsl files if necessary.


--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
Characters_Tool.png (image/png, 183.7 KB) - not displayed
Modify_link-style_attribute_set.png (image/png, 359.5 KB) - not displayed