Unassigned SS-2326
2 votes

Make math regions align to "base line"

Created by Mike Kaganski on 4/22/2016 7:54 AM Last Updated by Martin Kraska on 9/23/2019 10:23 PM
%
 (hrs)
Logged: 0   (hrs)

 Description

Currently, position of math regions (with ordinary formulas) in SMath is controlled by their top left corners. Entering formula, as it grows, the region rectangle is expanded to the right and downdards. Adding comments moves the main area further (depending on the comment positioning relative to region). The height depends on using braces, subscripts/matrix elements, fractions, powers, sums, custom-drawn functions etc.

 

This makes good alignment of several expressions on one line generally impossible. Their baseline (i.e. the bottom of line on which left-hand variable name would be) isn't static, but depends on overall region height.

 

I propose to allow alingment of these math regions not by left-top corner, but to left point of baseline. E.g., in an expression like f.x:a/b, the lower line of "f" will be where the red cross was at the start of typing, and this line would stay constant whatever would appear to the right: subscripts (".x" in this example) would be below that line, fractions would go higher/lower just to allow "f" to stay fixed. Comments should go yet higher, not moving the anchor.

 

Any formula part already knows its baseline, i.e. their position relative to, say, equal sign. E.g., matrices should be aligned to their middle.

 

When deciding if an expression is "before" or "after" another, their align points (left of baseline) would again be relevant, not their top-left corners. Whis could lead sometimes to "visual discrepancies" when a definition looks being below while actually being at the same line or above, but currently there also exist such cases, when using comments makes such discrepancies - so this should not be a problem.

 

Inside complex structures, e.g. matrices, their elements should also follow this rule, thus making more natural appearance of matrices and such (see attachment).

 

The topmost line on a sheet should be slightly lower than it is now (to allow exactly one line using default font size). If a formula goes outside of the sheet upwards, let it be there, it's a user's responsibility to move it down. User would be able to select the region using mouse and drag it, or move red cross to the top line with arrow keys and use "Enter" to move everything at the same line or below downwards (as it is now).

 

Of course, using this mode, most existing sheets alignment would be skewed. To avoid that, the mode should be optional, and depend on sheet's setting (saved with file).

    Martin Kraska (Monday, September 23, 2019 10:23 PM) #

Starting with build 7200, workaround is to use embedded math in a text region. https://en.smath.com/forum/yaf_postsm59463_Edit-workflow-for-text-regions-with-embedded-math.aspx#post59463