%% LyX 2.0.6 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass{ctexart}
\usepackage{fontspec}
\usepackage[paperwidth=18cm,paperheight=18cm]{geometry}
\geometry{verbose,tmargin=1.5cm,bmargin=1cm,lmargin=1cm,rmargin=1cm}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{multicol}
\makeatother
\begin{document}
\newpage
1.1 旗舰店访次(周)
<<setup, include=FALSE>>=
options(device = function(file, width = 2, height = 2, ...) {
cairo_pdf(tempfile(), width = width, height = height, ...) })
pdf.options(family = "GB1")
@
<<fig9,echo=FALSE,warning=FALSE,message=FALSE,fig.width=6,fig.height=5,fig.align="center">>=
library(ggplot2)
x=data.frame(a=1:10,b=1:10)
p=ggplot(x,aes(x=a,y=b))
p+geom_line()+labs(x="直线")
@
\newpage
\end{document}
不使用\usepackage{fontspec} ,不支持中文,使用报错,是否少安装了什么,还是Rstudio配置问题
报错如下:
output file: ASDF.tex
Error: running 'texi2dvi' on 'ASDF.tex' failed
LaTeX errors:
!
! The fontspec package requires either XeTeX or LuaTeX to function.
! The fontspec package requires either XeTeX or LuaTeX to function.
!
!
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! instead of plain "latex" or "pdflatex".
! instead of plain "latex" or "pdflatex".
!
!
! See the fontspec documentation for further information.
! See the fontspec documentation for further information.
!
!
! For immediate help type H <return>
! For immediate help type H <return>
|'''''''''''''''''''''''''''''''''''''''''''''''
| This is a fatal error: LaTeX will abort
|...............................................
In addition: Warning message:
running command '"D:\PROGRA~1\CTEX\MiKTeX\miktex\bin\texi2dvi.exe" --quiet --pdf "ASDF.tex" -I "D:/setup/R/share/texmf/tex/latex" -I "D:/setup/R/share/texmf/bibtex/bst"' had status 1