Page 1 of 1
Line break inside <mainbooktitle> element
Posted: Mon Nov 02, 2015 6:51 pm
by BogdanM777
Hi Guys,
I would have a question regarding the <mainbooktitle> element.
Is it possible to have a line break inside this element? That means, if I would like to have the title on two lines, e.g.
<mainbooktitle>Line 1 Line 2</mainbooktitle>
what should I insert between the Line 1 & Line 2?
Till now I managed to do that using a blank image, however I imagine that this is not quite professional, right?
So, I was wondering if DITA has any solution to this type of situation.
Thank you very much,
Bogdan
Re: Line break inside <mainbooktitle> element
Posted: Mon Nov 02, 2015 6:57 pm
by BogdanM777
I tried to use the solution offered by you in this article:
https://www.oxygenxml.com/dita/stylegui ... itles.html
However the space between the lines is way too big, so I was wondering if there would be another solution.
Also, right now, in the title, using the 1 pixel/1 pixel image solution, the two lines are not aligned perfectly to the right hand side, so I was wondering what would be a solution to that as well.
Thank you very much
Re: Line break inside <mainbooktitle> element
Posted: Wed Nov 04, 2015 10:56 am
by bogdan_cercelaru
Hello,
Unfortunately, DITA does not offer any solution to this type of situation. However, the following procedure offer you a workaround to obtain a line break using a customization directory for PDF transformation.
- Copy the entire directory: DITA_OT_DIR\plugins\org.dita.pdf2\Customization to another location (for instance, C:\Customization).
- Rename C:\Customization\catalog.xml.orig to: C:\Customization\catalog.xml.
- Open the catalog.xml in Oxygen XML Editor and uncomment this line:
Code: Select all
<!--uri name="cfg:fo/attrs/custom.xsl" uri="fo/xsl/custom.xsl"/-->
So now it looks like this:
Code: Select all
<uri name="cfg:fo/attrs/custom.xsl" uri="fo/xsl/custom.xsl"/>
- Rename the file: C:\Customization\fo\xsl\custom.xsl.orig to: C:\Customization\fo\xsl\custom.xsl
- Open the custom.xsl file in Oxygen XML Editor and add the following template:
Code: Select all
<xsl:template match="processing-instruction('linebreak')">
<fo:block/>
</xsl:template>
. Now, custom.xsl has the following content:
Code: Select all
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="2.0">
<xsl:template match="processing-instruction('linebreak')">
<fo:block/>
</xsl:template>
</xsl:stylesheet>
- Edit the DITA Map to PDF transformation scenario and in the Parameters tab, set the customization.dir parameter to C:\Customization.
- Now you can use the following PI to insert a new line
You can find more information regarding PDF customization in our user-guide:
Customizing DITA Transformations / DITA to PDF Output Customization / Creating a Customization Directory for PDF Output
Regards,
Bogdan
Re: Line break inside <mainbooktitle> element
Posted: Wed Nov 04, 2015 4:54 pm
by BogdanM777
Hi Bogdan,
I followed your instructions and I inserted in the <mainbooktitle> something like:
<mainbooktitle>Title part 1<?linebreak?>part 2</mainbooktitle>
When I ran the custom PDF transformation, I got the error message:
Description: I/O error reported by XML parser processing file:/D:/Customization/fo/attrs/custom.xsl: D:\Customization\fo\attrs\custom.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\Customization\fo\attrs\custom.xsl (The system cannot find the file specified)
So I went into the specified directory and changed the name of the file from custom.xml.orig to custom.xml, and I ran the transformation again, however the pdf I obtained did not have any line break between the Title part 1 and part 2.
Did I do something wrong?
Thank you
Re: Line break inside <mainbooktitle> element
Posted: Wed Nov 04, 2015 5:46 pm
by bogdan_cercelaru
Hi,
Sorry, my mistake. Step 3 in my previous message should have been:
- Open the catalog.xml in Oxygen XML Editor and uncomment this line:
Code: Select all
<!--uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/-->
So now it looks like this:
Code: Select all
<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>
Regards,
Bogdan
Re: Line break inside <mainbooktitle> element
Posted: Wed Nov 04, 2015 6:02 pm
by BogdanM777
Thank you Bogdan!
Now it works "licking the button"!
Have a great day!
Re: Line break inside <mainbooktitle> element
Posted: Wed May 10, 2017 8:45 am
by rgmetap
I have something similar to that , but I am using ditamap.
I want to give line break in<map><title>something<sub>hello</sub></title></map>on <sub> element in frontmatter. How can I achieve this? Now it is showing in same line.
Re: Line break inside <mainbooktitle> element
Posted: Thu May 11, 2017 12:27 pm
by ionela
Hi,
An alternative to achieve this is to convert your DITA
map to a
bookmap.Then, for a
bookmap you can insert a
booktitle element. The
booktitle element contains the title information such as
<mainbooktitle> and
<booktitlealt>. This way you can have the two titles each for them shown on a different line in the PDF output.
https://www.oxygenxml.com/dita/1.3/spec ... okmap.html
https://www.oxygenxml.com/dita/1.3/spec ... lealt.html
You can check this structure also in our sample project
DITA>
it-book>
taskbook.ditamap.
I hope this helps.
Regards,
Ionela