I'm trying to use the font Arial in my document and convert from markdown to latex. I included the following in my latex template:
\usepackage{fontspec}
\setmainfont{Arial}
This works and changes the font to Arial when I use it normally, but when I use Pandoc to convert to PDF, I get the error:
Error producing PDF.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
!
! The fontspec package requires either XeTeX or LuaTeX.
!
! You must change your typesetting engine to, e.g., "xelatex" or
! "lualatex"instead of plain "latex" or "pdflatex".
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.28 \msg_fatal:nn {fontspec} {cannot-use-pdftex}
It says that the package requires XeTeX or LuaTex. I've tried many things to change the font to Arial, but nothing so far has worked.
I use OS X.
To use LuaTex when creating a pdf with Pandoc:
pandoc test.txt --pdf-engine=lualatex -o test.pdf
Apply accordingly for XeTex:
pandoc test.txt --pdf-engine=xelatex -o test.pdf
From the Pandoc Manual:
--pdf-engine=pdflatex|lualatex|xelatex|wkhtmltopdf|weasyprint|prince|context|pdfroff
Use the specified engine when producing PDF output. The default is pdflatex. If the engine is not in your PATH, the full path of the engine may be specified here.
Have a look at the Demo Section of the manual - most use cases are covered there.