From db8efbe593db8aa866b60e65b0bfe942e9d0a13a Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 24 Oct 2026 20:52:13 +0000 Subject: [PATCH] LaTeX: \'{} and \"{} import as the spacing acute and diaeresis, not an apostrophe and a quotation mark (#4170) --- crates/formats/src/latex.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/formats/src/latex.rs b/crates/formats/src/latex.rs index fa3a05ddf..10de89212 100644 --- a/crates/formats/src/latex.rs +++ b/crates/formats/src/latex.rs @@ -2212,8 +2212,11 @@ impl<'a> Parser<'a> { let mut chars = arg.chars(); let s = match chars.next() { Some(b) => format!("{}{}", compose(b, mark), chars.as_str()), + // An accent over nothing prints the accent alone: the spacing form of the mark. None => match name { - "'" | "`" | "^" | "\"" | "~" => name.to_string(), + "`" | "^" | "~" => name.to_string(), + "'" => "\u{B4}".to_string(), + "\"" => "\u{A8}".to_string(), _ => mark.to_string(), }, }; @@ -2833,6 +2836,8 @@ mod tests { fn empty_accent_group_is_plain_character() { let t = texts("\\begin{document}x\\^{}y \\~{}z 2\\^{}10 \\texttt{\\~{}/dir}\\end{document}"); assert_eq!(t, vec!["x^y ~z 2^10 ~/dir".to_string()]); + // The acute and the diaeresis alone are accents, not an apostrophe or a quotation mark. + assert_eq!(texts("\\begin{document}\\'{} \\\"{}\\end{document}"), vec!["\u{B4} \u{A8}".to_string()]); } #[test]