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
MathML Viewer widget: allow for the custom rendering of a variable using TeX #2738
Comments
My current proposal is described at #2744 (comment). @dbrnz and @nickerso, is that something that would work for you? |
We might want to look at https://github.com/goldsborough/latexpp, even though it's not active anymore. |
adding a new "extension" element like |
Fair enough. Ok, so we could do something like this:
<variable name="A_my_superscript_my_subscript" initial_value="10" units="dimensionless"/>
<variable name="A_my_superscript_my_subscript" initial_value="10" units="dimensionless" cmeta:id="my_unique_id">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:opencor="http://www.opencor.ws/">
<rdf:Description rdf:about="#my_unique_id">
<opencor:rendering>
A^{my\_superscript}_{my\_subscript}
</opencor:rendering>
</rdf:Description>
</rdf:RDF>
</variable> In the CellML Text view, we could have that rendering information expressed as follows:
@nickerso and @dbrnz, is that something you would be happy with? |
I wonder if we are looking at this in the wrong way. @agarny's suggested solution looks reasonable if we want to simply let people provide a specific way to render a variable name in the built-in math viewer using LaTeX, which is nice to have but not something that we'd be wanting to support long term. I wonder if a more sustainable path forward is to explore a more explicit break from the current 1:1 mapping between the OpenCOR text format and CellML. Something would enable more of the semantics to be described "easily" by users, giving a more meaningful rendering of variable's in the internal math viewer but also giving knowledge that could be useful outside of OpenCOR. For example, instead of:
how hard would it be to instead do:
and then serialising the additional knowledge as annotations. Would need to decide what the different type of is and in things could be and what happens when they are not present, but I think this puts us on a path to start capturing a lot more knowledge at time of model authoring rather than just a slightly different representation of the variable name. And will allow for the specific styling to be changed as needed, and potentially let the user define / choose their preferred styling. |
This issue came about because the MathML viewer cannot currently render variable names in a way that is meaningful to bond graph modellers. However, we should be able to solve this problym by using TeX (and with the help of a library such as blahtex). Now, I appreciate what you are suggesting with regards to giving knowledge to a variable, but I am not sure this is the best place to do it. Isn't annotation supposed to be stored in an external file (since people might want to annotate the same thing in different ways)? Also, could we come up with some semantic information that accounts for the different ways we might want to render the name of a variable in the MathML viewer? Otherwise, in your example, I can't see |
Whoops! It could be inferred for some models based on the units, but agree that it needs to be specified. I'm exactly thinking of the bond graph use-case here. Current convention is to have the solute/substrate as a superscript and compartment as a subscript. Sometimes also the type of energy as a subscript. Not that long ago, the convention was to have a combo solute,compartment subscript. Hardcoding the LaTeX would require these models to be changed in order to render according to a different convention. Capturing the semantics would allow the rendering to change with no need to change the models or annotations. |
Hmm... so, we would have some semantic that is very much bond graph dependent? Although this issue was created to help bond graph modellers, I don't think we want a solution that is bond graph specific. |
I agree, shouldn't be BG specific. But if you look at the use-cases to support with this kind of advanced rendering, it is generally the same across a large portion of models in PMR. Just trying to think of ways to get something more useful than a bit of LaTeX code that is only ever going to be used in OpenCOR. While being concerned that providing a simple way to provide LaTeX for display in OpenCOR is going to rapidly populate a cohort of models that will need support going forward... |
Ok then I am not sure what to suggest. I am not sure we want to spend too much time on this issue since we want to move to Web/Electron OpenCOR, so...? |
Right now,
A_b_c_d_e
will be rendered as a succession of subscripts. However, for some models (Bond graph models), it's common to use superscripts and subscripts. So, something likeA_b_c
could haveb
rendered as a superscript andc
as a subscript. Note that we probably want to stick to_
as the delimeter since it is part of the CellML name set of characters.The text was updated successfully, but these errors were encountered: