I hadn't thought about doing it that way, but it does make sense. My template is set up to have the \frontmatter and similar commands in it, and I'd been thinking I would do a filter to shift the appropriate sections up above the \mainmatter command. But I hadn't realised that the LaTeX would be left out of other formats. That means I can just put all the LaTeX commands I need, including those currently in the template file, in the MD file (actually in my Scrivener file, but that's not actually that relevant), and then when I convert to LaTeX it'll end up the way I want it. On Wednesday, 11 January 2023 at 23:12:24 UTC+13 denis...-NSENcxR/0n0@public.gmane.org wrote: > Addendum: > > If you choose to just enter the LaTeX commands directly to your markdown > sources, pandoc’s internal representation will look like this : > > > > Source : > > > > ``` > > *Hello* world! > > > > \frontmatter > > > > Hi again > > ``` > > > > Output (native): > > > > ``` > > [ Para [ Emph [ Str "Hello" ] , Space , Str "world!" ] > > , RawBlock (Format "tex") "\\frontmatter" > > , Para [ Str "Hi" , Space , Str "again" ] > > ] > > ``` > > > > So you could even just use the LaTeX commands directly, and use a filter > to transform the RawBlocks with content \\frontmatter to something else > when your target is not LaTeX. > > > > Best, > > Denis > > > > *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im > Auftrag von *denis...-NSENcxR/0n0@public.gmane.org > *Gesendet:* Mittwoch, 11. Januar 2023 11:04 > *An:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > *Cc:* isen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > *Betreff:* AW: Front, main, and back matter? > > > > Hi, > > > > if your main/only target is LaTeX, you should be able to just add these > command directly to your markdown sources. Pandoc will pass those through > as is when the output is LaTeX, and ignore those for other output formats. > > > > When you want a more robust solution filters are indeed the way to go. > Something as simple as this might already work : > > > > function Str (elem) > > if elem.text == "{{frontmatter}}" then > > if FORMAT:match 'latex' then > > return pandoc.RawBlock('latex','\\fontmatter') > > end > > end > > end > > > > You can add more instructions for other output formats as needed. > > > > Best, > > Denis > > > > *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im > Auftrag von *Lyndon Drake > *Gesendet:* Montag, 26. Dezember 2022 21:13 > *An:* pandoc-discuss > *Betreff:* Front, main, and back matter? > > > > Hi, > > > > Is there any common approach to dealing with front matter, main matter, > and back matter? In general front matter is often unnumbered or under a > different page numbering scheme (i, ii, iii, …) and includes such things as > contents, lists of tables and figures, abbreviations, abstract, preface, > and so forth. Main matter then is the body of the work, typically in > chapters, and then the back matter is such things as appendices, indices, > and bibliographies. In LaTeX these are indicated by the `\frontmatter`, > `\mainmatter`, and `\backmatter` commands, but it is possible to do similar > things in other formats albeit with less semantic content. > > > > At the moment, after producing my LaTeX file, I manually move the > `\frontmatter` command to the correct place. I imagine that I might be able > to write a filter to do the same thing but I'm not sure how to start. > > > > Given that this is no doubt a common issue for the production of books, > I'm also wondering if there might be a good way to approach the issue so > that (in time) there can be a canonical approach to this? > > > > (There might be similar things around 'Part's of books, and to things such > as variations in citation formatting per-chapter.) > > > > Best, > > Lyndon > > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/1bba18b4-dde6-4423-810a-2a553f9e1916n%40googlegroups.com > > . > > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/b48088746ffe40018e63dd41526b1ced%40unibe.ch > > . > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/555f7b12-5af4-4a08-89cd-0431698fd59bn%40googlegroups.com.