From 1ed71fb2a5dbf1b1a44d25a8b9588c8e0f43144f Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 28 Sep 2020 16:51:54 +0100 Subject: LaTeX: provide default implementations of the other saildoc commands --- src/latex.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/latex.ml b/src/latex.ml index be3e8748..96a74e06 100644 --- a/src/latex.ml +++ b/src/latex.ml @@ -440,7 +440,12 @@ let tdef_id = function let defs (Defs defs) = reset_state state; - let preamble = string "\\providecommand\\saildoclabelled[2]{\\phantomsection\\label{#1}#2}" ^^ twice hardline in + let preamble = string ("\\providecommand\\saildoclabelled[2]{\\phantomsection\\label{#1}#2}\n" ^ + "\\providecommand\\saildocval[2]{#1 #2}\n" ^ + "\\providecommand\\saildocfcl[2]{#1 #2}\n" ^ + "\\providecommand\\saildoctype[2]{#1 #2}\n" ^ + "\\providecommand\\saildocfn[2]{#1 #2}\n" ^ + "\\providecommand\\saildocoverload[2]{#1 #2}\n\n") in let overload_counter = ref 0 in -- cgit v1.2.3 From 38341beb186e5ac871d0e3446e5a98a25a806667 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 28 Sep 2020 17:18:08 +0100 Subject: LaTeX: Underscore-escape values in the \ifstrequal code --- src/latex.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/latex.ml b/src/latex.ml index 96a74e06..a4265686 100644 --- a/src/latex.ml +++ b/src/latex.ml @@ -241,7 +241,7 @@ let latex_of_markdown str = | Paragraph elems -> let prepend = if state.noindent then (state.noindent <- false; "\\noindent ") else "" in prepend ^ format elems ^ "\n\n" - | Text str -> Str.global_replace (Str.regexp_string "_") "\\_" str + | Text str -> text_code str | Emph elems -> sprintf "\\emph{%s}" (format elems) | Bold elems -> sprintf "\\textbf{%s}" (format elems) | Ref (r, "THIS", alt, _) -> @@ -505,7 +505,7 @@ let defs (Defs defs) = identifiers then outputs the correct mangled command. *) let id_command cat ids = sprintf "\\newcommand{\\%s%s}[1]{\n " !opt_prefix (category_name cat) - ^ Util.string_of_list "%\n " (fun id -> sprintf "\\ifstrequal{#1}{%s}{\\%s}{}" (string_of_id id) (latex_cat_id cat id)) + ^ Util.string_of_list "%\n " (fun id -> sprintf "\\ifstrequal{#1}{%s}{\\%s}{}" (text_code (string_of_id id)) (latex_cat_id cat id)) (IdSet.elements ids) ^ "}" |> string -- cgit v1.2.3