diff --git a/crates/typst-library/src/meta/reference.rs b/crates/typst-library/src/meta/reference.rs index 5bd044319..015157a8b 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 000000000..3423f0229 --- /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 +$ + +// 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