[Tutorial] Work-around for a Two lines heading

Forum rules
No question in this section please
For any question related to a topic, create a new thread in the relevant section.
Post Reply
User avatar
RGB
Posts: 1456
Joined: Mon Oct 08, 2007 1:34 am

[Tutorial] Work-around for a Two lines heading

Post by RGB »

The document presented here provides a way to mimic a two lines heading that looks like this:

Chapter 1.
Title

Text

The procedure used allows you to have well formatted table of contents and cross-references.
The document includes a macro and a new toolbar that simplifies the use of this “work-around”, and a detailed explanation of how it works.

IMPORTANT
(I just have seen this little problem right now, so this warning is not included on the document, sorry :oops: )
You can use the navigator to move chapters without problems unless you are moving the first or last chapter.
If you use the navigator, you will only see the Heading 1 paragraphs, so if you move a chapter from there, it will be moved not with its FakeChapter paragraph but with the one from the following chapter.
Because of the structure of the document this is not a problem at all unless you are moving the first or the last chapter from the document.
After all, this is a work-around, it cannot be perfect...
Attachments
TwoLineHeadings.odt
Model document for a two lines heading template
(16.31 KiB) Downloaded 1697 times
Last edited by Hagar Delest on Wed Mar 26, 2008 10:38 pm, edited 1 time in total.
Reason: changed 'Example' to 'Tutorial' in title.
There are two types of people: those who believe that there are two types of people and those who do not.

openSUSE Leap with KDE Plasma / LibreOffice
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Tutorial] Work-around for a Two lines heading

Post by Hagar Delest »

Some improvements have been implemented, the new code can be found here: [Writer] Work-around for a Two lines heading.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
RGB
Posts: 1456
Joined: Mon Oct 08, 2007 1:34 am

Re: [Tutorial] Work-around for a Two lines heading

Post by RGB »

For the last month, I was working on old documents and didn't notice a new (and really cool!) feature on OOo 3: In Tools -> Outline numbering -> Position tab you can choose a number/text separator! This mean that you can use, for example, a Tab stop!
The problem is that old documents created on prior versions of OOo will not give you the selection (I reported this here), you can only see it on new documents.
The meaning of all this?: if you use the document attached here (that was created on OOo 2.3, I think), it will work without problems, BUT if you try to recreate this (or use the enhanced Hagar's macro) on a NEW document, you will face problems if the "tab stop" is selected in "Numbering followed by": you will have two tab stops one after the other!
The procedure must be updated to consider this new OOo 3 feature.
There are two types of people: those who believe that there are two types of people and those who do not.

openSUSE Leap with KDE Plasma / LibreOffice
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Tutorial] Work-around for a Two lines heading

Post by Hagar Delest »

I've adapted the code of the macro, it should be fine now for 3.0 and needs a small edit for 2.# compatibility. But the problem remains for old documents edited in 3.0 I guess.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
RGB
Posts: 1456
Joined: Mon Oct 08, 2007 1:34 am

Re: [Tutorial] Work-around for a Two lines heading

Post by RGB »

Thanks, Hagar, for fixing the problem. I think there will be a lot of trouble with this (and other) new features: the issue linked above was closed as "wontfix" with the following comment:
This is unfortunately true. The new and the old numbering position concepts are
not compatible to each other. Thus you cannot add tab characters to list created
in OO 2.x or even convert them.
This is not fixable, sorry for this.
:roll:
That means I need to rewrote all my templates... :evil:
There are two types of people: those who believe that there are two types of people and those who do not.

openSUSE Leap with KDE Plasma / LibreOffice
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Tutorial] Work-around for a Two lines heading

Post by acknak »

Has anyone seen a description or rationale for the changes in list formatting that were made in ODF 1.2? I must say that this seems like a lot of hassle for very little payoff. The new setup seems to be an improvement, but a very small one, at a high price (broken compatibility).
AOO4/LO5 • Linux • Fedora 23
User avatar
RGB
Posts: 1456
Joined: Mon Oct 08, 2007 1:34 am

Re: [Tutorial] Work-around for a Two lines heading

Post by RGB »

Strange are the mechanisms of though: trying to solve another problem and almost two years after the "tab stop as numbering separator" was introduced on OOo, I found a way so simply to build the two lines heading that I cannot believe it took me so long to see it... o well...
Tools -> Outline numbering -> Position tab -> "Numbering followed by": tab stop -> "at": your text area width (for example, if you use an A4 page with default margins, the text area width will be 17 cm).
That's all.
In fact, Tab stops will be ignored by the TOC.
And if you want the chapter number to have a larger (or smaller) font than the chapter text, just select a corresponding character style on the Numbering tab.
Reeeeeeally simple.
There are two types of people: those who believe that there are two types of people and those who do not.

openSUSE Leap with KDE Plasma / LibreOffice
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Tutorial] Work-around for a Two lines heading

Post by acknak »

Ahh, so the full-page-width tab stop forces the heading text to the next line.

Very nice!
AOO4/LO5 • Linux • Fedora 23
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Tutorial] Work-around for a Two lines heading

Post by Hagar Delest »

RGB wrote:Tools -> Outline numbering -> Position tab -> "Numbering followed by": tab stop -> "at":
If you don't see this option, it may be because you're working with an old document or a document made from an old template, still using the former outline numbering management.
In such case, see that topic: 3.x new outline numbering compatibility with old docs.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Tutorial] Work-around for a Two lines heading

Post by acknak »

Odd. The wide tab stop idea works great for a tab between the numbering and the title, but not for a tab within the title. A tab in the paragraph text ends up on a line by itself, causing the title to look double-spaced.

Have I missed something obvious? Any ideas why it works this way?

PS: Is it ok to discuss this here, or should this be a separate thread?
Attachments
Writer_wide_tab_problem.odt
(9.55 KiB) Downloaded 940 times
AOO4/LO5 • Linux • Fedora 23
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Tutorial] Work-around for a Two lines heading

Post by RoryOF »

Work-around for the work-around: select the tab character down to the start of the next line (Edgar...) and right click for format character. I selected 0.1 pt, but it defaulted to 2 pt. Result is nearly what you wanted.
 Edit: The Tab character is wrapping to the next line, but the logic is that it shouldn't; only what is after the tab should wrap. Perhaps putting an microspace just before the text might achieve the correct effect? Haven't time to try this now. 
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Tutorial] Work-around for a Two lines heading

Post by acknak »

Nice! I should have thought of shrinking the tab height.
Perhaps putting an microspace just before the text...
Works perfectly with a zero-width space (U+200B) or a zero-width non-joiner (U+200C). I had tried a regular space before (or after) the tab, but it didn't help. I never thought of trying the zero-width characters.

Great help, RoryOF; thanks!

I think I'll leave this here; someone else may need the workaround in this context.
AOO4/LO5 • Linux • Fedora 23
Post Reply