From: Lyndon Drake <isenguard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Front, main, and back matter?
Date: Fri, 13 Jan 2023 22:00:22 -0800 (PST) [thread overview]
Message-ID: <555f7b12-5af4-4a08-89cd-0431698fd59bn@googlegroups.com> (raw)
In-Reply-To: <49968a6819234bc2a33f72f0197fa1c8-NSENcxR/0n0@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 5780 bytes --]
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 <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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
> Auftrag von *Lyndon Drake
> *Gesendet:* Montag, 26. Dezember 2022 21:13
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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
> <https://groups.google.com/d/msgid/pandoc-discuss/1bba18b4-dde6-4423-810a-2a553f9e1916n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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
> <https://groups.google.com/d/msgid/pandoc-discuss/b48088746ffe40018e63dd41526b1ced%40unibe.ch?utm_medium=email&utm_source=footer>
> .
>
--
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.
[-- Attachment #1.2: Type: text/html, Size: 11333 bytes --]
prev parent reply other threads:[~2023-01-14 6:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AQHZGWZ/tSt910AZI0GxvaBJeZiP0q6ZDb3QgAAIkOA=>
2022-12-26 20:13 ` Lyndon Drake
[not found] ` <1bba18b4-dde6-4423-810a-2a553f9e1916n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-11 10:04 ` AW: " denis.maier-NSENcxR/0n0
[not found] ` <b48088746ffe40018e63dd41526b1ced-NSENcxR/0n0@public.gmane.org>
2023-01-11 10:12 ` denis.maier-NSENcxR/0n0
[not found] ` <49968a6819234bc2a33f72f0197fa1c8-NSENcxR/0n0@public.gmane.org>
2023-01-14 6:00 ` Lyndon Drake [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=555f7b12-5af4-4a08-89cd-0431698fd59bn@googlegroups.com \
--to=isenguard-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).