Drasil
Drasil copied to clipboard
Rendering multicharacter symbols in LaTeX
For symbols that consist of multiple characters, like min, max, MINFRACT, etc, when they are rendered in LaTeX equations they would look better in an \mbox. Rather than LaTeX interpreting min as m times i times n, a \mbox{min} would achieve a more natural spacing.
I thought that if you used Atomic
, they would get thus rendered (well, not with an mbox, but with mathsf or similar). Perhaps some of these are hacked-in rather than using the correct symbol combinators?
We discussed this further in the "all hands meeting" on March 14. GlassBR has several examples of equations that look odd, for instance LR = NFR GTF LSF. This would look better with a multiplication symbol. Maybe we can detect cases like this an automatically add the symbol when rendering? This isn't a high priority, but something to keep in mind for the future.
This would be quite hard to achieve, at least not without a clear way of understanding what is the root cause of the oddness. Having multiple multiplication symbols is not hard. It is the decision criteria to use one versus another which is.
Yes, we talked about this a bit at the start of the meeting. We thought that with some thought we could come up with some rules for when explicit multiplication symbols would look nice. After all, human being have some implicit rules when they change the formatting of the display of an equation. This isn't a high priority, but it might be a little project for a future student to tackle. A simple rule might be that multi-character symbols multiplied together need an explicit multiplication symbol.
Related to #1639
Is this still needed?
Yes, this is still needed. I had a quick look at the LaTeX code and some of the equations are spaced very oddly. I'll attach the example of is_safeProb. It looks like is - safeProb
, with LaTeX implicitly multiplying all the symbols.
The solution might just be to use Atomic
properly? Not all of the symbols look wrong in the documents.
Yes, I think Atomic
is the solution.
Ah, I think we've given this a small attempt in #2865;
However, some things are still problematic:
(both are examples from GlassBR)
Definitely still a problem! What is the generated LaTeX for that?
For isSafeLoad = capacity > Load
, we have:
https://github.com/JacquesCarette/Drasil/blob/ad1e157f9ce96046e74787aaf31cb4e0726fe237/code/stable/glassbr/SRS/HTML/GlassBR_SRS.html#L938-L944
and
https://github.com/JacquesCarette/Drasil/blob/ad1e157f9ce96046e74787aaf31cb4e0726fe237/code/stable/glassbr/SRS/PDF/GlassBR_SRS.tex#L439-L442
For LR = NFLGTFLSF
, we have:
https://github.com/JacquesCarette/Drasil/blob/ad1e157f9ce96046e74787aaf31cb4e0726fe237/code/stable/glassbr/SRS/HTML/GlassBR_SRS.html#L1894-L1897
and
https://github.com/JacquesCarette/Drasil/blob/ad1e157f9ce96046e74787aaf31cb4e0726fe237/code/stable/glassbr/SRS/PDF/GlassBR_SRS.tex#L1064-L1067
It's also weird that the generated HTML here is different between them. They look like they should use the same constructors and have the same code-styled output, and yet they're not.
I think that MathJax wants \[
for inline math, whereas "standard latex" now prefer \begin{displaymath}
(over $
). I think it's ok, and this is controlled via some options that are passed in.
Is there still a problem with >
? I don't think so?
Anyways, implicit multiplication is definitely a problem. At the very least, we should hand-insert some space (I tend to use \
, i.e. backslash-space in my own latex. Although we might want to use \thinspace
instead as a first experiment. That will definitely be better. We might still need to explore using an explicit multiplication symbol.