I have a rule when writing text and equations. Starting from the Section
environment, each text/equation that sits inside Section
will get indexed by one Tab. Anything that lives inside a Subsection
gets a further Tab (i.e. 2 Tabs) and so on.
Now, as I expand my notebook, sometimes Sections become Subsections or vice-versa, meaning that I need to go back and correct all the indentations manually.
Is there a way to automate this?
Carl Woll's answer to add a dynamic wrapper such as,
CellMargins -> Dynamic[ AbsoluteCurrentValue[ PreviousCell[CellStyle->{"Section","Subsection"}], CellMargins]]
works. However, Mathematica becomes rather laggy. I am assuming it is because Mathematica keeps checking each line of text all the time. Ideally, it would only do that once (e.g. when the Stylesheet is selected as it does so with the above code) and anytime a grouping occurs or when a Style environment (e.g. via Alt+ (1-6)) is created. This sounds a bit complicated, so alternatively, it is fine if a button is created that sorts the selected grouping as desired.