From 4ee4992b545ac0c42fa054dd1449d73c8e8c4620 Mon Sep 17 00:00:00 2001 From: Louis Gesbert Date: Fri, 16 Feb 2024 16:35:32 +0100 Subject: [PATCH] Tweak multi-module LaTeX output --- compiler/literate/latex.ml | 22 ++++++++++++++----- .../good/test_grave_char_en.catala_en | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/compiler/literate/latex.ml b/compiler/literate/latex.ml index cf2fbb9a..390ef7f1 100644 --- a/compiler/literate/latex.ml +++ b/compiler/literate/latex.ml @@ -271,18 +271,28 @@ let rec law_structure_to_latex file label | A.LawInclude (A.CatalaFile _ | A.LegislativeText _) -> () | A.ModuleDef (id, extern) -> - Format.fprintf fmt - "\n\\textbf{This defines the \\texttt{%s} module \\texttt{%s}}" - (if extern then "external" else "catala") + (match language with + | Fr -> + Format.fprintf fmt "\n\\textbf{Ceci définit le module %s \\texttt{%s}}" + (if extern then "externe" else "catala") + | _ -> + Format.fprintf fmt "\n\\textbf{This defines the %s module \\texttt{%s}}" + (if extern then "external" else "catala")) (pre_latexify (Mark.remove id)) | A.ModuleUse (id, alias) -> ( - Format.fprintf fmt - "\n\\textbf{The following makes use of the module \\texttt{%s}" + (match language with + | Fr -> + Format.fprintf fmt "\n\\textbf{Ce qui suit utilise le module \\texttt{%s}" + | _ -> + Format.fprintf fmt + "\n\\textbf{The following makes use of the module \\texttt{%s}") (pre_latexify (Mark.remove id)); match alias with | None -> Format.fprintf fmt "}" | Some al -> - Format.fprintf fmt " under the name \texttt{%s}}" + (match language with + | Fr -> Format.fprintf fmt " sous le nom \\texttt{%s}}" + | _ -> Format.fprintf fmt " under the name \\texttt{%s}}") (pre_latexify (Mark.remove al))) | A.LawText t -> Format.fprintf fmt "%s" (pre_latexify t) | A.CodeBlock (_, c, false) when not print_only_law -> diff --git a/tests/literate/good/test_grave_char_en.catala_en b/tests/literate/good/test_grave_char_en.catala_en index b735d2ed..d5224325 100644 --- a/tests/literate/good/test_grave_char_en.catala_en +++ b/tests/literate/good/test_grave_char_en.catala_en @@ -52,7 +52,7 @@ $ catala Interpret -s A ```catala-test-inline $ catala latex -\textbf{This defines the \texttt{catala} module \texttt{Test\_grave\_char\_en}} +\textbf{This defines the catala module \texttt{Test\_grave\_char\_en}} \subsection{Law text should be able to contain grave accent ``'.}