public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Front, main, and back matter?
@ 2022-12-26 20:13 ` Lyndon Drake
       [not found]   ` <1bba18b4-dde6-4423-810a-2a553f9e1916n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Lyndon Drake @ 2022-12-26 20:13 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1662 bytes --]

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-discuss+unsubscribe-/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.

[-- Attachment #1.2: Type: text/html, Size: 2034 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* AW: Front, main, and back matter?
       [not found]   ` <1bba18b4-dde6-4423-810a-2a553f9e1916n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-01-11 10:04     ` denis.maier-NSENcxR/0n0
       [not found]       ` <b48088746ffe40018e63dd41526b1ced-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2023-01-11 10:04 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: isenguard-Re5JQEeQqe8AvxtiuMwx3w

[-- Attachment #1: Type: text/plain, Size: 3165 bytes --]

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-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von Lyndon Drake
Gesendet: Montag, 26. Dezember 2022 21:13
An: pandoc-discuss <pandoc-discuss-/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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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-discuss+unsubscribe-/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.

[-- Attachment #2: Type: text/html, Size: 7766 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* AW: Front, main, and back matter?
       [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>
  0 siblings, 1 reply; 4+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2023-01-11 10:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: isenguard-Re5JQEeQqe8AvxtiuMwx3w

[-- Attachment #1: Type: text/plain, Size: 4897 bytes --]

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-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von denis.maier-NSENcxR/0n0@public.gmane.org
Gesendet: Mittwoch, 11. Januar 2023 11:04
An: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Cc: isenguard-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-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>> Im Auftrag von Lyndon Drake
Gesendet: Montag, 26. Dezember 2022 21:13
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss@googlegroups.com>>
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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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/49968a6819234bc2a33f72f0197fa1c8%40unibe.ch.

[-- Attachment #2: Type: text/html, Size: 12052 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Front, main, and back matter?
       [not found]           ` <49968a6819234bc2a33f72f0197fa1c8-NSENcxR/0n0@public.gmane.org>
@ 2023-01-14  6:00             ` Lyndon Drake
  0 siblings, 0 replies; 4+ messages in thread
From: Lyndon Drake @ 2023-01-14  6:00 UTC (permalink / raw)
  To: pandoc-discuss


[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-14  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AQHZGWZ/tSt910AZI0GxvaBJeZiP0q6ZDb3QgAAIkOA=>
2022-12-26 20:13 ` Front, main, and back matter? 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 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).