I want to use the ModernCV template with pandoc. I have a custom .cls file, various .sty files and one .tex file that makes use of the custom class. I can convert the .tex file with pdflatex without problems, the custom class and styles are used automatically when in the same folder. When I try to convert the same file with pandoc, it fails with
Error producing PDF.
! Undefined control sequence.
l.76 \cvitem
From my understanding, pandoc doesn't automatically use .cls files, but when I run pandoc cv_7.tex -o ex.pdf -M documentclass=moderncv, it fails with
Error producing PDF.
! LaTeX Error: Option clash for package hyperref.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.59 \begin{document}
hyperref is only loaded once though, this is the relevant part of the modercv.cls:
% hyper links (hyperref is loaded at the end of the preamble to pass options required by loaded packages such as CJK)
\RequirePackage{url}
\urlstyle{tt}
\AtEndPreamble{
\pagenumbering{arabic}% has to be issued before loading hyperref, as to set \thepage and hence to avoid hyperref issuing a warning and setting pdfpagelabels=false
\RequirePackage[unicode]{hyperref}% unicode is required for unicode pdf metadata
\hypersetup{
breaklinks,
baseurl = http://,
pdfborder = 0 0 0,
pdfpagemode = UseNone,% do not show thumbnails or bookmarks on opening
pdfstartpage = 1,
pdfcreator = {\LaTeX{} with 'moderncv' package},
% pdfproducer = {\LaTeX{}},% will/should be set automatically to the correct TeX engine used
bookmarksopen = true,
bookmarksdepth= 2,% to show sections and subsections
pdfauthor = {\@firstname{}~\@familyname{}},
pdftitle = {\@firstname{}~\@familyname{} -- \@title{}},
pdfsubject = {Resum\'{e} of \@firstname{}~\@familyname{}},
pdfkeywords = {\@firstname{}~\@familyname{}, curriculum vit\ae{}, resum\'{e}}}}
% graphics
\RequirePackage{graphicx}
I think I probably have to tweak the .cls file a bit to make it work. Is there a way to include the class as is in pandoc or should I transfer the whole file to the header-includes section of the YAML header or something entirely different?
pandocand I think its advantage is that it is easier to manage and to create a template, even with custom commands. – iuvbio Oct 28 '19 at 20:22