Creating Epub files

I use the Bullets and Numbering, Customise tab to atomatically insert the word Chapter and its number when I add Heading 1 after every page break in the book that I am writing. When I create an Epub file, these heading are omitted. Is this a bug or am I missing a step?

Why do you use Format>Bullets & Numbering on Heading 1? The dedicated numbering service is Tools>Chapter Numbering for your document outline.
By forcing a number with Format>Bullets & Numbering or buttons in the toolbar, you create a conflict between you (direct) formatting and the internal specific numbering.

Thanks for your reply ajlittoz. I use the Bullets and Numbering to automatically insert the word Chapter and the appropriate number out of habit I guess. It is simple to apply by clciking on Heading 1 in the Home ribbon toolbar. Since receiving your reply, I have tried to impliment Tools > Chapter numbering, assuming it would function similarly to the system I have already used in my books prior to publication. Unfortunately, it doesn’t appear to work in the same way and I am at a loss on how to use this feature. The Help documentation explains how to set it up but not how to apply it when starting a new chapter. I would be grateful to know where I am going wrong.

Basically Bullets & Numbering and Chapter Numbering use the same underlying engine, namely “list styles”. There is however a huge difference. Chapter Numbering is a dedicated list style explicitly reserved for chapter numbering. It is isolated from all other lists and consequently your outline numbering is protected against any interference. On the contrary, Bullets & Numbering is a “one-size-fits-all” convenience service for those who switch from Word without reading the manual. It will apply to all manually formatted lists and requires contorted implementation quirks to separate (semantically) different lists. There is a high risk of unexpected numbering and a real pain to force these numbers into what you really want.

Note that the theoretical definition of what is a list and how “different” lists are is quite difficult to grab semantically. In Writer, what defines the nature of a list is the list style applied to a paragraph.

After this lengthy introduction, here is the recipe:

  1. remove the numbering you apply with toolbar buttons or Format>Bullets & numbering. The simplest way is to use the No List button or Ctrl+Shift+F12
  2. make sure your headings are styled Heading 1 for chapter, Heading 2 for sub-chapter, …
  3. configure Tools>Chapter Numbering; for each level
    • in Numbering tab
      • select a Number sequence
      • make sure you haven’t changed the default association between level and Paragraph style: the style should be Heading n where n matches the level
      • type "Chapter "in the Before Separator
    • in Customize tab:
      • adjust Tab stop and Indent to leave enough room for the widest number at this level; set both to the same value

After this configuration, your headings when styled Heading n will automatically be numbered without further ado.

Warning! after pressing Enter at end of your headings, you’ll notice that the paragraph style for your text switches to Text Body. This is perfectly normal. Contrary to Word, the “standard” style for your discourse is Text Body. Default Paragraph Style should never be used for text because this style has a special role in setting default attributes for all other styles. Consequently, you are likely to meet “surprising” effects if you modify it supposing it is the default text style.

You hint in your comment you are using the “ribbon” interface. It is again a feature offered to ease transition from Word, but try to avoid it as soon as you become familiar with Writer workflow, i.e. style formatting. Learn how to use styles (read the Writer Guide for an introduction) and work afterwards with the standard UI and the style sidepane.

Hi Alittoz, I have implemented you suggestion of using the Text Body Paragraph Style. When writing a novel, the first paragraph of a chapter does not have an indent, while subsequent paragraphs do. To achieve this I have amended the Text Body options in the Organiser tab and entered Text Body Indent in the Next style entry. I assumed that when creating a new paragraph after a paragraph based on the Text Body Paragraph Style, the new paragraph would be indented. Unfortunately, it isn’t. Have I a misunderstood this feature?

The Next style property of a paragraph style is taken into account when you hit Enter. If you restyle an existing document, you must apply the “next” style yourself.

Since there is only one “first” paragraph in every chapter, select the full chapter contents, apply Text Body Indent then click in the first paragraph and reapply Text Body. This should be rather quick.

Ideally, Writer would have conditional indenting, where the first line is indented only when the previous paragraph is the same style. There is currently such a feature for spacing.

So yes, a different style for the first paragraph must manually be set, but as explained, this can be facilitated during text entry by adjusting the “Next style” in the paragraph styles. Not ideal, but not that problematic neither.

@Vanadium: I don’t like this idea of conditional styling. There is already the possibility to create conditional styles with limited context possibilities. The current implementation freezes the effective style once the context is known. Even if you change the context afterwards, the style does not change.

Your proposal is somehow different but I prefer to have full control on my formatting by choosing explicitly the style to apply. As you know, everybody has own tastes and YMMV.

Unfortunatelly, epub export does not export any automatic text, i.e., text generated by a field. Thus, automatic numbering of headers is not exported. Also lists, even not bulleted lists, are exported.

Considering the limitations, you must adapt if you want to use LibreOffice for this. This article by Bruce Byfield gives good insight.

Many thanks for your input. My work around is to save the document as a doc file (Word 97 -2003), then close this file. After reopening it in writer, I export to epub and my headings are intact. Oddly if you don’t close and reopen the file, the headings disappear as before. I guess the residual odt formatting remains while the file is open in Writer?

Yes. Any software that opens files in a non-native format, will first convert it into its native format. Don’t forget that the format is not merely used for storing, but also for display on screen. The code that displays the document and allows you to edit it, expects to get a document in the native format. When you save it again in that foreign format, it will convert back to that foreign format. Going back and forth between formats can introduce corruption. For that reason, you should always work with the native format, and save copies in the foreign format when you have to send a document in that format to somebody else.

Thanks for your for your comprehensive reply ajlittoz. I have implemented your method of creating numbered chapter headings after modyfying the Chapter style in the Paragraph Style list in the side panel.
Also thanks to Floris. Printers (Amazon notably) often send people preparing print-ready documents Word Templates. Trying to use those within Writer is a nioghtmatre and are, in my experience, best avoided.