Skip to content

如何使用中文? #60

Closed
Closed

Description

@xuefliang

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

Activity

  1. yihui commented on Feb 9, 2016

    @yihui
    Contributor

    目前来说我估计不大可能,首先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引擎,你只能自定义函数和模板了。

  2. github-actions commented on Nov 2, 2020

    @github-actions

    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.

  3. locked as resolved and limited conversation to collaborators on Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions