summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-08-26 16:02:28 +0200
committerGitHub <noreply@github.com>2023-08-26 16:02:28 +0200
commitcd13e55dd1577fd98943982b686f245940d5ab72 (patch)
tree25527f9030af314cfda977267fa69c155b73471e
parent0f794c8c7579df09f4d2e0a648ef059e3d0f2593 (diff)
Fixed numbering hint (#2012)
-rw-r--r--crates/typst-library/src/meta/reference.rs10
-rw-r--r--tests/typ/bugs/equation-numbering-reference.typ15
2 files changed, 23 insertions, 2 deletions
diff --git a/crates/typst-library/src/meta/reference.rs b/crates/typst-library/src/meta/reference.rs
index 5bd04431..015157a8 100644
--- a/crates/typst-library/src/meta/reference.rs
+++ b/crates/typst-library/src/meta/reference.rs
@@ -1,4 +1,5 @@
use super::{BibliographyElem, CiteElem, Counter, Figurable, Numbering};
+use crate::math::EquationElem;
use crate::meta::FootnoteElem;
use crate::prelude::*;
use crate::text::TextElem;
@@ -189,8 +190,13 @@ impl Show for RefElem {
)
})
.hint(eco_format!(
- "you can enable heading numbering with `#set {}(numbering: \"1.\")`",
- elem.func().name()
+ "you can enable {} numbering with `#set {}(numbering: \"1.\")`",
+ elem.func().name(),
+ if elem.func() == EquationElem::func() {
+ "math.equation"
+ } else {
+ elem.func().name()
+ }
))
.at(span)?;
diff --git a/tests/typ/bugs/equation-numbering-reference.typ b/tests/typ/bugs/equation-numbering-reference.typ
new file mode 100644
index 00000000..3423f022
--- /dev/null
+++ b/tests/typ/bugs/equation-numbering-reference.typ
@@ -0,0 +1,15 @@
+// In this bug, the hint and error messages for an equation
+// being reference mentioned that it was a "heading" and was
+// lacking the proper path.
+// Ref: false
+
+---
+#set page(height: 70pt)
+
+$
+ Delta = b^2 - 4 a c
+$ <quadratic>
+
+// Error: 14-24 cannot reference equation without numbering
+// Hint: 14-24 you can enable equation numbering with `#set math.equation(numbering: "1.")`
+Looks at the @quadratic formula. \ No newline at end of file