Pandoc, and xelatex's fancyhrd package…

,

I have a script that calls pandoc --pdf-engine=xelatex […] and in the markdown metadata, I have

header-includes: |
    \usepackage{fancyhdr}

which used to work fine on F34. Now, I get this error:

Error producing PDF.
! Undefined control sequence.
<argument> \undefinedpagestyle

l.83 \pagestyle{fancy}

Yet, I have these installed and running LaTeX via latexmk on a .tex file with fancyhrd works fine.

texlive-fancyhdr-it-doc-svn21912.0-45.fc35.noarch
texlive-autofancyhdr-svn54049-45.fc35.noarch
texlive-scrlayer-fancyhdr-svn58746-45.fc35.noarch
texlive-fancyhdr-doc-svn57672-45.fc35.noarch
texlive-fancyhdr-svn57672-45.fc35.noarch

Any idea what I am doing wrong?

1 Like

If it works with latexmk, at least your texlive installation should be OK.

Any chance you can provide a MWE for us to tinker with to investigate this further?

Sure, here is the script:

#!/bin/bash
pandoc \
    --pdf-engine=xelatex \
    -o $(basename $1 .md).pdf \
    --variable fontsize=10pt \
    $1

And the markdown:

---
title:      A title.
author:     An Author
geometry:   margin=3.5cm
tags:
    - changeme
header-includes: |
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \fancyhead[LO,LE]{\rightmark}
    \fancyhead[CO,CE]{}
    \fancyfoot[LO,LE]{\emph{© ookeek.}}
    \fancyfoot[CO,CE]{}
    \fancyfoot[LE,RO]{\thepage}
    \fancypagestyle{plain}{\pagestyle{fancy}}
---
# Template

and the result:

Error producing PDF.
! Undefined control sequence.
<argument> \undefinedpagestyle

l.83 \pagestyle{fancy}

Your example perfectly compiles on my f35 machines.

I have the following TeXlive collections installed:

texlive-collection-basic
texlive-collection-bibtexextra
texlive-collection-binextra
texlive-collection-context
texlive-collection-fontsextra
texlive-collection-fontsrecommended
texlive-collection-fontutils
texlive-collection-formatsextra
texlive-collection-langenglish
texlive-collection-langgerman
texlive-collection-latex
texlive-collection-latexextra
texlive-collection-latexrecommended
texlive-collection-luatex
texlive-collection-mathscience
texlive-collection-metapost
texlive-collection-pictures 
texlive-collection-plaingeneric 
texlive-collection-pstricks 
texlive-collection-publishers 
texlive-collection-xetex
$ dnf list --installed | grep fancy
texlive-autofancyhdr.noarch                       9:svn54049-45.fc35                     @fedora
texlive-context-fancybreak.noarch                 9:svn47085-45.fc35                     @fedora
texlive-fancybox.noarch                           9:svn18304.1.4-45.fc35                 @fedora
texlive-fancyhandout.noarch                       9:svn46411-45.fc35                     @fedora
texlive-fancyhdr.noarch                           9:svn57672-45.fc35                     @fedora
texlive-fancylabel.noarch                         9:svn46736-45.fc35                     @fedora
texlive-fancynum.noarch                           9:svn15878.0.92-45.fc35                @fedora
texlive-fancypar.noarch                           9:svn58895-45.fc35                     @fedora
texlive-fancyref.noarch                           9:svn15878.0.9c-45.fc35                @fedora
texlive-fancyslides.noarch                        9:svn36263.1.0-45.fc35                 @fedora
texlive-fancytabs.noarch                          9:svn41549-45.fc35                     @fedora
texlive-fancytooltips.noarch                      9:svn56291-45.fc35                     @fedora
texlive-fancyvrb.noarch                           9:svn57488-45.fc35                     @fedora
texlive-scrlayer-fancyhdr.noarch                  9:svn58746-45.fc35                     @fedora
2 Likes

So, I removed all the LaTeX rpms I had installed, then installed the above. Now, the script work. Go figure!

Thank you so much for taking the time to look into this. It is much appreciated.

2 Likes