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

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jan 3 16:36:16 CET 2023


Am 03/01/2023 um 14:31 schrieb Noel Ullreich:
> 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.
> 

any context/reference where you pulled this from or how
you came up with it?

> 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%
> +}






More information about the pve-devel mailing list