Ask Your Question
0

Writer: Combining character styles, changed behaviour?

asked 2018-01-29 19:01:51 +0200

ajlittoz gravatar image

LO 5.3.7.2 and 5.4.4.2, Fedora 26 & 27, KDE desktop

I am editing a technical document whose original version was written with previous versions of LO (don't remember wihch but surely 4.x series, maybe some last release in 3.x series).

In paragraphs describing software API, procedure and arguments are cited using Source Text character formatting* Within this quptation, procedure name is highlighted with Strong Emphasis. The procedure template lives in a Text Body paragraph.

Adding new API entry points, I try to mimic this old formatting but when I apply Strong Formatting, Source Text underneath is lost.

I know that only one character styles may be applied, but I wonder how multiple (at least two) character styles were possible.

Did specification change when upgrading to 5.x series in favour of more rigorous style behaviour? i.e. not having styles processed internally in a special way (like present Internet Link)?

The obvious workaround is to define a new character style linked to Source Text but I'm puzzled by the original file. The work flow in it is closer to Quark XPress I practised long ago. Can anybody explain this queer state?

If needed, I can have a look at the XML and expose here what I find.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2018-01-30 00:12:38 +0200

Regina gravatar image

Character styles are attributes of a <text:span> element (similar to HTML). From point of file format there is no problem. It is explicitly mentioned, that <text:span> elements may be nested.

If you apply a character style, then the marked part is put into a text:span element with the double-clicked style. If it has already been inside a text:span element, then the part before and the part after are both put into own text:span element with the old character style.

If you hold shift-key down while double-click, the strong-emphasis-style is added to the old style. So not only one text:span element is generated, but two, which are nested. The outer one gets the old style and the inner one gets the strong-emphasis-style. You must first select the style, then press shift (and hold) and then double-click. First shift and then select style will not work.

From point of style-format it is not needed to divide the text in "before", "styled", and "after" parts; and I dislike it. It produces very fragmented source. What makes it worse it the fact, that LibreOffice inserts additional automatic styles without need and does not join adjacent equal styled parts in case you remove or reassign styles.

Your code examples are likely not inline but in separate lines. In that case I would not use character style to set them in monospaced font, but would use a paragraph style for that purpose. Doing that, the strong-emphasis-style is the only character style and is written with a simple single text:span element.

The current behavior is not new. I see it already in OOo3.2.

edit flag offensive delete link more

Comments

To avoid fragmenting, should I first Default Style before modifying character styles?

I have 2 use cases: a list-like one where I could use a dedicated paragraph style as you suggest and an inline one where "semantic markup" needs 2 styles: one to advertise code, one to highlight components within.

This (powerful) feature is not documented. Is it recommended not to use it (e.g. because of fragmentation)?

ajlittoz gravatar imageajlittoz ( 2018-01-30 08:07:04 +0200 )edit

Back to work where LO is 5.3.7.2. I followed recipe but it does not work: character style is replaced, not added. I tried variants with other modifier keys (ctrl, alt, shift and combinations) to no avail.

I gave a colour to Strong Emphasis to get a picture of document state. It looks like real old entries have combined styles while recent ones have only Source Text + direct formatting (not consistent nor maintenance-friendly).

What am I missing?

ajlittoz gravatar imageajlittoz ( 2018-01-30 10:51:40 +0200 )edit

@ajlittoz it's not working here either (5.4, 64 bits, on Linux). There was an extension for AOO that permitted to combine character styles, but it seems unmaintained and indeed it does not work on LibO 5.4.

RGB-es gravatar imageRGB-es ( 2018-01-30 12:57:28 +0200 )edit

I have used version 6.1. Please try it there. But I think, that it accidentally works. At least I find no remark in the release notes. Nevertheless, an UI is needed to get character styles nested. I have written https://bugs.documentfoundation.org/s... for it.

Regina gravatar imageRegina ( 2018-01-30 13:39:24 +0200 )edit

@Regina: danke schön. For my present task, I'll edit with Source Text + direct formatting (though I don't like it). I'll come back later on this when 6.1 is pushed as stable in the distros.

I keep the question open till this time.

ajlittoz gravatar imageajlittoz ( 2018-01-30 14:06:11 +0200 )edit

oh, it seems that applying a style by shift-doubleclick does not apply the style, but applies manual formatting created from the style... you may see that by later changing the styles' settings: the underlying style change reflects on screen, and secondary style change does not.

Mike Kaganski gravatar imageMike Kaganski ( 2018-01-30 17:09:04 +0200 )edit
1

It does apply the style correctly as style. It is a refresh problem, that the rendering does not follow immediately. Save the file and the changes become visible. If you unpack the file and inspect content.xml, you will see, that there are only the styles and no hard formatting.

Regina gravatar imageRegina ( 2018-01-30 17:49:24 +0200 )edit

thanks again!

Mike Kaganski gravatar imageMike Kaganski ( 2018-01-30 17:53:33 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-01-29 19:01:51 +0200

Seen: 131 times

Last updated: Jan 30 '18