The office:automatic-styles tag can only be used once (that is, subsequent uses override rather than append) in LibreOffice, and because the opendocument writer already uses it, a template can't separately set it.
Suggested solution
My suggestion would be to change the opendocument default template to change to look like <office:automatic-styles>$automatic-styles$</office:automatic-styles> and the writer to write styles between the tags instead of actually writing the tags. This would allow templates which set automatic styles.
Further explanation and thoughts for the future
Setting automatic styles might sound a bit crazy, but it is necessary to trigger a different page style for the title page, etc. This might also be possible by directly editing the reference odt's xml, that is yet another layer of complication.
The ideal situation for the future, in my opinion, would be a template.odt incorporating what is currently split between the reference.odt and the opendocument template and making use of built in features such as author field using the author from the metadata, etc. Such a template would be easier to customise for end users, but would probably require a massive rewrite of the writer and would break existing workflows.
jgm
added a commit
to jgm/pandoc-templates
that referenced
this issue
Automatic styles can now be inserted in the template,
since the template, not the writer, now provides the
enclosing `<office:automatic-styles>` tags.
Closes #2520.
(The title of this issue isn't great, sorry.)
The basic problem
The office:automatic-styles tag can only be used once (that is, subsequent uses override rather than append) in LibreOffice, and because the opendocument writer already uses it, a template can't separately set it.
Suggested solution
My suggestion would be to change the opendocument default template to change to look like
<office:automatic-styles>$automatic-styles$</office:automatic-styles>
and the writer to write styles between the tags instead of actually writing the tags. This would allow templates which set automatic styles.Further explanation and thoughts for the future
Setting automatic styles might sound a bit crazy, but it is necessary to trigger a different page style for the title page, etc. This might also be possible by directly editing the reference odt's xml, that is yet another layer of complication.
The ideal situation for the future, in my opinion, would be a template.odt incorporating what is currently split between the reference.odt and the opendocument template and making use of built in features such as author field using the author from the metadata, etc. Such a template would be easier to customise for end users, but would probably require a massive rewrite of the writer and would break existing workflows.