public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Using --section-divs with a custom environment in LaTeX
@ 2022-08-07 13:25 bapt auguie
       [not found] ` <CAGCXF29K2FBm-jUPG75JZv2t49pbCRbs0FTP46eK2fxKp3=AcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: bapt auguie @ 2022-08-07 13:25 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Hi,

I'm using a custom Latex template which defines a layout made of "frames"
via the flowfram package,

\usepackage[final]{flowfram}
> \newstaticframe[1]{493.799mm}{493.799mm}
>                    {60mm}{287.201mm}[frameid1]
> % ...
> % later in the body
> \begin{staticcontents*}{frameid1}
> % ...
> % stuff to be placed within that frame
> % ...
> \end{staticcontents*}
>

I would like to inject the content corresponding to a given section of my
markdown document inside the corresponding frame; for example the markdown
file might be:

## Introduction {#frameid1}
>
> This too should go in the section's _frame_.
>
> ## Other section {#frameid2}
>
> This shall go into another frame.
>

I gather that the `--section-divs` option wraps sections in divs in HTML,
but I don't see any effect in Latex output. Am I missing something? I
haven't had any luck locating the corresponding code source in the
repository.

I'm guessing I'll have to write a Lua filter in any case, to produce the
start and end tags,

\begin{staticcontents*}{frameid1}
>
> \end{staticcontents*}
>

presumably along the lines of
https://github.com/rstudio/rmarkdown/blob/main/inst/rmarkdown/lua/latex-div.lua

Any help adapting this (more standalone) would be much appreciated.

Many thanks,

baptiste

-- 
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/CAGCXF29K2FBm-jUPG75JZv2t49pbCRbs0FTP46eK2fxKp3%3DAcA%40mail.gmail.com.

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

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

* Re: Using --section-divs with a custom environment in LaTeX
       [not found] ` <CAGCXF29K2FBm-jUPG75JZv2t49pbCRbs0FTP46eK2fxKp3=AcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-08-08 16:29   ` John MacFarlane
       [not found]     ` <5779B033-0E00-4C16-954D-ACC2EE2FA125-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2022-08-08 16:29 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

--section-divs is HTML only.
However, you can use the function
https://pandoc.org/lua-filters.html#pandoc.utils.make_sections
in your Lua filter.



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

* Re: Using --section-divs with a custom environment in LaTeX
       [not found]     ` <5779B033-0E00-4C16-954D-ACC2EE2FA125-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-08-09  9:43       ` bapt a
  0 siblings, 0 replies; 3+ messages in thread
From: bapt a @ 2022-08-09  9:43 UTC (permalink / raw)
  To: pandoc-discuss


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

Ah OK, thanks, it wasn't clear to me that it was only for HTML.

I've adapted the Quarto filter "latex-environment.lua" 
(https://github.com/quarto-ext/latex-environment/blob/main/_extensions/latex-environment/latex-environment.lua) 
to produce

        local beginEnv = '\\begin{staticcontents*}{' .. v .. '}\n' 
        local endEnv = '\n\\end{staticcontents*}           
        table.insert(divEl.content, 1, pandoc.RawBlock('tex', beginEnv))
        table.insert(divEl.content, pandoc.RawBlock('tex', endEnv))

to wrap the content from divs with specific IDs into the corresponding 
flowframe,

   ::: {.frameid1}
   ## Introduction

   This too should go in the section's _frame_.
   :::

Seems to work well enough for my use-case.

Thanks,

baptiste

On Monday, 8 August 2022 at 18:29:39 UTC+2 fiddlosopher wrote:

> --section-divs is HTML only. 
> However, you can use the function 
> https://pandoc.org/lua-filters.html#pandoc.utils.make_sections 
> in your Lua filter. 
>
>
>

-- 
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/5e553023-038f-4270-9c23-040d1cfa1761n%40googlegroups.com.

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

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

end of thread, other threads:[~2022-08-09  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 13:25 Using --section-divs with a custom environment in LaTeX bapt auguie
     [not found] ` <CAGCXF29K2FBm-jUPG75JZv2t49pbCRbs0FTP46eK2fxKp3=AcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-08-08 16:29   ` John MacFarlane
     [not found]     ` <5779B033-0E00-4C16-954D-ACC2EE2FA125-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-08-09  9:43       ` bapt a

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).