Restart end-of-document footnotes per chapter

I was going to tell you that what you said only works in theory. But I just discovered an apparent caveat to your statement. What you said DOES work — provided there are at least TWO subdocuments inserted in the ODM and the second (or subsequent subdoc, not the first) is chosen. With only one subdoc, there’s no non-Text area in which to stick the new Text area. But with two or more subdocs, it works.

So far, so good. No progress elsewhere, but this at least is a step forward.

I’m on deadline for another project this morning, but I will try to create the pared-down version of the “good” file and get it to you before day’s end here in Virginia. Thanks for the offer, @ajlittoz !

@ajlittoz, one more question, please:

When putting the “trailing” Text areas into the ODM, is there some way to designate and tell LOW, “Put the collected footnotes here”? I can insert various indices, etc.; but I can’t find a way to designate the location of the Footnote section. Maybe part of my problem is that the footnotes don’t have a landing area…

Footnote location is configured in Tools>Footnotes & Endnotes in most generic terms (page footer, end of chapter, end of document). This is a “logical” location. You can’t specify a “physical” location: The sequence of text and sub-document sections is a continuous virtual stream. Writer uses the “logical” location and maps it over the “physical” stream, except perhaps for end of document where it might create a last text section in the master (I don’t remember though I made a test this morning before answering).

The issue is not in footnote landing area. They’ll have one anyway. I think it is in the generation process. While the document is scanned for layout, note contents is collected in some internal cache until the time it is needed (bottom of page, end of chapter or end of document). Then it is flushed out. The note number is computed when the note is met. The solution boils down to enabling some restart when conditions are met. Presently, the configuration doesn’t allow it. This is why I’m curious to see how your “good” document is encoded. It is possible that some change removed the possibility from the UI while the ODF specification allows it.

This has been my fear for the few weeks I’ve been wrestling with this. Which brings up a related question — Does an ODF (or ODM) file contain any memory of which version of LOW created it initially? If so, the “good” file might yield this information; and, if that’s the case, perhaps I could revert to that version for the duration of the project…

looking at my own files, it looks like there is an XML element <meta:generator> which reports the LO version used probably at time of last save. – Confirmed – If you save your original file as .fodt (for ease of reading the XML preamble), you’ll get your current version identification.

Extracting this information without modifying the file is a bit more tricky. An .odt is nothing more than a ZIP archive. Make a copy as a safety measure. Extract it in some convenient location. Open meta.xml in a text editor. Search for meta:generator. You’ll read the latest LO version which touched the file.

Responding this again:

  1. Would it be okay to include the ODM and a full two chapters of ODT? They’re short. In fact, the book from which they are taken is only a 6-in by 9-in format document. (I can zip these three files together to make them even smaller.) BTW, as you will see, this experiment was successful. It still re-numbers the footnotes at the end. I was afraid v.7.2.7.2 would strip away whatever “magic” was allowing this file to perform normally.
  2. Is there an upload option on the forum here? Or should I send it to you via PM?

To upload, either edit your question or add a comment. The tool has an icon looking like a mail basket with an up-arrow. I think you can attach the 3 files without zipping them.

@ajlittoz — FWIW, because I iterate through so many drafts while I write (why not, since storage is cheap?), I always add the current (and often the time) to a file when I save it.

That being the case, I wondered if it would be of any import that the ODM of the “working” footnote manuscript is dated “2017-02-06,” i.e., 6 Feb 2017.

I don’t think the date itself is relevant. The important factor is the LO version used to save it on this date.

Yes, and that’s what I don’t know how to determine. You said that looking at the XML reveals the last LOW version to touch the file. I was hoping the originating version info was imbedded.

"New users can only upload 2 files," and I was trying to upload the ODM and two ODTs. ZIPs don’t seem to be on the upload utilitiy’s radar either. If I posted these on a personal storage account (say, GDrive or Dropbox) could I PM the link to you?

Create a ZIP file.
Change the extent from ZIP to ODT.
So you can upload the file here.
Anyone who downloads your file must then change ODT back to ZIP.

Thanks, @Hrbrgr. It’s good to get to know one of the tricks of the forum.

1 Like

Footnotes-at-End-Test-zipped.odt (134.2 KB)
@ajlittoz, here you are. I hope you can ferret out the secret.

I apologize for the delay. When I pressed the “send” button yesterday, the ever-vigilant forum-bot kindly informed me that I had sent the maximum number of messages allowed to new users, and that I would have to wait 13 hours before sending my next missive. Oh, well — patience is a virtue to be mastered…

First result: the “chapters” were written with LO 5.0.3.2.
I’m trying to discover the setting to reset footnote number. Perhaps, there was no parameter forcing in this release when you switch from notes at page bottom to at end of document.
There are also “many” formatting “rrors”, the most serious of which is using Default Paragraph Style for real text. This style is the ancestor of all others and everything you set there forces you to override in other styles when that setting conflict with your graphical charter.

EDIT
It was very difficult but I found something. I think a change between 5.0.3.2 and now (7.3.4.2 on my computer) is to be blamed for the difference. From experiment, when you configure your footnotes for “end of document”, numbering is reset to “per document”.
In the underlying XML, if I force the setting for “chapter”, Writer behaves as you were used to. Consequently, code for it is still there. I suppose this parameter forcing was introduced to remove a case of numbering ambiguity for the common case where notes at end have no chapter separator.

Bug report is tdf#150207

The temporary fix for you is not obvious and may be dangerous for your documents. I’ll give a procedure in an answer.

