* How to add to header-includes?
@ 2023-05-22 8:25 oliver
[not found] ` <6D8F810C-361A-44A1-AA2E-FA22B318A2C2-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: oliver @ 2023-05-22 8:25 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
When I use `header-includes:` in a `metadata-file` I can not add more
header lines to it, neither via document YAML nor via `-H <file>` on
the command line. The previous includes are always forgotten.
How can I add header stuff from a file _and_ in the documents YAML?
--
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/6D8F810C-361A-44A1-AA2E-FA22B318A2C2%40halloleo.hailmail.net.
[-- Attachment #2: Type: text/html, Size: 1466 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to add to header-includes?
[not found] ` <6D8F810C-361A-44A1-AA2E-FA22B318A2C2-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
@ 2023-05-22 8:59 ` Bastien DUMONT
2023-05-22 13:53 ` news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA
2023-05-22 14:27 ` Albert Krewinkel
1 sibling, 1 reply; 8+ messages in thread
From: Bastien DUMONT @ 2023-05-22 8:59 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
A possible solution would be to use a custom variable (such as header-includes-suppl) and to include it in your template after header-includes.
Le Monday 22 May 2023 à 06:25:57PM, oliver a écrit :
> When I use header-includes: in a metadata-file I can not add more header lines
> to it, neither via document YAML nor via -H <file> on the command line. The
> previous includes are always forgotten.
>
> How can I add header stuff from a file and in the documents YAML?
>
> --
> 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [2]https://groups.google.com/d/msgid/
> pandoc-discuss/6D8F810C-361A-44A1-AA2E-FA22B318A2C2%40halloleo.hailmail.net.
>
> References:
>
> [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [2] https://groups.google.com/d/msgid/pandoc-discuss/6D8F810C-361A-44A1-AA2E-FA22B318A2C2%40halloleo.hailmail.net?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/ZGsu4YzCdIa7nMQh%40localhost.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to add to header-includes?
2023-05-22 8:59 ` Bastien DUMONT
@ 2023-05-22 13:53 ` news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA
0 siblings, 0 replies; 8+ messages in thread
From: news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA @ 2023-05-22 13:53 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
A cool idea, Bastien! Thanks.
Does this mean I cannot use the default templates, right?
On Mon, 22 May 2023, at 6:59 PM, Bastien DUMONT wrote:
> A possible solution would be to use a custom variable (such as
> header-includes-suppl) and to include it in your template after
> header-includes.
>
> Le Monday 22 May 2023 à 06:25:57PM, oliver a écrit :
>> When I use header-includes: in a metadata-file I can not add more header lines
>> to it, neither via document YAML nor via -H <file> on the command line. The
>> previous includes are always forgotten.
>>
>> How can I add header stuff from a file and in the documents YAML?
>>
>> --
>> 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit [2]https://groups.google.com/d/msgid/
>> pandoc-discuss/6D8F810C-361A-44A1-AA2E-FA22B318A2C2%40halloleo.hailmail.net.
>>
>> References:
>>
>> [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> [2] https://groups.google.com/d/msgid/pandoc-discuss/6D8F810C-361A-44A1-AA2E-FA22B318A2C2%40halloleo.hailmail.net?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/ZGsu4YzCdIa7nMQh%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/0128b370-486a-4059-afc0-f0ca8253b0e9%40app.fastmail.com.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to add to header-includes?
[not found] ` <6D8F810C-361A-44A1-AA2E-FA22B318A2C2-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
2023-05-22 8:59 ` Bastien DUMONT
@ 2023-05-22 14:27 ` Albert Krewinkel
[not found] ` <87y1lgqvuz.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
1 sibling, 1 reply; 8+ messages in thread
From: Albert Krewinkel @ 2023-05-22 14:27 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
oliver <news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org> writes:
> When I use header-includes: in a metadata-file I can not add more
> header lines to it, neither via document YAML nor via -H <file> on
> the command line. The previous includes are always forgotten.
>
> How can I add header stuff from a file and in the documents YAML?
Bit crude, but here's a Lua filter that can help with this. The
`--include-in-header`/`-H` option must be replaced with `-M
include-in-header=...`, and the default includes must be specified in
the `default-includes` field.
``` lua
-- file: includes.lua
local function ensure_list (x)
return pandoc.utils.type(x) == 'List' and x or pandoc.List{x}
end
local function read_file (filename)
return pandoc.RawBlock(FORMAT, io.open(filename, 'rb'):read('a'))
end
function Meta (meta)
-- Add to header-includes
meta['header-includes'] = ensure_list(meta['header-includes'])
meta['header-includes']:extend(ensure_list(meta['default-includes']))
meta['header-includes']:insert(read_file(meta['include-in-header']))
-- unset custom include fields
meta['extra-includes'] = nil
meta['default-in-header'] = nil
return meta
end
```
--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to add to header-includes?
[not found] ` <87y1lgqvuz.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2023-05-25 11:37 ` Oliver
2023-07-03 8:46 ` Oliver
1 sibling, 0 replies; 8+ messages in thread
From: Oliver @ 2023-05-25 11:37 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Thanks Albert
I will try it out.
Cool that you can do something like that in a filter! I had thought filters can only change the AST - or is the metadata part of the AST?
Happy pandocing,
Olli
On 23 May 2023, at 0:27, Albert Krewinkel wrote:
> oliver <news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org> writes:
>
>> When I use header-includes: in a metadata-file I can not add more
>> header lines to it, neither via document YAML nor via -H <file> on
>> the command line. The previous includes are always forgotten.
>>
>> How can I add header stuff from a file and in the documents YAML?
>
> Bit crude, but here's a Lua filter that can help with this. The
> `--include-in-header`/`-H` option must be replaced with `-M
> include-in-header=...`, and the default includes must be specified in
> the `default-includes` field.
>
>
> ``` lua
> -- file: includes.lua
> local function ensure_list (x)
> return pandoc.utils.type(x) == 'List' and x or pandoc.List{x}
> end
>
> local function read_file (filename)
> return pandoc.RawBlock(FORMAT, io.open(filename, 'rb'):read('a'))
> end
>
> function Meta (meta)
> -- Add to header-includes
> meta['header-includes'] = ensure_list(meta['header-includes'])
> meta['header-includes']:extend(ensure_list(meta['default-includes']))
> meta['header-includes']:insert(read_file(meta['include-in-header']))
>
> -- unset custom include fields
> meta['extra-includes'] = nil
> meta['default-in-header'] = nil
>
> return meta
> end
> ```
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>
> --
> 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/87y1lgqvuz.fsf%40zeitkraut.de.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to add to header-includes?
[not found] ` <87y1lgqvuz.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-05-25 11:37 ` Oliver
@ 2023-07-03 8:46 ` Oliver
[not found] ` <CDCA3285-4D99-40FE-B54D-603494C2B62D-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
1 sibling, 1 reply; 8+ messages in thread
From: Oliver @ 2023-07-03 8:46 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Hi there
In a markdown document I can add for the LaTeX writer the following in
the YAML metadata blocK:
```
---
header-includes:
- \usepackage{tikzsymbols}
...
```
Then I can use in the document things like `\Cooley[-3][cyan]` and more.
:-)
However I was not able to add this `\usepackage` declaration to a
defaults file. I tried in my defaults file `myarticle.yaml` the
following:
```
from: markdown+raw_attribute
metadata:
documentclass: scrartcl
header-includes:
- \usepackage{tikzsymbols}
```
but then I get the Latex error:
```
! LaTeX Error: Missing \begin{document}.
[...]
l.46 \textbackslash
```
Somehow the `\usepackage{tikzsymbols}` command is now „escaped“ so
that the backslash get printed out... How can I avoid this and give the
`\usepackage` declaration in the defaults file?
Thanks for any pointers!
Oliver
--
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/CDCA3285-4D99-40FE-B54D-603494C2B62D%40halloleo.hailmail.net.
[-- Attachment #2: Type: text/html, Size: 2937 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to add to header-includes?
[not found] ` <CDCA3285-4D99-40FE-B54D-603494C2B62D-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
@ 2023-07-03 21:45 ` John MacFarlane
[not found] ` <441446FF-9399-4E3C-959B-12C98167C63D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2023-07-03 21:45 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 2489 bytes --]
This will work in header-includes in your document's metadata, but not in header-includes in the metadata section of a defaults file file. The reason is that, as documented, values passed to --metadata are parsed as plain text, while metadata in a markdown file is parsed as markdown.
You could try
variables:
header-includes:
- \usepackage{tikzsymbols}
Variable text is passed through unchanged (so no escaping).
> On Jul 3, 2023, at 1:46 AM, Oliver <news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org> wrote:
>
> Hi there
>
> In a markdown document I can add for the LaTeX writer the following in the YAML metadata blocK:
>
> ---
> header-includes:
> - \usepackage{tikzsymbols}
> ...
> Then I can use in the document things like \Cooley[-3][cyan] and more. :-)
>
> However I was not able to add this \usepackage declaration to a defaults file. I tried in my defaults file myarticle.yaml the following:
>
> from: markdown+raw_attribute
> metadata:
> documentclass: scrartcl
> header-includes:
> - \usepackage{tikzsymbols}
> but then I get the Latex error:
>
> ! LaTeX Error: Missing \begin{document}.
> [...]
> l.46 \textbackslash
> Somehow the \usepackage{tikzsymbols} command is now „escaped“ so that the backslash get printed out... How can I avoid this and give the \usepackage declaration in the defaults file?
>
> Thanks for any pointers!
>
> Oliver
>
>
> --
> 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/CDCA3285-4D99-40FE-B54D-603494C2B62D%40halloleo.hailmail.net <https://groups.google.com/d/msgid/pandoc-discuss/CDCA3285-4D99-40FE-B54D-603494C2B62D%40halloleo.hailmail.net?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/441446FF-9399-4E3C-959B-12C98167C63D%40gmail.com.
[-- Attachment #2: Type: text/html, Size: 4530 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to add to header-includes?
[not found] ` <441446FF-9399-4E3C-959B-12C98167C63D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2023-07-04 1:57 ` Oliver
0 siblings, 0 replies; 8+ messages in thread
From: Oliver @ 2023-07-04 1:57 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 3211 bytes --]
Thanks a lot, John
Using `variables:` instead of `metadata:` does the trick.
Thanks again,
Oliver
On 4 Jul 2023, at 7:45, John MacFarlane wrote:
> This will work in header-includes in your document's metadata, but not
> in header-includes in the metadata section of a defaults file file.
> The reason is that, as documented, values passed to --metadata are
> parsed as plain text, while metadata in a markdown file is parsed as
> markdown.
>
> You could try
>
> variables:
> header-includes:
> - \usepackage{tikzsymbols}
>
> Variable text is passed through unchanged (so no escaping).
>
>> On Jul 3, 2023, at 1:46 AM, Oliver <news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
>> wrote:
>>
>> Hi there
>>
>> In a markdown document I can add for the LaTeX writer the following
>> in the YAML metadata blocK:
>>
>> ---
>> header-includes:
>> - \usepackage{tikzsymbols}
>> ...
>> Then I can use in the document things like \Cooley[-3][cyan] and
>> more. :-)
>>
>> However I was not able to add this \usepackage declaration to a
>> defaults file. I tried in my defaults file myarticle.yaml the
>> following:
>>
>> from: markdown+raw_attribute
>> metadata:
>> documentclass: scrartcl
>> header-includes:
>> - \usepackage{tikzsymbols}
>> but then I get the Latex error:
>>
>> ! LaTeX Error: Missing \begin{document}.
>> [...]
>> l.46 \textbackslash
>> Somehow the \usepackage{tikzsymbols} command is now „escaped“ so
>> that the backslash get printed out... How can I avoid this and give
>> the \usepackage declaration in the defaults file?
>>
>> Thanks for any pointers!
>>
>> Oliver
>>
>>
>> --
>> 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/CDCA3285-4D99-40FE-B54D-603494C2B62D%40halloleo.hailmail.net
>> <https://groups.google.com/d/msgid/pandoc-discuss/CDCA3285-4D99-40FE-B54D-603494C2B62D%40halloleo.hailmail.net?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/441446FF-9399-4E3C-959B-12C98167C63D%40gmail.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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/A380651D-9A5B-4D48-8526-DA3E2B21B711%40halloleo.hailmail.net.
[-- Attachment #2: Type: text/html, Size: 6011 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-04 1:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 8:25 How to add to header-includes? oliver
[not found] ` <6D8F810C-361A-44A1-AA2E-FA22B318A2C2-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
2023-05-22 8:59 ` Bastien DUMONT
2023-05-22 13:53 ` news-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA
2023-05-22 14:27 ` Albert Krewinkel
[not found] ` <87y1lgqvuz.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-05-25 11:37 ` Oliver
2023-07-03 8:46 ` Oliver
[not found] ` <CDCA3285-4D99-40FE-B54D-603494C2B62D-WPTjrydoUPgeaOpM6FAJmQkbCANdLtlA@public.gmane.org>
2023-07-03 21:45 ` John MacFarlane
[not found] ` <441446FF-9399-4E3C-959B-12C98167C63D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-07-04 1:57 ` Oliver
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).