How to apply hanging indents to modified heading styles?

Hi,

I think I have the right terminology for this question, apologies if I don’t. Long time LibrOffice user, first time question asker. Using version 7.4 on Windows 10.

I am attempting to put a hanging indent on several of the heading styles in a large document (my PhD), with many nested sub-headings. I’ve been pretty careful about using styles and avoiding direct formatting, so I’m trying to do this the ‘right’ way, i.e. by editing the styles for the relevant heading types (1, 2, 3, 4 etc.).

To be clear, when I say ‘put a hanging indent’, what I mean is that I modify the relevant style (say Heading 2) so that the ‘before text’ indent is (say) 2.0cm, and the ‘first line’ parameter is -2.0cm (not that I apply the hanging indent style).

For some reason, when I try to do this nothing changes for the visible formatting on the headings, even though it works fine for other styles (e.g. Text body). That is, when I click ‘apply’ on the modified style, the headings stay as they were. I tried clearing any lingering direct formatting first with Ctrl+M, but this doesn’t change anything.

Any ideas why that is? I presume it’s something to do with the pre-sets of the heading styles and how they work with chapter nesting, but maybe I’m off base there.

In case it’s helpful, the effect I’m trying to achieve here is not a ‘traditional’ hanging indent, but to have the chapter section numbers set to the left margin, then a gap, then the heading text. Here’s an example of what I wish to achieve, which in this case I’ve just brute forced by tabbing along the second line:

I assumed the way to do this properly (i.e. in such a way that the text, font size etc. can be changed without messing it up) would be to create a ‘hanging indent’ formatting as described above, then manually insert a tab instead of a space after the section numbering. But that doesn’t work because of the problem I describe. If there’s an entirely different and better way to achieve the effect, I’d love to hear it.

Thanks any help!

IMO you are using some kind of chapter (heading) numbering. Be aware that numbering overwrites the left indents of paragraphs. So your hanging indent has to be defined in the numbering options (Position).
To make it clearer share a sample file for better checking.





Initiate the heading numbering in menu Tools | Heading numbering… and not directly by the numbering icons.

Your problem description is incomplete. You didn’t tell how you generate the numbering.

You do this with Tools>Heading Numbering where you select the kind of numbering in the Numbering tab.

In principle, modifying indents in Heading n paragraph style is enough to create hanging indent effect. This is what I get. However there are a few caveats.

  • chapter headings are a list
    A numbered list is made of a paragraph (with a style) which is associated with a list style. Heading hierarchy is special in that the list style is an internal protected one. Nevertheless, headings are a numbered list like the others.

  • usage of Tab
    In a list, initial Tab keypress (at start of heading) does not insert a tabulation. Instead, you change the level of the heading (attaching it to level n+1 when you’re at level n; the reverse is Shift+Tab). Inserting a tabulation between the number and text must be done with Ctrl+Tab.

    But, you then depend on tab stop definitions in the paragraph style and even the implicit stop at left indent seems to fail. Therefore it is much better (and recommended) to insert the tabulation through the Position tab of the list style (or Tools>Heading Numbering) Followed by parameter.

  • precedence between paragraph and list style
    Normally, the list style take control of the indents, overriding what is defined in the paragraph style. Though Heading n indents seem to be applied (because heading numbering has many extra properties compared to usual lists), it is safer and more reliable to configure Position tab parameters:
    Indent at is equivalent to before text indent and Aligned at to first line indent except you don’t measure it relative to the indent. What you would write at -2 cm and 2 cm in a paragraph style is set with 0 cm and 2cm in Position. And, most important, set Followed by to Tab stop to jump to the indent position (remember you can hardly insert a tab at head of heading).

To summarise, it looks like you did everything right but direct formatting is very insidious. So, for a better diagnostic, attach a sample file.

Hey,

Thanks for the immensely helpful and detailed response. The explanation of the heading numbering system is very useful, albeit I haven’t quite been able to get it to work to resolve my problem.

