[pve-devel] [PATCH pve-docs 1/3] Fixed inline code breaking in pdf docs

Noel Ullreich n.ullreich at proxmox.com
Tue Jan 3 14:31:19 CET 2023


Had to overwrite the `texttt` command to allow breaks in long strings
with no space. Now the line can be broken on specific chars as well.

Signed-off-by: Noel Ullreich <n.ullreich at proxmox.com>
---
 asciidoc/dblatex-custom.sty | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/asciidoc/dblatex-custom.sty b/asciidoc/dblatex-custom.sty
index 6b2578c..02fbe16 100644
--- a/asciidoc/dblatex-custom.sty
+++ b/asciidoc/dblatex-custom.sty
@@ -66,3 +66,16 @@
   \drawtitlepage
   \pagebreak[4]
 }
+
+% to correctly break inline code the texttt command needs to be renewed
+\DeclareRobustCommand{\texttt}[1]{
+  \begingroup%
+  \ttfamily%
+  % characters on which to break. `_` does not work
+  \begingroup\lccode`~=`/\lowercase{\endgroup\def~}{/\discretionary{}{}{}}%
+  \begingroup\lccode`~=`.\lowercase{\endgroup\def~}{.\discretionary{}{}{}}%
+  \begingroup\lccode`~=`-\lowercase{\endgroup\def~}{-\discretionary{}{}{}}%
+  \catcode`/=\active\catcode`.=\active\catcode`-=\active%
+  \scantokens{#1\noexpand}%
+  \endgroup%
+}
-- 
2.30.2






More information about the pve-devel mailing list