public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* YAML header-include values are ignored if header-include file is given in defaults file
@ 2020-12-12 10:21 R (Chandra) Chandrasekhar
       [not found] ` <cfc52044-e614-fe99-9887-10ac0cd4a623-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: R (Chandra) Chandrasekhar @ 2020-12-12 10:21 UTC (permalink / raw)
  To: pandoc-discuss

Hello Folks!

I have a latex defaults file at ~/.pandoc/xelatex.yaml

It contains, inter alia, the line

include-in-header: [./xelatex-header-includes]

which denotes the file xelatex-header-includes in ~/.pandoc

If in addition, I add header-include information---used only with a 
particular .md source file---in a YAML metablock in the .md source file 
like so:

---
header-includes:
   - \usepackage{tcolorbox}
   - \tcbset{boxrule=0mm, arc=0mm, colback=background}
---

these latter invocations do not find a place in the generated .tex file 
and, of course, PDF generation fails with the message:

! LaTeX Error: Environment tcolorbox undefined.

The command being used is:

pandoc --defaults xelatex.yaml --to latex --pdf-engine xelatex --output 
file.tex file.md

Has anyone encountered this behaviour or can someone tell me what I am 
doing wrong?

Thank you.

Chandra


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

* Re: YAML header-include values are ignored if header-include file is given in defaults file
       [not found] ` <cfc52044-e614-fe99-9887-10ac0cd4a623-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2020-12-12 16:16   ` John MacFarlane
       [not found]     ` <m2ft4bdmpe.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2020-12-12 16:16 UTC (permalink / raw)
  To: R (Chandra) Chandrasekhar, pandoc-discuss

"R (Chandra) Chandrasekhar" <chyavana-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello Folks!
>
> I have a latex defaults file at ~/.pandoc/xelatex.yaml
>
> It contains, inter alia, the line
>
> include-in-header: [./xelatex-header-includes]
>
> which denotes the file xelatex-header-includes in ~/.pandoc

Note that relative paths in defaults files are interpreted
relative to the working directory from which you call pandoc,
not the directory containing the default file.
See https://github.com/jgm/pandoc/issues/5871
and https://github.com/jgm/pandoc/issues/5977

> If in addition, I add header-include information---used only with a 
> particular .md source file---in a YAML metablock in the .md source file 
> like so:
>
> ---
> header-includes:
>    - \usepackage{tcolorbox}
>    - \tcbset{boxrule=0mm, arc=0mm, colback=background}
> ---
>
> these latter invocations do not find a place in the generated .tex file 
> and, of course, PDF generation fails with the message:
>
> ! LaTeX Error: Environment tcolorbox undefined.

In general, if you set a variable on the command line, its
value is used in template processing.  We only set variables
from metadata values if the variables do not already have values.
If you use --include-in-header (via defaults or cli), that sets
the header-includes variable, clobbering what you have in
metadata.


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

* Re: YAML header-include values are ignored if header-include file is given in defaults file
       [not found]     ` <m2ft4bdmpe.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-12-12 19:15       ` R (Chandra) Chandrasekhar
       [not found]         ` <a0859cfa-9e04-3faa-d831-8ac4da9ee4ff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: R (Chandra) Chandrasekhar @ 2020-12-12 19:15 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw, John MacFarlane

On 12/12/2020 21:46, John MacFarlane wrote:

> Note that relative paths in defaults files are interpreted
> relative to the working directory from which you call pandoc,
> not the directory containing the default file.
> See https://github.com/jgm/pandoc/issues/5871
> and https://github.com/jgm/pandoc/issues/5977

Thanks for pointing this out. I trust that giving absolute paths to all 
files referred to in the defaults file will remove any scope for ambiguity.

> In general, if you set a variable on the command line, its
> value is used in template processing.  We only set variables
> from metadata values if the variables do not already have values.
> If you use --include-in-header (via defaults or cli), that sets
> the header-includes variable, clobbering what you have in
> metadata.

I think multiple default files are allowed at present. Are multiple 
header-include files also allowed, using the same syntax as for 
resource-path?

Chandra


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

* Re: YAML header-include values are ignored if header-include file is given in defaults file
       [not found]         ` <a0859cfa-9e04-3faa-d831-8ac4da9ee4ff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2020-12-12 19:38           ` John MacFarlane
  0 siblings, 0 replies; 4+ messages in thread
From: John MacFarlane @ 2020-12-12 19:38 UTC (permalink / raw)
  To: R (Chandra) Chandrasekhar, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

"R (Chandra) Chandrasekhar" <chyavana-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I think multiple default files are allowed at present. Are multiple 
> header-include files also allowed, using the same syntax as for 
> resource-path?

Yes (but not with the syntax of resource-path). This is explained
in the manual under --include-in-header.


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

end of thread, other threads:[~2020-12-12 19:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-12 10:21 YAML header-include values are ignored if header-include file is given in defaults file R (Chandra) Chandrasekhar
     [not found] ` <cfc52044-e614-fe99-9887-10ac0cd4a623-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-12-12 16:16   ` John MacFarlane
     [not found]     ` <m2ft4bdmpe.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-12-12 19:15       ` R (Chandra) Chandrasekhar
     [not found]         ` <a0859cfa-9e04-3faa-d831-8ac4da9ee4ff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-12-12 19:38           ` John MacFarlane

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