Open BackThePortal opened 3 months ago
Just tried to see what's causing this bug. It's because of the way Typst parses parenthesis in a math environment. One way to solve it would be to add a space whenever a number and a parenthesis are together. It's not a perfect fix because it's not the way it should look.
This will be tricky to fix.
Another possibility is to close and open the math environment, like this: $"Fe"_2$$("SO"_3)_3$
. But I'm not sure how that would interfere with the rest of the code.
Hi, i tried fixing this by adding the space as suggested, but it will affect the behavior for state of aggregation. For compounds like NaOH, it will no longer be possible to put the state in the subscript. This needs some more work.
// on opening brackets...
if _char_in.contains(regex("[\[({]")) {
(_state, _out, _buffer) = (
+ "underscore": ("leading_punctuation", _flush_ce_buffer(_state, _buffer), " "),
"_": ("", "", "")
).at(_state, default: ("leading_punctuation", _flush_ce_buffer(_state, _buffer), ""))
}
Hi, i tried fixing this by adding the space as suggested, but it will affect the behavior for state of aggregation. For compounds like NaOH, it will no longer be possible to put the state in the subscript. This needs some more work.
Perhaps this can be solved requiring a space to be added between the compound and the state? I think it makes sense from a user perspective to type ce("NaOH (aq)")
instead of ce("NaOH(aq)")
.
Iron (III) carbonate is not displayed properly:
This is how it should look like:
The issue appears when there is a number behind the parenthesis, since cadmium cyanide is shown properly: