Pandoc doesn't set 'First Page' style from reference document. Any tips?

Hi,

I’m using pandoc to convert from markdown to ODT, as follows:

pandoc -t odt in.md --reference-doc=reference-styles.odt -o out.odt

My reference style ODT has the first page set to ‘First Page’ style, but the generated ODT doesn’t.

I may be expecting too much from pandoc, but any suggestions would be appreciated!

Cheers,
bitrat

Since MarkDown has no notion of page, I doubt you can apply page styles during conversion.

Pandoc manual recommends ro start from an internally generated reference .odt document and to customise its styles. It also says that contents of this reference document is ignored. Contents is where you could specify to start with First Page. I’m afraid there is no other solution than to manually force First Page after conversion.

Another approach would be to generate a .fodt document (if pandoc can’t, you can script it) and modify the XML to add First Page application at start of text (in the script). Optionally, you can save finally as .odt.

Are you suggesting I RTFM?

I could try it I suppose, especially the bit about ‘internally generated .odt’. I’m resistant to recreating the styles as I’m a bit time poor atm and there are a few features that were tricky to get right.

I also hadn’t thought about .fodt but I’ll definitely investigate. Pandoc has a LOT of formats, and there may be one that I can feed to XSLT or somesuch.

Overall, manually setting First Page is entirely the sensible option at present, but I’m keen to look at all the options. Basically, I use Markdown for writing, because I can track changes with git, then I generate a nice looking PDF for annoying people like editors and readers.

In Markdown and first page, I’d have thought the style documents first page and the beginning of the file would be enough. I use a page break before in my Heading 1 style and it works perfectly. I’m just trying to turn off the header on the page 1.

Thanks for the input!

UPDATE:

man pandoc lists the available styles for .docx and there are no page styles. It doesn’t list styles for .odt but I assume they’re essentially the same. I’ve listed the section below for interested parties.

The command line to produce a custom reference doc is:
pandoc -o custom-reference.odt --print-default-data-file reference.odt




       --reference-doc=FILE
              Use the specified file as a style reference in producing a docx or ODT file.

              Docx   For best results, the reference docx should be a modified version of a docx file produced using pandoc.  The contents of the reference docx  are  ignored,  but  its
                     stylesheets  and  document properties (including margins, page size, header, and footer) are used in the new docx.  If no reference docx is specified on the command
                     line, pandoc will look for a file reference.docx in the user data directory (see --data-dir).  If this is not found either, sensible defaults will be used.

                     To produce a custom reference.docx, first get a copy of the default reference.docx: pandoc -o custom-reference.docx --print-default-data-file reference.docx.   Then
                     open  custom-reference.docx  in Word, modify the styles as you wish, and save the file.  For best results, do not make changes to this file other than modifying the
                     styles used by pandoc:

                     Paragraph styles:

                     • Normal

                     • Body Text

                     • First Paragraph

                     • Compact

                     • Title

                     • Subtitle

                     • Author

                     • Date

                     • Abstract

                     • Bibliography

                     • Heading 1

                     • Heading 2

                     • Heading 3

                     • Heading 4

                     • Heading 5

                     • Heading 6

                     • Heading 7

                     • Heading 8

                     • Heading 9

                     • Block Text

                     • Footnote Text

                     • Definition Term

                     • Definition

                     • Caption

                     • Table Caption

                     • Image Caption

                     • Figure

                     • Captioned Figure

                     • TOC Heading

                     Character styles:

                     • Default Paragraph Font

                     • Body Text Char

                     • Verbatim Char

                     • Footnote Reference

                     • Hyperlink

                     • Section Number

                     Table style:

                     • Table

              ODT    For best results, the reference ODT should be a modified version of an ODT produced using  pandoc.   The  contents  of  the  reference  ODT  are  ignored,  but  its
                     stylesheets  are  used  in  the new ODT.  If no reference ODT is specified on the command line, pandoc will look for a file reference.odt in the user data directory
                     (see --data-dir).  If this is not found either, sensible defaults will be used.

                     To produce a custom reference.odt, first get a copy of the default reference.odt: pandoc -o custom-reference.odt --print-default-data-file reference.odt.  Then open
                     custom-reference.odt in LibreOffice, modify the styles as you wish, and save the file.