[Not quite an answer, but too long for a comment - plus I can use code blocks to illustrate the problem and a suggested patch to Org mode for it.]
It's not clear (to me at least) what Org mode should be doing differently: it does not produce the extra spaces in LaTeX or HTML output, and it does not produce any extra spaces in the XML file that it produces for ODT output either - here's what you see if you open the ODT archive and look at the contents.xml
file inside it:
<text:p text:style-name="OrgVerse">Great clouds overhead<text:line-break/>
Tiny black birds rise and fall<text:line-break/>
Snow covers Emacs<text:line-break/>
<text:line-break/>
<text:s text:c="2"/>—AlexSchroeder<text:line-break/>
</text:p>
Why soffice
displays this with spaces at the beginning of the second and subsequent lines is a mystery to me, but there does not seem to be anything that can be done about it on the Org mode side, other than translating it to some different XML: if you know what it should be translating it into, you should probably file a bug report with org-submit-bug-report
.
(Later): By trial and error, I discovered that if you open the ODT archive in emacs and edit the contents.xml
file to look like this:
<text:p text:style-name="OrgVerse">Great clouds overhead<text:line-break/>Tiny black birds rise and fall<text:line-break/>Snow covers Emacs<text:line-break/><text:line-break/> <text:s text:c="2"/>—AlexSchroeder<text:line-break/>
</text:p>
eliminating the explicit newlines, then it is shown without initial spaces.
I would suggest that you try the following patch to Org mode:
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index ef07acfed..658c5949a 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -3676,8 +3676,9 @@ contextual information."
;; Replace leading tabs and spaces.
"^[ \t]+" #'org-odt--encode-tabs-and-spaces
;; Add line breaks to each line of verse.
- (replace-regexp-in-string
- "\\(<text:line-break/>\\)?[ \t]*$" "<text:line-break/>" contents))))
+ (replace-regexp-in-string "\n" ""
+ (replace-regexp-in-string
+ "\\(<text:line-break/>\\)?[ \t]*$" "<text:line-break/>" contents)))))
It's just a rough approximation at the moment, but it should take care of the initial spaces on the haiku lines, although it mangles the spaces in front of the em-dash.