我想将 ModernCV 模板与 一起使用pandoc
。我有一个自定义.cls
文件、各种.sty
文件和一个.tex
使用自定义类的文件。我可以使用 转换文件.tex
,pdflatex
没有任何问题,自定义类和样式在同一个文件夹中时会自动使用。当我尝试使用 转换同一个文件时pandoc
,它会失败
Error producing PDF.
! Undefined control sequence.
l.76 \cvitem
据我了解,pandoc
不会自动使用.cls
文件,但是当我运行它时pandoc cv_7.tex -o ex.pdf -M documentclass=moderncv
,它会失败
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
虽然只加载一次,但这是相关部分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}
我想我可能需要对.cls
文件进行一些调整才能使其正常工作。有没有办法将类原封不动地包含在内pandoc
,还是我应该将整个文件转移到header-includes
YAML 标头的部分或完全不同的地方?