Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support math equation numbering and its corresponding reference #48

Closed
facat opened this issue Jan 28, 2016 · 12 comments
Closed

Support math equation numbering and its corresponding reference #48

facat opened this issue Jan 28, 2016 · 12 comments

Comments

@facat
Copy link

facat commented Jan 28, 2016

No description provided.

@jhrmnn
Copy link

jhrmnn commented Feb 4, 2016

This would be indeed a great feature to have.

@abnerlee
Copy link
Contributor

abnerlee commented Feb 4, 2016

Is there any markdown syntax to support this feature?

@jhrmnn
Copy link

jhrmnn commented Feb 4, 2016

This should all be handled by mathjax, but it does not seem to work in Typora. I'm not sure how Typora calls mathjax, but it might be that mathjax is called separately for each equation and hence it doesn't know about the references. To sum up, I imagine this would work in Typora:

$$
\begin{equation}
a^2+b^2=c^2
\label{eq:pythagoras}
\tag{1}
\end{equation}
$$

Referring to Eq. $\eqref{eq:pythagoras}$.

@jhrmnn
Copy link

jhrmnn commented Feb 4, 2016

Actually, it does seem to work when pasted all at once in a fresh new document.

screen shot 2016-02-04 at 20 31 25

But after editing (while changing nothing), the math block stays unprocessed,

screen shot 2016-02-04 at 20 32 01

There might be some useful information here.

@abnerlee
Copy link
Contributor

abnerlee commented Feb 5, 2016

Thanks, I will check the doc

@abnerlee abnerlee changed the title Does Typora support math equation numbering and its corresponding reference? Support math equation numbering and its corresponding reference Feb 6, 2016
@RomainBui
Copy link

I would like to second here, this would be a great future.

@ropeonfire
Copy link

I would love to have this feature -- I've attempted to modify the MathJax.Hub.Config to include equationNumbers (accessed by toggling the DevTools):
TeX: { extensions: ["noUndefined.js", "autoload-all.js", "AMSmath.js", "AMSsymbols.js"], equationNumbers: { autoNumber: "AMS" } }
This seems to have no effect - and I'm not even sure it's supposed to since I know nothing of html, etc...

@ropeonfire
Copy link

ropeonfire commented May 20, 2016

I've modified the MathJax.Hub.Config in "...\Typora\resources\app\window.html" to include auto-numbering, as shown in the snippet in my comment above. This allows the use of the \label syntax; the equations are auto-numbered in the order they are written/processed, as expected. Also, the "multiply defined" error will return if the equation is edited after it is initially rendered. If this happens, one can get things re-rendered and re-numbered appropriately by closing/opening the file.

Remaining issues:

  • In the PDF export, references generated by \eqref{} or \ref{} appear to be clickable but don't actually seem to be associated and do not jump to the referenced equations. OTH, the references in the .html export seem to work as expected...Wish it were the other way around... :P
  • It may be possible (?) to somehow use MathJax.Hub.Queue and avoid the need to close/reopen the file to fix multiply-defined errors and/or force the equations to be renumbered from top to bottom (see the relevant MathJax docs here). Unfortunately I am not familiar with where this config needs to be included...I've tried adding it to "window.html" with poor results. I might just be putting it in the wrong place (I'm just blindly plugging away here). Any ideas?

@truefalsename
Copy link

On a mac you can turn on equation autonumbering by editing /Applications/Typora.app/Contents/Resources/TypeMark/lib/MathJax-2.6.1/jax/input/TeX/config.js

changing "none" to "AMS" or "all" in equationNumbers:{autoNumber:"none",formatNumber:function(a){return a},formatTag:function(a){return"("+a+")"}.

@ickc
Copy link

ickc commented Oct 7, 2016

I configured the MathJax in /Applications/Typora.app/Contents/Resources/TypeMark/index.html and it would work, except that the numbering could have problems.

It seems typora uses the MathJax to rendered it once and stored the resulted CHTML (or HTML+CSS?). The problem then is if I edit the document non-linearly, the numbering will be incorrect. In fact, when I tested it, even if I have only 1 numbered equation, editing the same equation repeatedly will results in incrementing the number count on that equation.

Given how typora works (live view on the source), this behavior on the preview is acceptable. However, when it is exported as HTML, the results would still be the same. So I suggest it to do a complete rendering at the time of export to yield a correct result.

@abnerlee
Copy link
Contributor

abnerlee commented Oct 7, 2016

#316

@abnerlee
Copy link
Contributor

Already add such option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants