Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何使用中文? #60

Closed
xuefliang opened this issue Feb 9, 2016 · 2 comments
Closed

如何使用中文? #60

xuefliang opened this issue Feb 9, 2016 · 2 comments

Comments

@xuefliang
Copy link

CTeX能够正常使用中文,需要在其他模板如 Journal of Statistical Software中使用中文,改如何做?


---
author:
  - name: FirstName LastName
    affiliation: University/Company
    address: >
      First line
      Second line
    email: name@company.com
    url: http://rstudio.com
  - name: Second Author
    affiliation: Affiliation
title:
  formatted: "A Capitalized Title: Something about a Package \\pkg{foo}"
  # If you use tex in the formatted title, also supply version without
  plain:     "A Capitalized Title: Something about a Package foo"
  # For running headers, if needed
  short:     "\\pkg{foo}: A Capitalized Title"
abstract: >
  The abstract of the article.
keywords:
  # at least one keyword must be supplied
  formatted: [keywords, not capitalized, "\\proglang{Java}"]
  plain:     [keywords, not capitalized, Java]
preamble: >
  \usepackage{amsmath}
output: rticles::jss_article
documentclass: ctexart

---

# 中文 Introduction

提示:
! Undefined control sequence.
\GenericError  ...                                
                                                    #4  \errhelp \@err@     ...
l.42 \section{中文 Introduction}

pandoc: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
Execution halted
@yihui
Copy link
Member

yihui commented Feb 9, 2016

目前来说我估计不大可能,首先documentclass: ctexart对JSS模板来说毫无用处,因为模板中的文档类已经被写死了:https://github.com/rstudio/rticles/blob/master/inst/rmarkdown/templates/jss_article/resources/template.tex 其次,中文文档十之八九需要通过xelatex编译,JSS模板默认是pdflatex编译。

第一个问题也许可以通过在导言区插入\usepackage{ctexcap}解决,至于第二个问题,因为jss_article()不接受参数,所以无法设置LaTeX引擎,你只能自定义函数和模板了。

@yihui yihui closed this as completed Jul 4, 2018
@github-actions
Copy link

github-actions bot commented Nov 2, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants