From 26cbebbda7b04d0b142e28b41205337717959616 Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 10 Feb 2021 09:10:51 -0500 Subject: [PATCH] Use latex sloppypar to fix monospace wrapping in PDF rendering. Monospaced identifiers could end up running over if latex was not able to find a place to break the line. Using sloppypar forces breaks so monospaced identifiers don't run over or get broken up. Also add vspace to admonitions so they have some separation from the prior text. --- doc/lib/pgBackRestDoc/Common/DocRender.pm | 3 ++- doc/lib/pgBackRestDoc/Latex/DocLatexSection.pm | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/lib/pgBackRestDoc/Common/DocRender.pm b/doc/lib/pgBackRestDoc/Common/DocRender.pm index 96b651df7..2d3d93b83 100644 --- a/doc/lib/pgBackRestDoc/Common/DocRender.pm +++ b/doc/lib/pgBackRestDoc/Common/DocRender.pm @@ -110,7 +110,8 @@ my $oRenderTag = 'backrest' => [undef, ''], 'proper' => ['\textnormal{\texttt{', '}}'], 'postgres' => ['PostgreSQL', ''], - 'admonition' => ["\n\\begin{leftbar}\n\\textit{\\textbf{", "}\n\\end{leftbar}\n"], + 'admonition' => + ["\n\\vspace{.5em}\\begin{leftbar}\n\\begin{sloppypar}\\textit{\\textbf{", "}\\end{sloppypar}\n\\end{leftbar}\n"], }, 'html' => diff --git a/doc/lib/pgBackRestDoc/Latex/DocLatexSection.pm b/doc/lib/pgBackRestDoc/Latex/DocLatexSection.pm index 6a227e011..eff1e5c82 100644 --- a/doc/lib/pgBackRestDoc/Latex/DocLatexSection.pm +++ b/doc/lib/pgBackRestDoc/Latex/DocLatexSection.pm @@ -348,7 +348,7 @@ sub sectionProcess # Add descriptive text elsif ($oChild->nameGet() eq 'p') { - $strLatex .= "\n" . $self->processText($oChild->textGet()) . "\n"; + $strLatex .= "\n\\begin{sloppypar}" . $self->processText($oChild->textGet()) . "\\end{sloppypar}\n"; } # Add option descriptive text elsif ($oChild->nameGet() eq 'option-description') @@ -361,7 +361,7 @@ sub sectionProcess confess &log(ERROR, "unable to find ${strOption} option in sections - try adding option?"); } - $strLatex .= "\n" . $self->processText($oDescription) . "\n"; + $strLatex .= "\n\\begin{sloppypar}" . $self->processText($oDescription) . "\\end{sloppypar}\n"; } # Add cmd descriptive text elsif ($oChild->nameGet() eq 'cmd-description') @@ -374,7 +374,7 @@ sub sectionProcess confess &log(ERROR, "unable to find ${strCommand} command in sections - try adding command?"); } - $strLatex .= "\n" . $self->processText($oDescription) . "\n"; + $strLatex .= "\n\\begin{sloppypar}" . $self->processText($oDescription) . "\\end{sloppypar}\n"; } # Add a list elsif ($oChild->nameGet() eq 'list') @@ -401,9 +401,9 @@ sub sectionProcess # Add an admonition (e.g. NOTE, WARNING, etc) elsif ($oChild->nameGet() eq 'admonition') { - $strLatex .= "\n\\begin{leftbar}"; - $strLatex .= "\n\\textit{\\textbf{" . uc($oChild->paramGet('type')) . ": }"; - $strLatex .= $self->processText($oChild->textGet()) . "}"; + $strLatex .= "\n\\vspace{.5em}\\begin{leftbar}"; + $strLatex .= "\n\\begin{sloppypar}\\textit{\\textbf{" . uc($oChild->paramGet('type')) . ": }"; + $strLatex .= $self->processText($oChild->textGet()) . "}\\end{sloppypar}"; $strLatex .= "\n\\end{leftbar}\n"; } # Check if the child can be processed by a parent