I tried doing as you suggested, i.e. doing all formatting through the position menu. When I set Indent at to 2 cm and Aligned at to 0 cm (which I understood to be your suggestion), it still produces the effect that the whole heading moves to 2 cm, i.e. no hanging indent, as was my problem with trying to achieve this by modifying the styles. Maybe I am missing something.

In any case, here is a sample document. See headings 2 and 3 (indents set through position menu in this case).

As a point of clarification, when you write ‘Heading n indents seem to be applied (because heading numbering has many extra properties compared to usual lists)’, are you referring to my style for the numbering? E.g. that I have section signs and different character sets for the subsections, such that a sub-section may be called §III. 2. i. a), for example? If so: I have been typing that manually for each sub-heading, as I didn’t think that there was a way for Libreoffice to do that automatically? Am I mistaken and/or storing trouble up for myself when I assemble the final document? (at this stage in the PhD, it’s still in separate documents for the chapters)

Thanks again.
Sample File for LibreOffice Forums - position experiments.odt (57.1 KB)

There is something sticky in the heading styles preventing Heading Numbering numbers from being displayed. It might be residual from a bug in one of the version 7’s of LibreOffice.

If I

  1. Remove direct formatted List numbering from Heading 1. Irrelevant to the problem but bugs me.
  2. Convert each heading to Body Text and then back to its original Heading n style

then I can apply Heading Numberings and have them display. In the sample below, I have converted to Body Text and back to Heading n as far as half way down page 3
Sample File for LibreOffice Forums - position experiments_EA.odt (47.5 KB)

2 Likes

Point of clarification: my statement applies to the peculiarities of Heading Numbering which departs slightly from common list properties.

