Commit 51239100 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'p/docs-pdf-hugo-alert' into 'master'

docs: fix hugo alerts in PDF

See merge request allpix-squared/allpix-squared!786
parents 9948ec82 f662c79f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -134,13 +134,19 @@ def latex_convert_hugo_alert(string: str) -> str:
    """
    Converts the pandoc-converted hugo alters to LaTeX warning boxes.

    Looks more complicated than it actually is: \s+ is supposed to be a space in most cases, but edge cases happen when
    pandoc does a linebreak where the space is.

    Args:
        string: String formatted in LaTeX.

    Returns:
        String formatted in LaTeX.
    """
    return string  # TODO
    match = r'\\{\\{\\%\s+alert\s+title=``(.+?)\'\'\s+color=``(.+?)\'\'\s+\\%\\}\\}\s+(.+?)\s+\\{\\{\\%\s+/alert\s+\\%\\}\\}'

    string = re.sub(match, r'\\begin{hugo\2}\n\\textbf{\1}:\n\3\n\\end{hugo\2}', string, flags=re.DOTALL)
    return string


def latex_convert_href_references(string: str, file_path: str) -> str:
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
\usepackage{fontspec}
\usepackage{microtype}
\usepackage{fvextra}
\usepackage[svgnames]{xcolor}

% Layout
\usepackage[top=3cm,bottom=3cm]{geometry}
+23 −0
Original line number Diff line number Diff line
@@ -11,6 +11,29 @@
\end{table}
}

% hugo alter boxes
\newsavebox{\hugowarningbox}
\newenvironment{hugowarning}
  {\newcommand\colboxcolor{LightPink}%
   \begin{lrbox}{\hugowarningbox}%
   \begin{minipage}{\dimexpr\linewidth-2em\relax}}
  {\end{minipage}\end{lrbox}%
   \begin{center}
     \setlength\fboxsep{0pt}
     \colorbox{\colboxcolor}{\setlength\fboxsep{1em}\fbox{\usebox{\hugowarningbox}}}
  \end{center}}
\newsavebox{\hugoinfobox}
\newenvironment{hugoinfo}
  {\newcommand\colboxcolor{LightBlue}%
    \begin{lrbox}{\hugoinfobox}%
    \begin{minipage}{\dimexpr\linewidth-2em\relax}}
  {\end{minipage}\end{lrbox}%
    \begin{center}
      \setlength\fboxsep{0pt}
      \colorbox{\colboxcolor}{\setlength\fboxsep{1em}\fbox{\usebox{\hugoinfobox}}}
  \end{center}}


% PDF options
\hypersetup{
  pdftitle={Allpix Squared User Manual}