Analysis your “chapters” shows that your formatting is rather “elementary” and can greatly be improved.

  • don’t use Default Paragraph Style for your text; Text Body is the standard style for this
  • you never use character styles; instead you apply manual formatting for bold, italics and other variations
  • don’t use empty paragraphs for vertical spacing; instead customise paragraph styles; since you don’t pay special attention to the style of these empty paragraphs, some of them are Heading n and end up in the TOC forcing you to manually edit the TOC to erase spurious entries
  • you number your chapters manually instead of relying on Tools>Chapter Numbering; in case you shuffle your chapters, you’ll have to renumber manually
    If this is motivated by your need for unnumbered chapters, you can always have unnumbered headings by pressing Bksp once at the very beginning of a heading. This removes the number.
  • don’t use manual page breaks for forcing page parity (starting a chapter on a right page); you’ll have to check this manually whenever you edit your book; instead play with page style properties and their automatic sequencing
  • instead of inserting chapter “separator” manually among the end notes (which is not reliable in case of edits and isn’t possible with real endnotes), attach an unnumbered footnote to a chapter heading; the corresponding note will be inserted at the right location and you can style it with any style you like. With fields, you can also echo the chapter heading automatically, so that you don’t need to type it again (and when you modify it, the field updates)
  • you’re not consistent in your end-of-sentence horizontal spacing
    Sometimes you use two spaces after a full stop. This translates to a <text:s/> element in the XML (I don’t know what it does but I’d recommend using a single space and letting Writer do the job; double spaces disturbs its job)

image

Note that for a new document, this is set to Per document, and there’s no way to change it to anything else, because there’s only one element in this list.

The Per document seems to imply exactly what is wanted, but works differently. Possibly needs investigation what changed this; I suspect one of Caolan’s welding commits.

@mikekaganski what I meant in fact was a “reset in the XML”. I found it through trial and error.

I filed a bug report (or is it a feature request?) at tdf#150207.

If you feel brave, here is a procedure to workaround a change between releases 5.0.3.2 and 7.3.4.2. It may very easily damage your document. Consequently backup your subdocuments in some directory before attempting the patch.

Work in your master and sub-documents without caring for effective note numbering. It is usually wise to work with the latest available LO release than with an outdated one. You benefit from new features, bug fixes and generally improved performance and better UI. When you’re ready for the final proof, follow the procedure:

  1. Save your master and sub-documents in some backup directory so that you have an up-to-date copy in case something goes wrong
  2. Apply the following patch to every sub-document
    1. Open the sub-document and save it .fodt; close
    2. Open the .fodt in text editor, preferentially one which has an XML operating mode (under KDE Plasma I use KWrite; under Mate, gedit is probably a good choice)
    3. Look for the <office:styles> block
      It seems to appear after <office:settings>, <office:scripts> and <office:font-face-decls> blocks. If your text editor is XML-aware, you can click on the margin triangle to “close” the block and decrease screen clutter.
    4. At the end of this block, there are two <text:notes-configuration …> elements, one for footnotes, the other for endnotes
    5. The one for footnotes ends with an attribute text:start-numbering-at="document"; change document to chapter
    6. Save
    7. Process the next sub-document
  3. Rebuild the updated sub-documents; for all of them:
    1. Open the .fodt version of the sub-document in Writer (may need a right-click to force launching Writer on it)
    2. Don’t use Tools>Footnotes & Endnotes **otherwise you’ll have to replay the preceding stance
    3. Save as .odt without any edit
      This overwrites the existing .odt; so check that the backup exists before allowing to overwrite.
  4. You can now open the master to verify that the notes are numbered as you expect.

Hmm. Sounds tedious, but not difficult, especially with the “safety net” of backup folder for insurance. Well, okay, maybe tedious and blood-pressure-raising for the first two ODTs. After a few successes, the “bravery” you mention will be unimportant. The big deal is the “little deals” — not unbalancing quotation marks, <>'s, and not clipping final /'s.

Throughout this process, I was wondering if it were safe to update everything to the latest version of LO. I was mainly afraid that’d I’d lose the “success” in the older file (the one from which I sent you the sample). Apparently that’s not an issue if the sample I sent you behaved as advertised.

BTW, you mentioned release 5.0.3.2. Since that’s not one of the ones to which I referred, did you just pull that out of thin air, or did you actually find it in the code of the files I sent you?

Other observations / questions:

  • I used an experimental ODT and sic’d the Mate Extract utility on it. Interesting unpacking! Is there any problem with using this utility? (Not for the process that you have described above; it’s just a general question for future exploration.)

  • On text-based files (e.g., CSS, HTML) I use Geany. Any problem with that app? As I recall, I can pick an option that lets it know I’m working with a particular type of file or language. In my test, it automatically picked up the fact that the FODT was an XML file.

  • After experimenting further, it looks like I can save a lot of time by just searching the open FODT on the phrase 'at="document"'. The line for footnote comes before the line for endnote; and apparently only the <text:notes-configuration text:note-class="footnote" line seems to contain the search string.

I just had a meeting canceled for me this evening, so I’m going to carefully experiment on two of the chapters in question, using your magic recipe. I’ll report back, and I hope to do so gleefully.

Thanks for all your help on this!

This is what is recorded in <meta:generator> at the beginning of the .fodt file (or meta.xml in the .odt).

No problem as long as you can patch neatly the .odt. I preferred to explore .fodt because I bypass the compression step.

Right, that quite a long time I haven’t worked under MATE and I forgot the name of the “standard” editor.


For your last point: use any search criteria as long as you hit the correct target.

I’ve thought a bit longer on my procedure. It can be simplified. Set the “chapter” attribute. Then, as long as you don’t reference Tools>Footnotes & Endnotes, the setting in XML won’t change. But if you reconfigure the notes, you must again patch manually the XML. Thus, the patching procedure needn’t really by applied as the last step.


BTW, have you read my last comment above the “answer”. I give you many points to care for to avoid trouble with edits.