LaTeX fragments become unlabelled when exporting to SVG (equation
becomes equation*
)
#618
Replies: 6 comments 13 replies
-
If mathjax is not used, Lines 984 to 986 in 3d9cc64 Can you check if you see the same behavior if you export that to
Sorry, I don't know what that means.
You'll need to control that using CSS. See this HTML in the Markdown snippet you posted:
The equation label has Positioning that equation number is out of the scope of |
Beta Was this translation helpful? Give feedback.
-
Can you post the diff you see just out of curiosity? I don't think I'll be able to fix that here because the |
Beta Was this translation helpful? Give feedback.
-
Thanks for your fast response! I should have explained some more about LaTeX, sorry. If mathjax is not used, ox-hugo falls back to returning whatever ox-html generates (the img tag referencing the SVG file and the span tag for equation). The only modificationox-html (ox-blackfriday) does is updating the SVG path in img tag so that it work with Hugo. Okay, thank you for this information! I had feared it, but wanted to be sure. This was valuable to know, though, because it helped spot the problem (see below).
Yes, same behavior. This is proof it doesn't have to do anything with
What I said concerned the equation number produced by LaTeX, not by html/css. But I did not know about all that! So I could label my equations with css and even refer to them since they are not part of the image - thank you for the insight! This makes (1) (see below) obsolete. Are you familiar enough with css to tell me without effort how you can put the equation numbers left and in parentheses? I am a total beginner with css.
Sorry for not explaining! In LaTeX, a code chunk that looks like
is called an environment, and
As it happens, I have just found the culprit of both (1) and (2): It is
by
in that function, things work out as expected. In other words, just skip the unlabelling function. At the moment, I just copied the whole function (which is huge) in my config with these changes, but if you know a neater way to do it, please let me know! Anyway, the problem is resolved now. Thank you for your time and patience! I intend to write an in-depth blog article about the whole topic soon - for beginners like me - in the hope that the next one wondering will read it instead of opening another request. I really appreciate your efforts. |
Beta Was this translation helpful? Give feedback.
-
@Perangelot I have converted this to a discussion as it's not related to |
Beta Was this translation helpful? Give feedback.
-
Alright, I am going to report it, then. The suggestion in your documentation unfortunately only works for
and then just writing at some point in the org-buffer "eq2". It immediately turns into a hyperlink pointing to
What we need for proper equation links would be this line without
If that worked, you could make perfect references to your equations. It probably is even possible to automatically generate radio targets since the equations are laballed automatically, too. There sure is a way to not export radio targets, and I think a simply function wihch deletes all occurrences of |
Beta Was this translation helpful? Give feedback.
-
Now I have actually figured out a way to handle the problem that all environments get labelled in html. I define a variable which contains all the LaTeX environments that should not be labelled and change the predicate to consider this. This is the code plus example, heavily annotated:
I have just started reading into emacs-lisp and it might be an awful piece of code. My version of |
Beta Was this translation helpful? Give feedback.
-
Actual Behavior
The code for a LaTeX fragment is changed before the
.svg
image to be shown in the.html
is produced. For example, theequation
environment becomes theequation*
environment. This results in org-preview images deviating from those shown in the.html
. Especially for self-defined environments, this poses a big problem because they are not displayed correctly.Expected Behavior
I see that this is useful sometimes, but there should be a way to turn this off, that is generate the
.svg
images exactly the same way as they are generated for org-preview. It seems thatorg-blackfriday-latex-fragment
does some changed, but I am not sure if it draws on defaults oforg-export
settings.How to Reproduce the Issue
Run
C-c C-x C-l
on theequation
fragment. Export the MWE file tohugo
html. Compare theorg
andhtml
.svgs
. Select the.svg
in the browser, pressC-c
to copy the code and paste it in an org-mode buffer. Compare the code of the equation environment and code copied from the.svg
. Alternatively, compare thealt
in the.md
file with the code that should generate the preview.Example Org File
Generated Markdown File or Error
org-mode
.svg
:html
.svg
:Note: Your equation number should be on the right handside; I loaded
amsmath
with theleqno
option which, well puts the equation numbers left.Beta Was this translation helpful? Give feedback.
All reactions