Do we **really** want bare symbol 'b' to be TeX-typeset in Roman? #3443
gwhitney
started this conversation in
Design decisions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, pretty counterintuitively,
math.parse('a').toTex()produces' a'whereasmath.parse('b').toTex()produces'\\mathrm{b}', on the theory that a bare symbolbis by default a valueless quantity of bits. I think that's the wrong or at least unexpected/undesirable result for 99% of use cases, especially as "b" for bits is a really rarely used unit symbol. It's much more likely that a barebin an expression is just a plain ol' symbolic variable likea, and should be typeset in math italic. The current behavior is particularly egregious in a formula likelog(b), where a Unit value isn't even allowed as an argument tolog.How can we adapt/configure/extend/improve
.toTex()to get this correct from the client's perspective for the 99% of cases, while still allowing some way to getmath.parse('5m').toTex()to put themin Roman when the actual meaning really is 5 meters? Again, 'm' is such a common variable name to use in mathematical expressions that even though it's also a common unit, I bet at least half the cases of using this in a formula that's being converted to TeX want the italic 'm' for a variable, not the Roman 'm' for a unit, especially as toTex() seems much more likely to be used in a math setting than an engineering/unit-based setting. (The big overlap would be in a physics context, where both variables and units are pretty common, and where practitioners might be interested in converting a formula to TeX.)Just brainstorming, the default behavior for toTex() could be to only look up multi-character symbols as far as whether they are units, and typeset all single-character symbols in math italic. Then we would have to add an option, something like
asUnit: ['m', 'g'], for someone who wants single-character meters and grams symbols set as units.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions