agoldst / memarticle

A pandoc template for an article (using the memoir class)
6 stars 2 forks source link

PDF generation error `l.113 \thispagestyle` #1

Open lamyergeier opened 3 weeks ago

lamyergeier commented 3 weeks ago

Info

Fedora 40.

$ pandoc --version
pandoc 3.3
$ pdflatex --version
pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023/Fedora 40)

Fonts used

fc-list | grep -i 'CMU Sans Serif'
/usr/share/fonts/cm-unicode/cmunsx.otf: CMU Sans Serif:style=Bold
/usr/share/fonts/cm-unicode/cmunss.otf: CMU Sans Serif:style=Medium
/usr/share/fonts/cm-unicode/cmunso.otf: CMU Sans Serif:style=BoldOblique
/usr/share/fonts/cm-unicode/cmunssdc.otf: CMU Sans Serif Demi Condensed:style=DemiCondensed
/usr/share/fonts/cm-unicode/cmunsi.otf: CMU Sans Serif:style=Oblique
fc-list | grep -i 'CMU Serif'
/usr/share/fonts/cm-unicode/cmunbi.otf: CMU Serif:style=BoldItalic
/usr/share/fonts/cm-unicode/cmunbx.otf: CMU Serif:style=Bold
/usr/share/fonts/cm-unicode/cmunui.otf: CMU Serif Upright Italic:style=UprightItalic
/usr/share/fonts/cm-unicode/cmunrb.otf: CMU Serif Extra:style=BoldNonextended
/usr/share/fonts/cm-unicode/cmunrm.otf: CMU Serif:style=Roman
/usr/share/fonts/cm-unicode/cmunsl.otf: CMU Serif Extra:style=RomanSlanted
/usr/share/fonts/cm-unicode/cmunbl.otf: CMU Serif Extra:style=BoldSlanted
/usr/share/fonts/cm-unicode/cmunti.otf: CMU Serif:style=Italic

paper.md (yaml front matter)

I modified it as follows

title: The Soul of Man under Socialism
subtitle: (Excerpt)
author: Oscar Wilde
date: February, 1891
mainfont: CMU Serif
#mainfontoptions:
  #- Numbers=OldStyle
  #- BoldFont=CMU Sans Serif Bold
fontsize: 12pt
classoption: [oneside]
#biblatex: true
#biblatex-chicago: true
#biblatexoptions: notes
#bibliography: ../sources.bib
#nobib: false
#chicago-ellipses: true
anon: false
titlefont: CMU Sans Serif

Generate PDF

pandoc --template=memoir-article.latex paper.md -o paper.pdf
Error producing PDF.
! Undefined control sequence.
<recently read> \fontspec 

l.113 \thispagestyle

Generate Latex

pandoc --template=memoir-article.latex paper.md -o paper.tex

This was successful. It is uploaded here.

Observation

  1. Latex file was successfully generated.
  2. But PDF generation is unsuccessful.

Question

  1. Why PDF generation is causing that error? Any suggestions?
  2. Is this the correct way of choosing the font?
  3. How to find, what to put for mainfontoptions?
agoldst commented 3 weeks ago

Thanks for the detailed report. My template is at fault: sorry! Specifying a titlefont will only work if you are also using xelatex or lualatex rather than the default pdflatex (that's what the fontspec error means). Looks like you're configured to use the CMU fonts with those engines, so pandoc --template=memoir-article.latex --xelatex paper.md -o paper.pdf ought to work. Otherwise, you can work around this by setting manual-title: true and writing your own commands in the body to typeset the title. I'll fix the template issue when I have a moment.