Let’s analyse your sample file.

  • direct formatting (DF)
    Your document is plagued with a lot of DF. Like most of us, you were educated with Word (decades ago, it was the sole “reasonable” available tool). Word provides only “paragraph styles” and everything else must be done with DF, e.g. highlighting words or characters. This is how you made sequences italic or bold. Writer has character styles for this which allows to make semantic distinction between words looking the same (e.g. for italics emphasis or foreign words). Among built-in character styles, you have Emphasis and Strong Emphasis.
    Note that by giving “semantic” names to styles, you are totally free to tune your highlight any way you like without contradicting the name. If you name your emphasising style Italic and later decide tht it would be better as Roman red, what would mean the Italic name?

    You have also a highly treacherous form of DFwith your empty paragraphs used to vertically space your text. These empty paragraphs can ruin your carefully crafted layout depending on the edits in preceding text: they can cause unexpected shift of text to next page and make manually inserted page breaks create an unwanted blank page.
    Such empty paragraphs must be replaced by spacing above and/or below in the paragraph style. In the sample file, it seems this should be done on Heading 4 style.

  • bad interpretation of heading concept
    Applying a style means giving a significance to an “object”. In Writer a paragraph is the main semantic unit. I emphasise unit because this is what Writer retains when dealing with high-level constructs such a lists, headings or TOC.
    In the case of headings, the paragraph is the base of semantic parts making the outline of the document. Remember also that headings are generally members of a list (when Tools>Heading Numbering is enabled`.
    Your applied Heading 1 to three paragraphs at start of the document (“Part I”, “The chain of …” and “The Passage …”). You then have 3 level-1 headings receiving 3 different numbers, while all 3 paragraphs belong in a single heading. This is a flaw.
    This can be fixed by using line breaks Shift+Enter between the elements of the heading instead of paragraph break. To space apart the lines, modify line spacing in the paragraph style.

  • automatic line numbering
    Enable it in Tools>Heading Numbering. You can choose the kind of number separately for each level. You can also select how many levels are inserted in the number. And you can add prefix and suffix separators.
    You can then remove your manual numbers.

  • hanging indent
    Once numbering is enabled, you can tune its position in Position tab.
    Except for level 1, I aligned all numbers to 0cm, requested a tab stop after it and set indent and tab at 2 cm.

Study my revised version Sample File for LibreOffice Forums - position experiments-ajl.odt (44.5 KB)
Styles have been modified accordingly.
As mentioned by @EarnestAl, previous manual tweaks on the headings resulted in “sticky” DF masking automatic style updates. The usual cure is to apply another style, like Body Text then the desired modified style like Heading 2.

Above all, eliminate direct formatting, even what is not considered as such by beginners like vertical spacing with empty paragraphs. Since you seem to be dealing with semantics, remember that empty paragraphs are nonsense: you suppose they have no significance (carry no information) but their mere existence is a statement by itself and they must be taken into account and dealt with. They have become “important”.

Use exclusively styles. Follow a methodical procedure I call semantic styling. Styles are not formatting directives primarily. They are meta-markup through which an author communicate his appreciation of importance (significance) to Writer. Styling is an important part of creation. In a secondary step, styles are use for formatting. Don’t let this step take precedence over your intellectual structuring of your job.

2 Likes

I respond here to both EarnestAI and ajlittoz, mostly to say: thank you! The ‘problem’ is solved, i.e. it turned out mostly to be my lack of understanding of the power of the Heading Numbering function, which I had not really explored. The ‘trick’ of changing styles to Text Body (or whatever) and back in order to erase some of the ‘sticky’ DF is also very useful.

With respect to your general point about semantic styling ajlittoz, it’s well taken. I have some familiarity with the rigours of that kind of approach from my (rather introductory) experience in LaTeX, and you’re right that I blasted past those kind of things in LibreOffice because, well, the interface allows it, and I just patched practice together my decades old Word experience. I’ll adopt as much of that as I can as I revise the document

With respect to the advice to use character styles instead of direct formatting in bold/italics, that makes a lot of sense, and I wish I’d used it before. Unfortunately for this particular project we’re talking a PhD dissertation that I’m handing in on 1st December and is currently 120,000 words + in about 8 documents that needs to be combined, so I’m not going to be able go through rigorously and replace all of that manually this time. Unless there is way to automatically swap out say Bold for Strong Emphasis in an existing document? (I presume not) In any case, I’ll follow this as practice for my next long project.

From a workflow perspective, presumably one can simply just swap out the keyboard shortcuts using Tools>Customize>Keyboard so that, e.g., Ctrl+ B is now mapped to Strong Emphasis instead of Bold (etc.)? Then one can carry on writing in the ‘default’ (out of the box) way from a typing/input perspective, but the document will be semantically styled (in your terms)? Is there any reason I miss not just do that? (Learning a lot here)

Thanks again to you both.

First, this site is not a forum and makes distinctions between answers and comments. Answers are reserved for solutions and may be reordered by the site engine, thus losing chronological order. Answers are supposed to be independently read by visitors. Comments are attached either to the question (to request clarification or additional details) or to answers to highlight some points or clarify others while submitter may ask enhancements or explanations.

Thanks for the feedback but it should have been posted as a comment.

Use the various options in Edit>Find & Replace to select all occurrences of some formatting. With or without leaving the dialog, you can apply a style to the selection.

However, this is only a poor workaround because your present Bold may be applied to several different “significances”. Simple Bold has lost information about your intent. Thus applying an ad hoc style requires more manual process.

Yes. I customised my keyboard so that Ctrl+… applies to my most frequent paragraph styles and Alt+… to most frequent character styles. Similarly to built-in Ctrl+0 (zero) which reverts to “neutral” Body Text, I set Alt+0 (zero again) to revert to No Character Style by symmetry.

Gotcha. I didn’t understand the answers/comment distinction, noted for the future.

All very clear. I’ll use Find & Replace best as I can on the existing documents and adopt a more systematic ‘semantic’ styling from here on out.

Yes. I customised my keyboard so that Ctrl+… applies to my most frequent paragraph styles and Alt+… to most frequent character styles. Similarly to built-in Ctrl+0 (zero) which reverts to “neutral” Body Text, I set Alt+0 (zero again) to revert to No Character Style by symmetry.

A very nice practice; I’ll steal it.

Thanks again.