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

Noel Ullreich n.ullreich at proxmox.com
Tue Jan 10 14:05:24 CET 2023


On 03-01-2023 16:36, Thomas Lamprecht wrote:
> 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?

I adapted this stackexchange answer:
https://tex.stackexchange.com/questions/219445/line-break-in-texttt?rq=1

This works well because it allows breaks at predefined
characters in inline code. If this is not done, Latex will not know
where to break long commands.

>
>> 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