-
Notifications
You must be signed in to change notification settings - Fork 20
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
Standardize format of TeX math #39
Comments
What is that third one? Is that a processing instruction? Where did you get that example from? I don't think that's a good alternative -- we should remove it. I'd like to see more real-world TeX examples. |
It's in our recommendations :-) |
I know .. I saw it there. I'm just wondering where it came from originally. |
I think Kaveh did some editing a little while ago |
Sorry for the delay in replying to this. These are just 3 actual real world examples. To be clear we don't have to recommend any of these and can think of the best approach, but the suggestion is that there is one recommended way to save tex in JATS |
I want to propose these recommendations for content: The content of the element should be math-mode LaTeX, without the delimiters that are normally used to switch into / out of math mode ( <disp-formula>
<tex-math id='M1'>a = b</tex-math>
</disp-formula> Rationale: the TeX enclosed in the element is only used within JATS articles to produce mathematics, so specifying that the content is in math-mode precludes ambiguities that could arise if more general-purpose TeX structures were included (such as, for example, commands to produce tables of contents). The only exception to this is that a subset of the LaTeX environments can be used to wrap the entire contents. (These are normally not permitted in math-mode.) These are typically used to specify alignment for multi-line equations. These are of the form <disp-formula>
<tex-math id='M1'>
\begin{align*}
x^2 + y^2 & = 1\\
x & = \sqrt{1-y^2}
\end{align*}
</tex-math>
</disp-formula> Note that XML CDATA sections can be used to aid in embedding TeX markup within the XML of a JATS document. This obviates the need to use escape sequences such as <disp-formula>
<tex-math id='M1'><![CDATA[
\begin{align*}
x^2 + y^2 & = 1\\
x & = \sqrt{1-y^2}
\end{align*}
]]></tex-math>
</disp-formula> |
The above grew out of my experience since our last telecon of figuring out how to get PMC tex content to render using MathJax. I think MathJax provides a really good use-case for this, since for JATS content, we just want to allow a subset of all the various types of content that is possible with TeX. Not included in the above is a specification for what packages can be assumed to be included in the environment -- i.e. what macros are permitted. I want to add something to the effect of, "the standard set of packages that comes with LaTeX", but I'm afraid that there isn't any such standard. From my limited investigations, I think that different distributions include different sets of packages. @pkra, if you have a moment, could you review the above? |
These are good ideas Klortho, and I agree with you for inline math, but for display, what happens when we have multiple lines and we need equation numbers. And the environment could be "equation", "eqnarray" or other. |
This seems reasonable to me, especially since it's based on your PMC experience (I think I don't see enough "wild" content). Defining "basic LaTeX packages" is difficult since you can always use TeX primitives to do awful things. Saying "out-of-the-box LaTeX math-mode macros with AMS packages" (and perhaps mentioning texlive 2014 or the Debian textlive-base package as vague reference points) might get close (fwiw, MathJax supports a few more, such as mchem, cancel, and extpfeil). As @kaveh1000 pointed out elsewhere concerning MathML, a limitation of this recommendation will be that anything more graphical (tikz, xypic etc) gets thrown out. But if the primary recommendation is MathML anyway, then following your proposal makes perfect sense. Perhaps such graphical things should be dealt with differently in JATS (especially JATS4reuse) but I don't run into this enough to say much about it. Again, Wikipedia's texvc might be better from a technical perspective since it is stricter and a formal grammar. However, I admit I think it's too strict for publishing needs (i.e., not even trivial macros like A particular difficulty is probably macro definitions since "reducing" macros isn't really feasible in TeX (it's hard to say where to stop from a TeX perspective and even within MathJax). So some recommendation might be sensible. Another one will be equation labels. I think we should come up with some recommendation on how to reconciliate TeX equation labels and ids in JATS or MathML. (Seconding Kaveh who commented while I was writing ;-) ) |
@kaveh1000 wrote:
@pkra wrote:
I have been assuming that equation labels are handled by JATS, not by TeX. That's true of a few of the equations that I've seen in PMC content, but I haven't done an exhaustive review. I think it would be better if equation labels were not done in TeX. I started to try to enumerate the allowed LaTeX environments, and only specify the starred ones ("equation*" and not "equation") are allowed, because the unstarred environments don't generate equation numbers. But then I thought it would be easier to just reference the MathJax documentation. But after your comment, I'm inclined to go back to enumerating them. What do you think? |
I agree. Let's include that for TeX. But on the risk of going off topic, what about MathML? Duplication is obviously not a good idea but it's strange not to have the label in the MathML, especially for re-use (copy&paste / other forms of extraction need to retain a label, e.g., "First Law of Motion"). Of course, the burden could be put on the rendering/conversion side, e.g., JATS to HTML conversion could be expected to re-integrated the label into the MathML. But I'd be hesitant since it means twice the work in most cases. |
I forgot that I ran into these and was confused. The two values for Similarly, |
Hi,
|
This should not have been listed in recommendations yet as is still a question to be answered here.
Standardize insertion of TeX math. Each publisher wants it differently. Here are 3 examples:
<tex-math><![CDATA[...]]></tex-math>
<tex-math><![CDATA[$$...$$]]></tex-math>
<tex-math><?CDATA...?></tex-math>
Best to have an agreed form so that browsers can render the TeX natively.
The text was updated successfully, but these errors were encountered: