-
Notifications
You must be signed in to change notification settings - Fork 14
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
manual linebreaking and indenting/supporting mo attrs #164
Comments
This would be super nice to see, I've been working on and off the past year or so on a math rendering solution that takes semantic trees (in Openmath format) and presents them as presentation mathml. It currently renders to MathJax as MathML support in Chrome is still pending, but once it ships my intention is to target presentation mathml directly. However something that is painful is the lack of linebreaking support. Obviously automatic linebreaking is rather complex and has been deferred, but even support for this form of explicit linebreaking would be sufficient, as it wouldn't be hard to detect overflows and even pick operators to align to. In contrast linebreaking via table hacks would be a lot more annoying as it would potentially involve flattening deep trees and breaking their semantic stylability, i.e. what I'm doing atm is generating trees (roughly) like this: <mrow class="infixMinus">
<mi class="identifier">x</mi>
<mo class="infixMinusOperator">-</mo>
<mrow class="parenthesizedExpression">
<mo class="openingParenthesis">(</mo>
<mrow class="infixPlus">
<mi class="identifier">y</mi>
<mo class="infixPlusOperator">+</mo>
<mn class="number">x</mn>
</mrow>
<mo class="closingParenthesis">)</mo>
</mrow>
</mrow> Having to hack those into tables would involve flattening the entire structure and splitting it, this would be difficult to do without entirely breaking the targetable css classes. Whereas with the suggested linebreaking I could merely tag the respective operators with an attribute. Although with regards to the attribute, it would be rather nice if this was settable via CSS so that stylesheets can target linebreaking itself, which would open up even more possibilities than generating it automatically, e.g.: #mainExpression:nth-child(1 of .infixEqualsOperator) {
linebreak-name: "linebreakCustomName";
}
#mainExpression:nth-child(n + 1 of .infixEqualsOperator) {
linebreak: newline after "linebreakCustomName";
} |
@NSoiffer I think this is asking for those attributes in Core (since Full has them) Move this issue to Core? |
Belongs in core. This unfortunately won't happen this round. Should get the "level 2" label. |
The is related to #127, but I feel that #127 should (and so far is) about automatic linebreaking. However MathML 3 also has a number of attributes on
mo
that can be used for forced linebreaks and indentation. These can be useful for breaking at an=
and aligning subsequent lines on them as in:The linebreaking attributes from MathML 3 are given here; the indentation attributes are in the next subsection. To support the above functionality, the attributes that are needed are:
linebreak= 'newline'
linebreakstyle="before" | "after" | "duplicate" | "infixlinebreakstyle" (only before/after are high priority)
indentalign = "id" (other values are "left" | "center" | "right" | "auto" but not needed for manual indents)
indenttarget = idref
Maybe supporting indentshift would be useful also and easy to implement (just add to the left padding).
Supporting these attributes do not require any additional passes. Adding this support would be a good way to begin to support linebreaking.
The text was updated successfully, but these errors were encountered: