LIbreOffice Writer: I have existing document (.docx or .odt) which has numbering, like
3.
3.1.
3.1.1
I want to add or remove some numbered paragraphs, reformat and apply style to the entire document. How do I format the document while keeping the existing numbering style?
Please reopen the question (to group everything at the same location) to better explain your case. What are the “numbered paragraphs”? Are they headings, part of the outline? Are they members of a multi-level numbered list?
What do you mean by “reformat and apply style”? Do you want to remove all direct formatting and follow a strict styling method?
Be aware that such an overhaul is possible only on .odt documents. Due to shortcomings in DOCX format, your edits will revert to direct formatting on save. .docx documents progressively degrade due to cumulative effects of conversion back and to alien format.
Mention OS name, exact LO version. Give us an idea of your skill with styles. Do you know of all categories (paragraph, style, page, list and frame)?
LibreOffice 7.0.4.2 on Linux Debian
To limit and clarify the problem: I mainly work with documents (.doc, .docx) that were created by someone on Windows. They have different formatting, which is not suitable for me. Sure, I can save them in .odt format, then edit and format them as I need. By “numbered paragraphs” I mean the common documents numbering like this:
-
Chapter Heading
3.1. paragraph
3.1.1. paragraph -
Another Chapter
4.1. paragraph
… …
In many cases, I need to remove some paragraphs from document: how then to renumber all the paragraphs in the document?
Some documents have broken formatting, different indent before and after text, etc. Yes, basically I wanted remove all direct formatting and follow a strict styling, somehow organize this.
Can’t be done (not persistent) if you insist on saving .doc(x) because all character, page and list styles will be replaced by direct formatting on save. Only paragraph styles will be kept within some limits.
Be aware that if your documents have undergone a lot of editing sessions, their formatting structure is already strongly damaged, preventing any easy cleaning.
If your headings are auto-numbered, this is done automatically. Check they are styled Heading n (this should be converted from DOCX) and auto-numbering is enabled in Tools
>Heading Numbering
.
This is becoming outdated. After 7.6.x, numbering switched to yy.mm.x.y (mm 2 or 8), starting in Feb 2024 24.2. We’re expecting 25.8 soon.
As I said I’m working with .ods documents (saved from .docx)
Since you are converting doc or docx to ods, there may already be problems in the document.
How to open files from MS-Office 2007 or 2010 (.DOCX, .XLSX,…)?
To enable further support, please upload a shortened (approx. 3 pages) and anonymized document here that contains the problem so that someone can review and examine it.
well, I selected all, then do “Clear Direct Formatting”. I assume this should set all indents and margins in document to Writer default values. Then I select all and apply “Text Body” style to entire document, then “Default Paragraph Style” to entire document. When I click Numbering it numbers every line and mess with old numbering, while I need number paragraphs only and not the all content.
Clearing all direct formatting on a converted document will not remove M$ Word idiosyncrasies and existing “glitches”. Only a sample file can tell the extent of damage/pollution.
Default Paragraph Style is a “technical” style never to be used directly. It contains your preferred settings (font face, size, …) forwarded to all other styles (unless overridden by them).
Paragraph members of the outline should be styled Heading n where n is the target level (i for chapter, 2 for sub-chapter, …). Then, don’t click on any numbering tool or you’ll create conflict between dedicated chapter numbering and your direct numbering. Use Tools
>Chapter Numbering
to customise this specific numbering.
According to your remarks, I suggest you read the Writer Guide available in the Documentation page for an introduction and also excellent Bruce Byfiled’s Designing with LO (click on the More button in the documentation page and scroll down a bit).
still not clear how to number chapters like this structure:
- Chapter
1.1. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
1.2. …
1.3. …
1.3.1. …
- Chapter
2.1. At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
I assume that first I should to remove all existing numbering?
Yes. Start with not numbered paragraphs. Note that manual numbering is a direct formatting not removed by Ctl+M because it does not operate on “typographical attributes”.
Chapter Numbering
Apply style Heading 1 to all “Chapter” paragraphs. Apply Heading 2 to “Sed ut …”, “At vero …”. Apply higher-level styles to other should-be-numbered parts of your documents.
When done, enable Tools
>Heading Numbering
(perhaps labelled Chapter Numbering
in 7.0.x) by selecting the type f numbering at each level. Your outline gets instantly automatically numbered.
Also, its possible to save any document with formatting issues (.docx,.odt) as .txt file, than open it in Writer and apply styles and formatting. How to apply corrective formatting in this case?
If you opt for the full-reformat method (starting from a txt file or equivalent), you must first create your styles or customise the built-in ones.
Your fresh document is totally *Default Paragraph Style because Writer knows nothing about it at this stage. I’d suggest:
- select everything Ctl+A and apply Body Text (Ctl+0 – this “zero”, not letter “O”)
- review your headings, applying Heading 1 (Ctl+1) for chapters, Heading 2 (Ctl+2) for sub-chapters, etc.
It is likely that your headings are not numbered. Go to Tools
>Heading Numbering
to enable numbering and tune its appearance.
txt document opened contains Preformatted Text. All headings and paragraphs are numbered. After applying Body Text, some paragraphs have different line spacing (although it show same 1,15) and also there is different Paragraphs Spacing. How to normalize this?
This means the numbers were manually typed. Delete them.
Perhaps you original file is not really a .txt and has already some (direct) formatting. In particular, it should not result in Preformatted Text. A real .txt ends up in Default Paragraph Style.
Difficult to tell without a sample.
Usually, instead of saving as a file, I copy the whole document and I paste as Unformatted Text in a blank new document.
When you work on your document formatting, always enable View
>Formatting Marks
to have a clear awareness of what is actually present. I don"t know if you did so. Here are the first observations:
- spaces are used to indent or “align” text
This is unreliable because you never know the effective width of space characters (it depends on context). This width varies according to justification (or alignment) needs. Indenting is a property of a paragraph. “Alignment” at a specific position can be done either with paragraph indents or with a specific tab stop (don’t rely on implicit evenly spaced stops: they are as faulty as space characters). - empty paragraphs provide vertical spacing
Empty paragraphs contain no information. There should be absolutely no empty paragraphs in any document. They, sooner or later, cause problems with page boundaries (resulting in loss of synchronisation with page breaks after edits). Vertical spacing is in fact a property of some paragraph (e.g. a heading requires additional spacing both above and below). - numbering is manual.
I don’t see any line spacing anomaly, unless you call “line spacing” the consequence of empty paragraphs.
To illustrate how to handle your document, this is what I did.
- I selected everything and applied Body Text
- the first paragraph looks like a title: I applied Title and removed initial spaces
- I applied Heading 1 on all paragraphs with a single number and erased the manual number (temporarily getting an unnumbered heading)
- same with Heading 2 on all paragraphs with a 2-element number
- same with Heading 3 on all paragraphs with a 3-element number
- I erased all empty paragraphs
After that, I configured Tools
>Heading Numbering
to enable automatic numbering.
Note that I applied built-in styles without customising them. I only conferred “structure” to the document. The next step would be an “aesthetic” one where you tune the various styles to suit your tastes. In this step you don’t touch your text; you only play with styles until you’re satisfied. This works fine when you have no direct formatting.
Obviously, you seem to have a bullet list after “justo” (the paragraphs start with a hyphen). I did not apply some style here, like List 1 (which needs to be “augmented” with a list style like Bullet •) because I have not enough information to make a choice.
You have the big picture. It is now up to you to elaborate on this sketch.
test_ajl.odt (45.6 KB)