如何让 pandoc 使用自定义类

如何让 pandoc 使用自定义类

我想将 ModernCV 模板与 一起使用pandoc。我有一个自定义.cls文件、各种.sty文件和一个.tex使用自定义类的文件。我可以使用 转换文件.texpdflatex没有任何问题,自定义类和样式在同一个文件夹中时会自动使用。当我尝试使用 转换同一个文件时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-includesYAML 标头的部分或完全不同的地方?

相关内容