In my notebook the text cells "stick out" like this:

enter image description here

Instead, I'd like the to be left aligned (plus some margin) with the cell they are grouped under... How can I achieve this from the stylesheet?

Cell[StyleData["Text"], CellGroupingRules->{"SectionGrouping", 60}]
  • 1
    $\begingroup$ I'd suggest using ItemParagraph, instead, (and SubitemParagraph and SubsubitemParagram as needed), as it is built specifically for this purpose. $\endgroup$ – rcollyer Sep 8 '15 at 19:16
  • $\begingroup$ But I would prefer this behavior by default, and I don't want to switch the default cel type from Text, (and Ive run out of menu command keys to use) $\endgroup$ – M.R. Sep 8 '15 at 20:23
  • $\begingroup$ Have you used !@#$%^&*(), yet? That said, I am looking for a solution; Inherited does not seem to want to cooperate. $\endgroup$ – rcollyer Sep 8 '15 at 20:29
  • $\begingroup$ Perhaps not, but I'd rather not have to remember yet another key lol $\endgroup$ – M.R. Sep 8 '15 at 20:33
  • $\begingroup$ I feel your pain. I tend to closely modify cell styles, so that if I want the alternate, I just add shift. $\endgroup$ – rcollyer Sep 8 '15 at 20:37

You can give "Text" cells the option CellMargins -> AbsoluteCurrentValue[PreviousCell[], CellMargins] in your stylesheet. Here's a pic of a notebook using this option for Text cells:

enter image description here


It seems that for versions before M12 you need to include a Dynamic wrapper. So, use:

CellMargins -> Dynamic @ AbsoluteCurrentValue[PreviousCell[], CellMargins]

or perhaps even better:

CellMargins -> Dynamic @ AbsoluteCurrentValue[PreviousCell[CellStyle -> {"Section", "Subsection"}], CellMargins]
  • 1
    $\begingroup$ That will fail if e.g. Output figures are inserted between paragraphs but +1 anyway. $\endgroup$ – Kuba Apr 30 '19 at 6:38
  • 1
    $\begingroup$ Probably better to use CellMargins -> {{FEPrivate`Part[FrontEnd`AbsoluteCurrentValue[FrontEnd`PreviousCell[], CellMargins], 1, 1], Inherited}, {Inherited, Inherited}} no? Only the lateral margin should be pulled from above. $\endgroup$ – b3m2a1 Apr 30 '19 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.