0

For a markdown doc that has the following preamble:

---
title: Cloud Capstone Task1
subtitle: Airline Dataset Queries 
documentclass: scrartcl
author: Stephen Boesch
geometry: "fontsize=9pt left=1.5cm,right=1.5cm,top=2cm,bottom=2cm"
fontsize: 9pt
output:
  rmarkdown::html_document:
    theme: lumen
    fig_caption: yes        
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyhead[C]{Airlines DataSet Queries}
- \fancyhead[R]{\thepage}
- \fancyfoot[LE,RO]{\thepage}
---

And for which there are zero additional tex (or pandoc) directives in the corpus- the following error is stubbornly not going away:

Error producing PDF.
! LaTeX Error: Can be used only in preamble.

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

l.275 \usepackage

Why is it pointing to a line 275 .. there is no such \usepackage there..

Here is the pandoc command:

pandoc --toc -css pandoc.css -V fontsize=9pt --pdf-engine xelatex -V geometry:"left=1.5cm,right=1.5cm,top=2cm,bottom=2cm" -o Task1.pdf Task1.md

So what is happening here?

  • line 275 can refer to the line in some file input by your document (including some of the packages). – Ulrike Fischer Mar 11 at 13:42
  • Your example works without any problems for me. Try checking that you're not using a custom template, and that you're using the most recent versions of Pandoc and TeX Live. – Andrew Dunning Mar 11 at 15:36
  • May depends on css source and some recent pandoc changes may now need -c xxx.css [and optional -s or -standalone] – KJO Mar 11 at 16:22
0

It appears that the pandoc.css were the issue. I had pulled it from a reputable source so had not considered that as a possible cause.

Later I will update on what precisely in the file has caused the mismatch.

  • If that's really the case, it would be a bug, as CSS is only used for HTML and EPUB (PDF is affected only if using an HTML-to-PDF engine). – Andrew Dunning Mar 11 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.