summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst/src/text/smartquote.rs9
-rw-r--r--tests/ref/issue-5146-smartquotes-after-equations.pngbin0 -> 240 bytes
-rw-r--r--tests/suite/text/smartquote.typ3
3 files changed, 9 insertions, 3 deletions
diff --git a/crates/typst/src/text/smartquote.rs b/crates/typst/src/text/smartquote.rs
index 9b48c03a..467165b6 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 00000000..96be7204
--- /dev/null
+++ b/tests/ref/issue-5146-smartquotes-after-equations.png
Binary files differ
diff --git a/tests/suite/text/smartquote.typ b/tests/suite/text/smartquote.typ
index fe4e8c85..fe398b7a 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