-
Notifications
You must be signed in to change notification settings - Fork 30
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
Latex Issue #102
Comments
I have now experience many issue when sending cards with Latex. My solution to this problem is to copy paste the Latex instance that failed directly in to the Anki GUI Mathjax inline or block editor. In every one of my instances this has worked perfectly. It seems that the Latex is getting jumbled up in an attempt to translate it to Mathjax, which might not be necessary. I can provide all of the failed instances if it is helpful. |
LaTex is not the same as Mathjax; therefore the syntax will be different. You can test your Latex with overleaf.com before you send it to Anki The following code may help to get you started. VSCode LaTex# latex
## Latex
$\hat{\mathcal{D}} \approx \mathcal{D}$
using
$\mathcal{X} = \{ {\mathbf{x}_1, \ldots, \mathbf{x}_n} \}$
Anki cardNote: It would help others to understand your issue if you indicate Issue and a screenshot of the Expected results in your comments. |
Following will also work # Mathjax on back
## Mathjax on back
$ \hat{\mathcal{D}} \approx \mathcal{D} $
using
$ \mathcal{X} = \left \{ {\mathbf{\frac{x}{y}}_1, \ldots, \mathbf{x}_n} \right \} $ |
Testing Suggestions@rleyvasal I think you made a typo, but I get the point. VsCode Markdown Example 1I'll try to clarify my issue and my fix. Input (Example 1)
Expected Output (Example 1)Anki After Sending to Deck (Example 1)
My fix (Example 1)
VsCode Markdown Example 2Input (Example 2)$$
\hat{\theta}_{\mathrm{MAP}}=\operatorname{argmax}_{\theta} p\left(\theta \mid \mathbf{x}_{1: n}\right)
$$ Expected Output (Example 2)Anki After Sending to Deck (Example 2)My Fix (Example 2)
|
The problem is not with the Anki for VSCode extension. The issue is with the way the Latex is beign entered into vscode. As a rule of thumb for subscripts if there is only one character # test
## test
Goal: Learn an approximation $ \hat{\mathcal{D}} \approx \mathcal{D} $
using
Your example `\mathbf{x}_{1}`
$ \mathcal{X} = \left \{ \mathbf{x}_{1}, \dots, \mathbf{x}_{n} \right \}$
My example `\mathbf{x}_{1+m}` adnd `\mathbf{x}_n`
$ \mathcal{X} = \left \{ \mathbf{x}_{1+m}, \ldots, \mathbf{x}_n \right \} $ |
@rleyvasal How do you explain that things work when I copy the latex that contains Thanks for showing work arounds. Ideally, I could find all of the necessary work arounds and implement them in my Latex, but for some of my examples, like example 2 shown, I haven't been able to find a proper work around. If you have the time, would you mind taking a look at that example? |
This is very likely a bug. Latex below does not show correctly when sending from VSCode to Anki, but entering the same code without in the Anki app (without ``$$ ..$$`) as a Mathjax block gives the correct math symbols. $$
\hat{\theta}_{\mathrm{MAP}}=\operatorname{argmax}_{\theta} p\left(\theta \mid \mathbf{x}_{1: n}\right)
$$ The issue may be happening in one of the following:
@jasonwilliams may be in a better position to diagnose the issue. |
I've only taken a brief look at this issue. It sounds like we would need some escape hatch whenever latex is involed so it's not interpreted as markdown (for e.g I'm guessing the fix would need to be here somewhere: I don't use latex myself so I don't think I would be the best person to debug it but I'm happy to help guide anyone who wants to take a look. I really appreciate the test cases put in here, especially from @Mjvolk3, from what I can see in his comment is the markdown parser is changing some things as it has no awareness of latex syntax.
We use marked. I think there's more than enough solutions in that thread we could take and use, it would just take someone to make a PR |
Card in VsCode
What are the classical approaches to Density Estimation? Briefly describe their procedures and important differences.
Density Estimation: Learn an approximation$\hat{\mathcal{D}} \approx \mathcal{D}$ using $\mathcal{X}=\left{\mathbf{x}{1}, \ldots, \mathbf{x}{n}\right}$
... Apparently github rendering doesn't like it either when I copy paste. I have provided a pic of the raw latex.
Card in Anki
Anyone know what this is happening? It makes it difficult to tell which equations render incorrectly before sending the cards to deck.
The text was updated successfully, but these errors were encountered: