hyphen-encode can sometimes drop meaningful spaces
Status: Beta
Brought to you by:
marsgui
When you use a tag that is processed by inline.monoseq or inline.sansseq and whose content is thus handled by hyphen-encode, the resulting PDF will (sometimes) drop a meaningful space.
In the Debian Handbook I have <literal>Architecture: all</literal>
and in the PDF, the space is gone. In the .tex file, the space is still here but after a :\penalty0
and I guess that the two consecutive spaces are collated at this point and that it would need to be escaped in some way to be kept as a meaningful space.
(Note that I have custom XSL so that the literal tag is processed by inline.sansseq, it's not that way by default)
Hum, so this means that my tag is processed by the UrlHyphenator class. I have an easy fix in dbtexmf/dblatex/texhyphen.py, just replace h_sep and h_char like this:
This seems to work for me without any side-effect so far.
The full patch for clarity:
This bug is also tracked on the Debian bug tracker: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862332
It contains a minimal test case here:
XML: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=862332;filename=test.xml;msg=15
PDF: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=2;bug=862332;filename=test.pdf;msg=15
It would be nice to get this bug fixed in an official dblatex release.
Thanks for reporting this bug. The patch works for one space, but if there are other following spaces they are not preserved. Moreover the space rendering with a normal space is not the one expected in literal mode. So the patch I propose is the following:
I attach a test case showing the need to preserve all the spaces, and the patch.
Attached the test case showing with an example the need to preserve spaces.
I'm not sure that this is correct. Neither code nor literal are verbatim elements according to the Docbook specification (they are both "inline"). So multiple spaces are not necessarily intended. Also consider what line wrapping might have as consequences with your change:
Yes, you're right! I've reverted the XSL file and applied your patch. I guess Andreas can package a debian release with this.
Fixed in 0.3.11 release.
Fixed in 0.3.11 release.