public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: pandoc-crossref not playing nice with header includes
Date: Tue, 7 Mar 2023 19:42:16 +0100	[thread overview]
Message-ID: <CADAJKhBkRK3nbLzvO+negtNLN9v6qGDcNx1_D-E8WPd+k6y7Og@mail.gmail.com> (raw)
In-Reply-To: <CAMwawgPQN7Jv34tv+kioNYJO-HJ4nhwMco+7BXQCLOEDHDD39A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

Do you know that you have to run pandoc-crossrefs as the last filter?

Den tis 7 mars 2023 19:29A A <amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> I’m already familiar with pandoc templates, but I don’t think they are the
> solution here. You might recall I’m using 3 distinct filters, namely
> pandoc-crossref.lua, minted.lua, include-code-files.lua. I’m using each
> because of some functionality it provides:
>
>    - pandoc-crossref.lua: The ability to cross-reference listings and
>    caption them
>    - minted.lua: The ability to break long code lines within a listing.
>    - include-code-files.lua: The ability to include external files in a
>    listing.
>
> I expected that using these filters in unison would result in an
> intersection of the mentioned functionality. However, this is incorrect.
> The underlying issue here is that they all act on the same AST element
> (i.e. CodeBlock) and calling them sequentially like that will inevitably
> result in conflicts.
>
> As you can see it doesn’t really matter what I do with the template or the
> header, because neither of those two things act on the AST.
>
> On Tue, 7 Mar 2023 at 16:51, Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
> wrote:
>
>> You can get the default template for LaTeX with pandoc -D latex,
>> customize it according to your needs and specify the resulting file with
>> --template in the command. There is nothing specific here for
>> pandoc-crossrefs. See the section about templates in the manual of Pandoc
>> for more details.
>>
>> Le Tuesday 07 March 2023 à 02:06:17PM, A A a écrit :
>> >     You can include it in an external metadata file referred to via the
>> >     —metadata-file option
>> >
>> > I believe that would still be a YAML file with weird syntax like this?
>> >
>> > header-includes:
>> > - |
>> >   ~~~{=latex}
>> >   \let\oldsection\section
>> >   \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
>> >   ~~~
>> >
>> > If so then yes, I definitely prefer doing my own header.tex. But this
>> would
>> > have to include all the content necessary for pandoc-crossref to work
>> properly.
>> > Any ideas where I could find this content? I briefly skimmed the
>> > pandoc-crossref repo but didn’t find anything obvious…
>> >
>> >
>> > On Tue, 7 Mar 2023 at 12:16, Bastien DUMONT <[1]
>> bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
>> > wrote:
>> >
>> >     You can include it in an external metadata file referred to via the
>> >     --metadata-file option. However, if you customize the LaTeX preamble
>> >     heavily, it may be preferable to use a custom template including the
>> >     content of header.tex.
>> >
>> >     Le Tuesday 07 March 2023 à 12:07:19PM, A A a écrit :
>> >     > That would force me to put my header content within my markdown
>> file and
>> >     remove
>> >     > "header.tex" completely. I would very much prefer to keep them as
>> >     separate
>> >     > files.
>> >     >
>> >     > The header.tex for my use case ia much more involved. Including
>> it inside
>> >     the
>> >     > markdowm YAML block like that would be quite ugly IMO.
>> >     >
>> >     >
>> >     >
>> >     >
>> >     >
>> >     > On Tue, 7 Mar 2023, 10:16 Bastien DUMONT, <[1][2]
>> >     bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org> wrote:
>> >     >
>> >     >     Since you don't use a custom template, you don't have to add
>> $for
>> >     >     (header-includes)$ etc. anywhere: it is already included in
>> the
>> >     default
>> >     >     LaTeX template.
>> >     >     The answer for your use case is here: [2][3]
>> https://github.com/
>> >     lierdakil/
>> >     >     pandoc-crossref/issues/47#issuecomment-614404532
>> >     >
>> >     >     Le Tuesday 07 March 2023 à 10:02:38AM, A A a écrit :
>> >     >     > Files
>> >     >     >
>> >     >     > test.py
>> >     >     >
>> >     >     > def f(x):
>> >     >     >     return x
>> >     >     >
>> >     >     > test.md
>> >     >     >
>> >     >     > ~~~{
>> >     >     >   #lst:test
>> >     >     >   .py
>> >     >     >   include="test.py"
>> >     >     >   caption=`test.py`
>> >     >     > }
>> >     >     > ~~~
>> >     >     >
>> >     >     > header.tex
>> >     >     >
>> >     >     > \usepackage{minted}
>> >     >     >
>> >     >     > \definecolor{bg}{rgb}{0.85, 0.85. 0.85}
>> >     >     > \setminted{breaklines=true, bgcolor=bg, breakanywhere}
>> >     >     >
>> >     >     > Compilation
>> >     >     >
>> >     >     > I’m compiling with:
>> >     >     >
>> >     >     > pandoc -s -F pandoc-crossref -L include-code-files.lua -L
>> >     minted.lua -H
>> >     >     header.tex --from markdown --to latex test.md -o test.tex
>> >     >     > latexmk --shell-escape -pdflatex test.tex
>> >     >     >
>> >     >     > I get an error upon compilation, because pandoc-crossref
>> defines
>> >     its own
>> >     >     header
>> >     >     > include which gets overwritten by my -H header.tex. This
>> [1]link
>> >     provides
>> >     >     more
>> >     >     > information.
>> >     >     >
>> >     >     > I tried the solution proposed by @lierdakil in the link
>> provided
>> >     but get
>> >     >     an
>> >     >     > error:
>> >     >     >
>> >     >     >     ! LaTeX Error: Missing \begin{document}.
>> >     >     >
>> >     >     >     See the LaTeX manual or LaTeX Companion for explanation.
>> >     >     >     Type H for immediate help.
>> >     >     >
>> >     >     >     l.97 $
>> >     >     >     for(header-includes)$
>> >     >     >     ?
>> >     >     >
>> >     >     > So I’m at a bit of a loss regarding what to do here, Any
>> pointers
>> >     >     welcome.
>> >     >     > Thanks
>> >     >     >
>> >     >     > --
>> >     >     > 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 [2][3][4]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> >     >     > To view this discussion on the web visit [3][4][5]https://
>> >     groups.google.com/
>> >     >     d/msgid/
>> >     >     > pandoc-discuss/
>> >     >     > CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%[5][6]
>> >     40mail.gmail.com
>> >     >     .
>> >     >     >
>> >     >     > References:
>> >     >     >
>> >     >     > [1] [6][7]
>> https://github.com/lierdakil/pandoc-crossref/issues/47
>> >     >     > [2] mailto:[7][8]
>> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> >     >     > [3] [8][9]https://groups.google.com/d/msgid/pandoc-discuss/
>> >     >     CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%[10]
>> >     40mail.gmail.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 [9][11]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> >     >     To view this discussion on the web visit [10][12]https://
>> >     groups.google.com/d/
>> >     >     msgid/pandoc-discuss/ZAcA4dThsf/pAK2e%40localhost.
>> >     >
>> >     > --
>> >     > 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 [11][13]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> >     > To view this discussion on the web visit [12][14]https://
>> >     groups.google.com/d/msgid/
>> >     > pandoc-discuss/
>> >     > CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%[15]
>> >     40mail.gmail.com.
>> >     >
>> >     > References:
>> >     >
>> >     > [1] mailto:[16]bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org
>> >     > [2] [17]https://github.com/lierdakil/pandoc-crossref/issues/47#
>> >     issuecomment-614404532
>> >     > [3] mailto:[18]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> >     > [4] [19]https://groups.google.com/d/msgid/
>> >     > [5] [20]http://40mail.gmail.com/
>> >     > [6] [21]https://github.com/lierdakil/pandoc-crossref/issues/47
>> >     > [7] mailto:[22]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> >     > [8] [23]https://groups.google.com/d/msgid/pandoc-discuss/
>> >     CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%
>> 40mail.gmail.com?
>> >     utm_medium=email&utm_source=footer
>> >     > [9] mailto:[24]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> >     > [10] [25]
>> https://groups.google.com/d/msgid/pandoc-discuss/ZAcA4dThsf/
>> >     pAK2e%40localhost
>> >     > [11] mailto:[26]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> >     > [12] [27]https://groups.google.com/d/msgid/pandoc-discuss/
>> >     CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%
>> 40mail.gmail.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 [28]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> >     To view this discussion on the web visit [29]
>> https://groups.google.com/d/
>> >     msgid/pandoc-discuss/ZAcdDn%2Bj/f55E9xQ%40localhost.
>> >
>> > --
>> > 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 [30]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> > To view this discussion on the web visit [31]
>> https://groups.google.com/d/msgid/
>> > pandoc-discuss/
>> > CAMwawgMDb2ZF9i8T5sxeFqrnf3RRh%2BthSJXyxPsufFqPC4czBQ%40mail.gmail.com.
>> >
>> > References:
>> >
>> > [1] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org
>> > [2] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org
>> > [3] https://github.com/lierdakil/
>> > [4] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [5] https://groups.google.com/
>> > [6] http://40mail.gmail.com/
>> > [7] https://github.com/lierdakil/pandoc-crossref/issues/47
>> > [8] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [9] https://groups.google.com/d/msgid/pandoc-discuss/
>> > [10] http://40mail.gmail.com/
>> > [11] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [12] https://groups.google.com/d/
>> > [13] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [14] https://groups.google.com/d/msgid/
>> > [15] http://40mail.gmail.com/
>> > [16] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org
>> > [17]
>> https://github.com/lierdakil/pandoc-crossref/issues/47#issuecomment-614404532
>> > [18] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [19] https://groups.google.com/d/msgid/
>> > [20] http://40mail.gmail.com/
>> > [21] https://github.com/lierdakil/pandoc-crossref/issues/47
>> > [22] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [23]
>> https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%40mail.gmail.com?utm_medium=email&utm_source=footer
>> > [24] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [25]
>> https://groups.google.com/d/msgid/pandoc-discuss/ZAcA4dThsf/pAK2e%40localhost
>> > [26] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [27]
>> https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%40mail.gmail.com?utm_medium=email&utm_source=footer
>> > [28] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [29]
>> https://groups.google.com/d/msgid/pandoc-discuss/ZAcdDn%2Bj/f55E9xQ%40localhost
>> > [30] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > [31]
>> https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgMDb2ZF9i8T5sxeFqrnf3RRh%2BthSJXyxPsufFqPC4czBQ%40mail.gmail.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/ZAddfXTclu2naUlX%40localhost
>> .
>>
> --
> 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/CAMwawgPQN7Jv34tv%2BkioNYJO-HJ4nhwMco%2B7BXQCLOEDHDD39A%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgPQN7Jv34tv%2BkioNYJO-HJ4nhwMco%2B7BXQCLOEDHDD39A%40mail.gmail.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/CADAJKhBkRK3nbLzvO%2BnegtNLN9v6qGDcNx1_D-E8WPd%2Bk6y7Og%40mail.gmail.com.

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

  parent reply	other threads:[~2023-03-07 18:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  9:02 A A
     [not found] ` <CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD=Ug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-03-07  9:16   ` Bastien DUMONT
2023-03-07 11:07     ` A A
     [not found]       ` <CAMwawgNJcw9d-aMSPFStx+wU__GrsDVhhNrARCLf4CdHNiGCWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-03-07 11:16         ` Bastien DUMONT
2023-03-07 13:06           ` A A
     [not found]             ` <CAMwawgMDb2ZF9i8T5sxeFqrnf3RRh+thSJXyxPsufFqPC4czBQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-03-07 15:16               ` A A
2023-03-07 15:51               ` Bastien DUMONT
2023-03-07 18:28                 ` A A
     [not found]                   ` <CAMwawgPQN7Jv34tv+kioNYJO-HJ4nhwMco+7BXQCLOEDHDD39A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-03-07 18:42                     ` BPJ [this message]
2023-03-07 19:18                     ` bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg
2023-03-07 19:30                       ` A A
     [not found]                         ` <CAMwawgPtfX8+qy4q2nx7+DL-kWhX82QnWh6BQ8CHPyHGZ3uuzw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-03-07 19:37                           ` Bastien DUMONT
2023-03-07 19:48                             ` A A
     [not found]                               ` <CAMwawgPuUvCg1TtGbqz4zsi6-2yJkcAtC27rsx6nNV6id_z6vw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-03-07 20:31                                 ` Bastien DUMONT
2023-03-08 16:16                                   ` A A

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=CADAJKhBkRK3nbLzvO+negtNLN9v6qGDcNx1_D-E8WPd+k6y7Og@mail.gmail.com \
    --to=melroch-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).