What happend after click the "knit to ctex" buttion ?

my .rmd files like this, using some Latex code in the YAML part:


title: "工作总结"
author: "xupeng"
date: "r format(Sys.time(), '%Y,%B %d ')"
output:
rticles::ctex:
toc: yes
number_sections: yes
documentclass: ctexart
geometry: left=2cm,right=2cm,top=2.5cm,bottom=2cm
header-includes:

  • \newpage
  • \usepackage{fancyhdr}
  • \usepackage{lastpage}
  • \pagestyle{fancy}
  • \usepackage{tabularx}
  • \renewcommand{\tabularxcolumn}[1]{m{#1}}
  • \usepackage{hyperref}
  • \newpage
    classoption: hyperref,

\newpage
\pagestyle{fancy}
\fancyhead{}
\fancyhead[LO,LE]{\raisebox{-0.5ex}{\includegraphics[width=5cm]{logoaugct.png}} \hspace{2cm}\fontsize{9pt}{11pt}\selectfont GreatJobs\hspace{3cm}百尺竿头再接再励}
\fancyfoot{}
\fancyfoot[C]{\raisebox{2cm}{\thepage~/~\pageref*{LastPage}}}

knitr::opts_chunk$set(echo = TRUE)

\newpage

自我介绍

使用using xxxxx.

After click "knit to ctex" in rstudio , the .rmd can be successfully complied to pdf file.

What's the r code should I type, instead of click the "knit to ctex" button ? I've nearly 100 .rmd files to produce the pdf files.
I've tried input the code:

opts_knit$set(out.format="render_latex")
knit("input.rmd",out="tmp.md")
render('tmp.md',"rticles::ctex")

or:

rmarkdown::render("report.rmd",output_format = 'rticles::ctex')

But error happend:
Error producing PDF.
! Undefined control sequence.
l.162 ...) cat(text) # 显示文本内容 cat(text, sep =''\n

错误: pandoc document conversion failed with error 43

So, Can somebody tell me , what's the correct code to complied the .rmd to ctex pdf files ?
Thanks.

This would be the right command: use rmarkdown::render() on your unmodified .Rmd file as input; it will use by default the first format provided in output:

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.