diff --git a/crates/typst/src/text/smartquote.rs b/crates/typst/src/text/smartquote.rs index 9b48c03ac..467165b6a 100644 --- a/crates/typst/src/text/smartquote.rs +++ b/crates/typst/src/text/smartquote.rs @@ -131,9 +131,12 @@ impl SmartQuoter { } // If we have a single smart quote, didn't recently open a single - // quotation, and are after an alphabetic char, interpret this as an - // apostrophe. - if !double && opened != Some(false) && before.is_alphabetic() { + // quotation, and are after an alphabetic char or an object (e.g. a + // math equation), interpret this as an apostrophe. + if !double + && opened != Some(false) + && (before.is_alphabetic() || before == '\u{FFFC}') + { return "’"; } diff --git a/tests/ref/issue-5146-smartquotes-after-equations.png b/tests/ref/issue-5146-smartquotes-after-equations.png new file mode 100644 index 000000000..96be7204a Binary files /dev/null and b/tests/ref/issue-5146-smartquotes-after-equations.png differ diff --git a/tests/suite/text/smartquote.typ b/tests/suite/text/smartquote.typ index fe4e8c85c..fe398b7ad 100644 --- a/tests/suite/text/smartquote.typ +++ b/tests/suite/text/smartquote.typ @@ -165,3 +165,6 @@ Some people's thought on this would be #[#set smartquote(enabled: false); "stran "test"\ "test" + +--- issue-5146-smartquotes-after-equations --- +$i$'s $i$ 's