-
Notifications
You must be signed in to change notification settings - Fork 26
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
Display Variable Names Better in LaTeX #1639
Comments
This comment has been minimized.
This comment has been minimized.
What other "phrases" should be displayed like this? "max" and "min" jump out at me. @smiths |
To get this right, we will indeed need to change |
You mentioned on a commit that we should be capturing semantic information; what information should we be capturing and how? |
Shoot, it has now been too long, and I don't remember -- and the commit wasn't linked! |
Thanks, that helped. The idea is to find a common theme to the subscript. In the first two cases, I think we want to display those in Romain, while in the latter, in the usual Math font. If I had to take a guess, I'd say that the separation is that the |
I like the idea of @JacquesCarette to decide the formatting based on the semantic information, but I think we shouldn't invent any rules. We should follow the standard typographic conventions, as summarized at: https://en.wikipedia.org/wiki/Typographical_conventions_in_mathematical_formulae These rules say that italic font is used for variables and upright font for everything else. This rule applies for subscripts and superscripts as well. The example at Wikipedia is By these rules, I think My original motive for asking @samm82 to create this issue was simply to get the subscripts (and superscripts) to look better. The default spacing, where LaTeX thinks it is multiplying a bunch of single letter variables, is distracting. |
Good find - we should indeed go with those rules. |
How would we differentiate between a variable and a non variable? Rename the |
Neither |
This comment has been minimized.
This comment has been minimized.
I think ShortHands should use |
Should ShortHands have a short hand for |
I definitely agree with @JacquesCarette's comment from above. Some symbols are variable, and some are not. That is the distinction that matters. We do not want to impose Roman font, since someone may use another font for their equations. What we want is to put whatever font it is in italic mode, when the symbol is a variable. This would only be done at the point of display. @JacquesCarette is better to answer your question, but I have a suspicion that we do not currently have the semantic information that we need in Drasil equations. We might know that some things are variables, but I'm pretty sure that for some of the labels that we use for subscripts, we don't really know. I do not know the best approach here, but my instinct is that the default for subscripts and superscripts is that they are usually not variables. |
I don't understand your "Should ShortHands have ..." question. Can you provide some examples for context? |
Before, ShortHands had every letter as
Should ShortHands define each letter as a varLK = Variable "k"
labLK = Label "k" I'm wondering if this is related to the "hardcoding" you mentioned in this comment, @JacquesCarette. |
I totally didn't get that I think we only want short-hands for single-letter variables. Labels should be application-specific names, and should not occur in In particular, "x, y, z" from that comment might be defined in |
Should I just define the symbols themselves, or should I define the helper functions to add them as a subscript? If so, would |
Defining the 3 symbols x, y, z might go in |
For now, until we think about this more, would it be OK for me to just move the helper functions ( |
That would already be better, yes. |
I think there's an issue where the symbols are being printed through symbol :: L.Symbol -> String
symbol (L.Variable s) = s
symbol (L.Label s) = s but the code for pExpr :: Expr -> D
...
pExpr (Row [x]) = br $ pExpr x -- FIXME: Hack needed for symbols with multiple subscripts, etc.
pExpr (Row l) = foldl1 (<>) (map pExpr l)
pExpr (Ident s) = pure . text $ s
pExpr (Label s) = command "text" s where |
Found the cause; this function in symbol :: Symbol -> P.Expr |
Where does that code in your message (i.e. the listings for
So could you give a concrete example of something in an example that is somehow coming out 'wrong', because of the above code? Your report is too incomplete (i.e. there's too much information that's still in your head instead of in the report) for me to really understand the real problem you're seeing. |
Sorry for the lack of information. This is definitely a different issue than this one, so I created one here: #1756. Let me know there if you need anything else 😊 |
Variable names with "words" (like "offset") shouldn't be displayed in italics and with proper kerning in LaTeX (using \mathit{} or \text{}), possibly using a new constructor for
Symbol
.The text was updated successfully, but these errors were encountered: