-
Notifications
You must be signed in to change notification settings - Fork 189
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
Support physical units #129
Comments
Suggesting something even simpler, e.g.
Noting that dot directly following a number has no useful meaning (prints currently simply as a dot). Using some character other than dot could be safer, if it needs to be a strictly nonbreaking change. Either way, quotes at both ends of the unit are still quite ugly. Units formatting also should add a narrow non-breaking space between the number and its unit where I believe Sometimes units need to be printed without a number so that is also a concern. Technically the dot prefix could also work for this:
One concern is when to break out of unit mode, and in that regard the surrounding quotes are simpler. Otherwise spaces, parenthesis and division could either be part of the unit expression or a continuation of the equation (after which letters should appear as variables again). |
There is an old note from 2003 on how to use units in MathML https://www.w3.org/TR/mathml-units/ with a short segment on presentation MathML. <math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle>
<mn>42</mn>
<mo rspace="thickmathspace">⁢</mo>
<mi mathvariant="normal" class="MathML-Unit">N</mi>
<mo>=</mo>
<mn>42</mn>
<mo rspace="thickmathspace">⁢</mo>
<mi mathvariant="normal" class="MathML-Unit">kg</mi>
<mo>·</mo>
<mfrac>
<mi mathvariant="normal" class="MathML-Unit">m</mi>
<msup>
<mi mathvariant="normal" class="MathML-Unit">s</mi>
<mn>2</mn>
</msup>
</mfrac>
</mstyle>
</math> One could maybe write the si units in full
a bit similar to https://ctan.org/pkg/siunitx? |
Currently, it's cumbersome to write physical units with AsciiMath, for example:
42\ "N" = 42\ "kg"*"m"//"s"^2
Note that
\
(escaping the space) is needed to ensure an space is inserted between the number and the unit, double quotes to ensure the unit symbol is not in italics, and//
to have the usual division style. Furthermore, it's not possible to use double quotes when the unit symbol contains a Greek character (such as microsecods), so as far as I know it's not possible to show those units symbols with the correct typography.It would be very nice if AsciiMath provided some specific syntax for correctly representing physical units easily, maybe when surrounded by apostrophes or something similar:
42 'N'= 42 'kg*m/s^2'
Ideally, having a simplified syntax for units would make this feature even more readable (e.g see UCUM for a plain text syntax designed for physical units), as anyway it has no sense to write any AsciiMath expression inside this units environment:
42 'N'= 42 'kg m/s2'
In both cases, this would make AsciiMath even more attractive for engineers, thank you very much.
The text was updated successfully, but these errors were encountered: