Re: [O] ox-odt: List items contain body paragraphs, confusing styles
On August 20, 2017 18:13:13 Nicolas Goaziouwrote: Out of curiosity, instead of creating a new style, wouldn't some standard style be enough, e.g., "Text_20_body_20_indent"? Also, what happens in the following cases - ... #+begin_quote Quoted paragraph #+end_quote #+begin_center Centered paragraph #+end_center Should the use "Quotations" and "OrgCenter", which inherit from "Text_20_body", or some new style inheriting from the one dedicated to text in plain lists? Interesting questions -- however, I'm leaving tomorrow for a week's holiday. So I won't get to this for awhile. I should also say: This is the first time I've needed the ODT exporter for anything serious. So, I shouldn't be taken as any sort of authority on how the styles "should" work. I'm reporting behavior that seemed odd to me and, to the extent that I have time, I don't mind prowling around in the ODT data structures to see what is going on inside. That's about the extent of what I can do. I'm not affiliated with LibreOffice in any way... In fact, I quite dread using it. TBH I prefer exporting to LaTeX, but it's a humanities journal and they don't understand about superior technology :D That said, I'm not sure why those cases would be challenging. In the normal list item case, you have a list item node enclosing one or more paragraph nodes. In the cases you mentioned, the list item node would contain a quote block or centered block node. As I understand the exporter, the depth-first traversal would encode the child nodes normally, and pass the encoded result up to the list item parent. My observation of LO is that it tries to merge properties from the list style and paragraph style, which it would do if it's centered, block quote or whatever. So my guess is, do nothing special for these cases. But that's a guess. hjh Sent with AquaMail for Android http://www.aqua-mail.com
Re: [O] ox-odt: List items contain body paragraphs, confusing styles
Hello, James Harkinswrites: > OK, I just got the expected output by the following: > > - Add "OrgListTextBody" to the stylesheet. I didn't try to do it directly in > text (I don't know ODT XML that well). I created the style with that name in > LO, setting the indent parameters to 0. That gave me this definition in > styles.xml: > > style:parent-style-name="Text_20_body"> >fo:text-indent="0in" style:auto-text-indent="false"/> > > > It's probably enough to specify only ~fo:text-indent="0in"~, but I didn't > test that because I'm not sure how to write the modified styles.xml back into > the ODT archive. (LO auto-generated all 4 parameters.) > > - Then, use my filter to apply OrgListTextBody to the paragraphs contained > within list items. > > The resulting display in LO is correct. Out of curiosity, instead of creating a new style, wouldn't some standard style be enough, e.g., "Text_20_body_20_indent"? Also, what happens in the following cases - ... #+begin_quote Quoted paragraph #+end_quote #+begin_center Centered paragraph #+end_center Should the use "Quotations" and "OrgCenter", which inherit from "Text_20_body", or some new style inheriting from the one dedicated to text in plain lists? Regards, -- Nicolas Goaziou
Re: [O] ox-odt: List items contain body paragraphs, confusing styles
On Sat, 19 Aug 2017 07:55:00 -0400 Nicolas Goaziouwrote > OK. So could you tell me what should be the style name? > > Do we need to add it to some style file somewhere? If so, what would be > its definition? OK, I just got the expected output by the following: - Add "OrgListTextBody" to the stylesheet. I didn't try to do it directly in text (I don't know ODT XML that well). I created the style with that name in LO, setting the indent parameters to 0. That gave me this definition in styles.xml: It's probably enough to specify only ~fo:text-indent="0in"~, but I didn't test that because I'm not sure how to write the modified styles.xml back into the ODT archive. (LO auto-generated all 4 parameters.) - Then, use my filter to apply OrgListTextBody to the paragraphs contained within list items. The resulting display in LO is correct. hjh
Re: [O] ox-odt: List items contain body paragraphs, confusing styles
James Harkinswrites: > On Sat, 19 Aug 2017 04:36:58 -0400 Nicolas Goaziou > wrote >> Adding a special style to every paragraph contained in a plain list is >> very easy to do. Just let me know if it happens to be the way to solve >> the issue at hand. > > I think that is the correct solution. (Again, only one paragraph style for > all list levels.) > > I realized just now, I couldn't reproduce the problem because I was still > using the filter! I just disabled the filter, regenerated the stylesheet, and > the problem reappeared. > > So here are steps to reproduce: > > 1. According to the org-manual[1], create an empty org odt document to export > to ODT (creating org-specific styles). C-e o O to export and open. > > 2. In this document, edit "Text body" to add 0.5" of first-line indent. > > 3. Save the document. > > 4. Create a new org document including ~#+ODT_STYLES_FILE: > "./ox-odt-generate-stylesheet.odt"~ (replacing with your path) and some list > items. > > 5. C-e o O, and you'll see incorrect indentation for the list items. OK. So could you tell me what should be the style name? Do we need to add it to some style file somewhere? If so, what would be its definition? Regards,
Re: [O] ox-odt: List items contain body paragraphs, confusing styles
On Sat, 19 Aug 2017 04:36:58 -0400 Nicolas Goaziouwrote > Adding a special style to every paragraph contained in a plain list is > very easy to do. Just let me know if it happens to be the way to solve > the issue at hand. I think that is the correct solution. (Again, only one paragraph style for all list levels.) I realized just now, I couldn't reproduce the problem because I was still using the filter! I just disabled the filter, regenerated the stylesheet, and the problem reappeared. So here are steps to reproduce: 1. According to the org-manual[1], create an empty org odt document to export to ODT (creating org-specific styles). C-e o O to export and open. 2. In this document, edit "Text body" to add 0.5" of first-line indent. 3. Save the document. 4. Create a new org document including ~#+ODT_STYLES_FILE: "./ox-odt-generate-stylesheet.odt"~ (replacing with your path) and some list items. 5. C-e o O, and you'll see incorrect indentation for the list items. hjh [1] http://orgmode.org/manual/Applying-custom-styles.html#Applying-custom-styles
Re: [O] ox-odt: List items contain body paragraphs, confusing styles
Hello, James Harkinswrites: > So I would say, postpone this issue unless I can gather more evidence. OK. > A short answer to your questions is that every list item does consist > of paragraphs, and each paragraph must have a paragraph style, but -- > the paragraph style can be the same one, even at different list > levels. There is no need for a different paragraph style for each list > level, and you don't have to do anything special for multiple > paragraphs within a list item. Adding a special style to every paragraph contained in a plain list is very easy to do. Just let me know if it happens to be the way to solve the issue at hand. Regards, -- Nicolas Goaziou
Re: [O] ox-odt: List items contain body paragraphs, confusing styles
On Thu, 17 Aug 2017 10:33:29 -0400 Nicolas Goaziouwrote > So, what style-name should have the inner paragraph? If it is a new > style, what would be its definition? > > It's not difficult to check, upon exporting a paragraph, if it belongs > to a list item or not: (org-element-lineage paragraph '(item)) > > BTW, is it different for nested paragraphs, e.g., what should be the > style for the following 3 paragraphs: > > - para 1 > > para 2 > > - para 3 Hm. Good question. I'm going to admit to a bit of frustration now... after about 45 minutes poking around in XML, I did a fresh ox-odt test with a fresh style sheet, and I can't reproduce the problem. !!! Hours, over the last two days, wasted. So I must have done something funky to that initial stylesheet. (WYSIWYG tools, who knows what it could be. Really teed off at that journal for not allowing LaTeX.) So I would say, postpone this issue unless I can gather more evidence. A short answer to your questions is that every list item does consist of paragraphs, and each paragraph must have a paragraph style, but -- the paragraph style can be the same one, even at different list levels. There is no need for a different paragraph style for each list level, and you don't have to do anything special for multiple paragraphs within a list item. hjh
Re: [O] ox-odt: List items contain body paragraphs, confusing styles
Hello, James Harkinswrites: > Hi, haven't been active here for a while (which is a good thing -- it means I > haven't had any problems worth mentioning!). > > Now I have one -- ODT export encodes list items as a list-item containing a > "text:p": > > > > > blah blah > > > > > When LibreOffice reads this, it applies indentation settings from the > Text_20_body paragraph style to the list item. So, for instance, if > you're writing for a journal that requires a .doc and it also requires > paragraphs to be first-line indented, it becomes impossible to have > hanging bullets in bullet lists -- the list outdents the bullet by > 0.25" but the paragraph style then indents this by 0.5" for a net > indent of 0.25". > > ask.libreoffice.org says "It is usually preferable to make paragraph > styles formatting lists independent from bulk text styles"[1] -- i.e., > applying the same style to a list-item paragraph as to a free-standing > paragraph is not recommended. > > I can guess structurally why this occurs -- I suppose org parses it as > a list-item node containing a paragraph node, and the paragraph node > is encoded first, without any knowledge of its context. So, what style-name should have the inner paragraph? If it is a new style, what would be its definition? It's not difficult to check, upon exporting a paragraph, if it belongs to a list item or not: (org-element-lineage paragraph '(item)) BTW, is it different for nested paragraphs, e.g., what should be the style for the following 3 paragraphs: - para 1 para 2 - para 3 Regards, -- Nicolas Goaziou
[O] ox-odt: List items contain body paragraphs, confusing styles
Hi, haven't been active here for a while (which is a good thing -- it means I haven't had any problems worth mentioning!). Now I have one -- ODT export encodes list items as a list-item containing a "text:p": blah blah When LibreOffice reads this, it applies indentation settings from the Text_20_body paragraph style to the list item. So, for instance, if you're writing for a journal that requires a .doc and it also requires paragraphs to be first-line indented, it becomes impossible to have hanging bullets in bullet lists -- the list outdents the bullet by 0.25" but the paragraph style then indents this by 0.5" for a net indent of 0.25". ask.libreoffice.org says "It is usually preferable to make paragraph styles formatting lists independent from bulk text styles"[1] -- i.e., applying the same style to a list-item paragraph as to a free-standing paragraph is not recommended. I can guess structurally why this occurs -- I suppose org parses it as a list-item node containing a paragraph node, and the paragraph node is encoded first, without any knowledge of its context. I will try to write a filter for this, but this looks like an unexpected interaction, so, perhaps a bug. Thanks, hjh [1] https://ask.libreoffice.org/en/question/123222/text-body-style-with-intent-affects-bulleted-list-style-as-well/