question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support \eqref and \label

See original GitHub issue

Before requesting a feature, please search for existing issues.

Is your feature request related to a problem? Please describe. I am trying to migrate from Mathjax to Katex, however, \eqref and \label are not supported for the moment. Any roadmap on this?

Describe the solution you’d like: Support \eqref and \lable for equation reference

Link to or name of a (La)TeX package that provides the same feature: KaTeX’s general goal is to render as LaTeX does.

Describe alternatives you’ve considered: A clear and concise description of any alternative solutions or features you’ve considered.

Additional context: Add any other context or screenshots about the feature request here.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:25
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

12reactions
zhangpeng96commented, Aug 17, 2021

Inspired by this issue: https://github.com/falgon/roki-web/issues/34 We can use KaTeX’s marco command to implement \eqref & \label function by \href & \htmlId command

ATTENTION: \href & \htmlId command are disabled by default, we must add them into trust option

UPDATE: The previous trust setting code is wrong, as @nschloe said, trust only accept boolean or function. We can use function type to allow specific commands. Thank nschloe very much!

KaTeX option:

trust: (context) => ['\\htmlId', '\\href'].includes(context.command),
macros: {
  "\\eqref": "\\href{###1}{(\\text{#1})}",
  "\\ref": "\\href{###1}{\\text{#1}}",
  "\\label": "\\htmlId{#1}{}"
}

example:

Search by definition $\eqref{1-1}$ or $\ref{1-1}$.

$$
\begin{aligned} \sin 2\theta = 2\sin \theta \cos \theta \\ = \cfrac{2 \tan \theta}{1+\tan^2 \theta} \end{aligned} \label{1-1}\tag{1-1}
$$

Used in the same way as LaTeX or MathJax.

1reaction
edemainecommented, Jun 17, 2019

@kevinbarabash Neat idea. One challenge is that labels and refs will generally span multiple equations, so this would need to be done at the autorender level. But maybe if we work out the interface for how autorender could do it, we could get a more general API…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using \eqref and labelling an equation in LaTex - TeX
It is a bad idea to use labels like eq:1 as that may make a human reader think that it is equation 1....
Read more >
LaTeX/Labels and Cross-referencing - Wikibooks
Help and Recommendations. FAQ · Tips and Tricks. Appendices. Authors · Links · Package Reference · Sample LaTeX documents · Index · Command...
Read more >
Cross referencing sections, equations and floats - Overleaf
Again, the commands \label and \ref are used for references. The label is set after the \section statement, i.e. the \label command should...
Read more >
LaTeX Help by Example Lesson 2 Tag and Label displayed ...
Usually, a displayed equation's tag appears in the PDF file on the right ... By using the label+eqref, Latex will automatically make the...
Read more >
How to suppress equation numbers in Franklin?
It seems that Franklin.jl doesn't currently support the “*” form of math environments, ... x = 2 $$ } $$ x = 3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found