RMarkdown和亚美尼亚语的编织

时间:2019-12-14 13:26:47

标签: r localization r-markdown knitr babel

预先感谢您的帮助。我正在尝试将RMD文件参数化编织为不同语言的PDF和HTML。亚美尼亚人就是其中之一。编织为HTML总是会产生文字UTF实体,例如<U+0553><U+0578><U+0580><U+0571><U+0561><U+057C><U+0578>。编织LuaLaTeX时,我不断遇到关于找不到armenian.ltf文件的错误提示。

我还尝试使用XeLaTeX并将主字体设置为DejaVu Sans(即latex_engine: xelatexmainfont: DejaVu Sans,它们确实可以编织,但是所有亚美尼亚语又被编织为UTF实体,而R Markdown给了我错误:

    Output created: cv-hy.pdf
    Warning messages:
    1: LaTeX Warning: Unused global option(s):
        [welsh]. 
    2: LaTeX Warning: Unused global option(s):
        [armenian].

我不知如何使这项工作有效。任何帮助将不胜感激。


这是我的最小文件(LuaLaTeX):

    ---
    title: "Test Doc"
    author: "Document"
    output:
      html_fragment:
        section_divs: no
      pdf_document:
        latex_engine: lualatex
    geometry: margin = 2cm
    params:
      lang: yes
    lang: "`r switch(params$lang, CY = 'cy-GB', EN = 'en-GB', HY = 'hy-AM')`"
    knit: (function(inputFile, encoding){ files <- c("cv-cy", "cv-en", "cv-hy"); langs <- c(list(lang = "CY"), list(lang = "EN"), list(lang = "HY")); i <- 1; for(f in files){ rmarkdown::render(inputFile, output_format = c("html_fragment", "pdf_document"), encoding = encoding, params = langs[i], output_file = c(paste0(dirname(inputFile), "/", print(f)), paste0(dirname(inputFile), "/", print(f)))); i <- i +1 } })
    ---

    ```
    {r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE)
    lswitch <- function(lang, ...){
      switch(lang, ..., stop(""))
    }
    ```

    `r lswitch(params$lang,
    CY = "# Enw",
    EN = "# Name",
    HY = "# Անում"
    )
    `

这是LuaLaTeX版本的.log中的相关部分:

    ) (d:/texlive/texmf-dist/tex/generic/babel/babel.sty
    Package: babel 2019/05/04 3.31 The Babel package
    (d:/texlive/texmf-dist/tex/generic/babel/switch.def
    File: switch.def 2019/05/04 3.31 Babel switching mechanism
    ) (d:/texlive/texmf-dist/tex/generic/babel/luababel.def
    \l@dumylang=\language2
    Package babel Info: Non-standard hyphenation setup on input line 114.
    \l@nohyphenation=\language3
    \l@german-x-2019-04-04=\language4
    \l@ngerman-x-2019-04-04=\language5
    \l@afrikaans=\language6
    \l@ancientgreek=\language7
    \l@ibycus=\language8
    \l@arabic=\language9
    \l@armenian=\language10
    \l@basque=\language11
    \l@belarusian=\language12
    \l@bulgarian=\language13
    \l@catalan=\language14
    \l@pinyin=\language15
    \l@churchslavonic=\language16
    \l@coptic=\language17
    \l@croatian=\language18
    \l@czech=\language19
    \l@danish=\language20
    \l@dutch=\language21
    \l@ukenglish=\language22
    \l@usenglishmax=\language23
    \l@esperanto=\language24
    \l@estonian=\language25
    \l@ethiopic=\language26
    \l@farsi=\language27
    \l@finnish=\language28
    \l@french=\language29
    \l@friulan=\language30
    \l@galician=\language31
    \l@georgian=\language32
    \l@german=\language33
    \l@ngerman=\language34
    \l@swissgerman=\language35
    \l@monogreek=\language36
    \l@greek=\language37
    \l@hungarian=\language38
    \l@icelandic=\language39
    \l@assamese=\language40
    \l@bengali=\language41
    \l@gujarati=\language42
    \l@hindi=\language43
    \l@kannada=\language44
    \l@malayalam=\language45
    \l@marathi=\language46
    \l@oriya=\language47
    \l@panjabi=\language48
    \l@pali=\language49
    \l@tamil=\language50
    \l@telugu=\language51
    \l@indonesian=\language52
    \l@interlingua=\language53
    \l@irish=\language54
    \l@italian=\language55
    \l@kurmanji=\language56
    \l@latin=\language57
    \l@classiclatin=\language58
    \l@liturgicallatin=\language59
    \l@latvian=\language60
    \l@lithuanian=\language61
    \l@mongolian=\language62
    \l@mongolianlmc=\language63
    \l@bokmal=\language64
    \l@nynorsk=\language65
    \l@occitan=\language66
    \l@piedmontese=\language67
    \l@polish=\language68
    \l@portuguese=\language69
    \l@romanian=\language70
    \l@romansh=\language71
    \l@russian=\language72
    \l@sanskrit=\language73
    \l@serbian=\language74
    \l@serbianc=\language75
    \l@slovak=\language76
    \l@slovenian=\language77
    \l@spanish=\language78
    \l@swedish=\language79
    \l@thai=\language80
    \l@turkish=\language81
    \l@turkmen=\language82
    \l@ukrainian=\language83
    \l@uppersorbian=\language84
    \l@welsh=\language85
    )

    ! Package babel Error: Unknown option `armenian'. Either you misspelled it
    (babel)                or the language definition file armenian.ldf was not fou
    nd.

    See the babel package documentation for explanation.
    Type  H <return>  for immediate help.
     ...                                              

    l.533   \ExecuteOptions{\bbl@opt@main}

会话信息:

R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363), RStudio 1.2.5019

Locale:
  LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
  LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
  LC_TIME=English_United Kingdom.1252    

Package version:
  base64enc_0.1.3 digest_0.6.23   evaluate_0.14   glue_1.3.1      graphics_3.6.1  grDevices_3.6.1 highr_0.8      
  htmltools_0.4.0 jsonlite_1.6    knitr_1.26      magrittr_1.5    markdown_1.1    methods_3.6.1   mime_0.7       
  Rcpp_1.0.3      rlang_0.4.2     rmarkdown_1.18  stats_3.6.1     stringi_1.4.3   stringr_1.4.0   tinytex_0.17   
  tools_3.6.1     utils_3.6.1     xfun_0.11       yaml_2.2.0     

Pandoc version: 2.7.2

0 个答案:

没有答案