lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
911 stars 72 forks source link

add custom latex header with include in header #390

Closed awelormro closed 1 year ago

awelormro commented 1 year ago

Hello, sorry to bother again, I'm trying to add some custom header options to produce pdf using crossref, I'm currently using the crossref pandoc-crossref v0.3.16.0 git commit UNKNOWN (UNKNOWN) built with Pandoc v3.1.2, pandoc-types v1.23 and GHC 9.0.2

pandoc 3.1.2 Features: +server +lua

And I'm trying to add some header options, the following command to run it is as follows: pandoc demo.md -o demopdf.pdf -d encabezadoapa.yml

And the yaml file is the following:

metadata:
  bibliography: biblio.bib
  link-citations: true
  figureTitle: "Figura"
  tableTitle: "Tabla"
  figPrefix: "Figura "
  eqnPrefix: "Ecuación "
  tblPrefix: "Tabla "
  loftitle: "# Lista de figuras"
  lotTitle: "# Lista de tablas"
  header-includes: 
    - "\\usepackage{fancyhdr}"
    - "\\newcommand{\\pcdoc}{Pandoc-crossref documentation}"
toc: true
toc-depth: 3
filters:
  - parse-latex.lua
  - pandoc-crossref
  - citeproc
reference-doc: custom-referencestyles.docx
pdf-engine: xelatex

Everything works well without the header, but I need it to add some options inside the pdf output, and it does not make any difference when I put the command indicated in the manual at the beggining or in the very end, deleting the header it works well, the error obtained is this:

Error producing PDF.
! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.104 \textbackslash

Do I forgot something to add or am I configuring in the wrong way?

awelormro commented 1 year ago

Sorry to bother, the solution was to move the metadata to another file and invoke it via --metadata-file command