【问题标题】:Bookdown: Exporting to a word document (Error in files2[[format]] : attempt to select less than one element in get1index)Bookdown:导出到 word 文档(files2[[format]] 中的错误:尝试在 get1index 中选择少于一个元素)
【发布时间】:2019-05-09 13:59:06
【问题描述】:

我正在使用 bookdown 包和 memoir latex 类写我的论文。当我导出为 pdf 或 html 时,一切工作都相对正常,但我无法将论文导出到 word 文档......

我收到以下神秘错误:

Error in files2[[format]] : 
  attempt to select less than one element in get1index

但很难提供一个可重复的示例,因为我正在使用我凌乱的论文存储库。

但这是我的 _output.yml 文件的(一部分):

bookdown::pdf_book:
  includes:
    in_header: latex/preamble.tex # defines style and latex options
    before_body: latex/before_body.tex # defines cover page
  latex_engine: xelatex # lualatex or xelatex
  citation_package: none # needs to be "none" in order to use the csl file
  keep_tex: true # keeps the .tex file
  dev: "cairo_pdf"
  toc: false # deactivates default table of contents
  highlight: pygments # code highlighting
  pandoc_args: [ "--csl", "./csl/apa6.csl" ] # specifies the csl file to be used

bookdown::word_document2:
  pandoc_args: [
    "--csl", "./csl/apa6.csl",
    "--bibliography", "./bib/packages.bib",
    "--bibliography", "./bib/thesis.bib",
    #"--reference-doc", "./assets/2018-05-17-aim1-draft.docx",
    "--filter", "pandoc-citeproc"
    #"--filter", "./assets/fix-apa-ampersands.py"
  ]

有什么想法吗?

【问题讨论】:

    标签: r r-markdown bookdown


    【解决方案1】:

    这是 bookdown 包的一个错误,该包在 Github 上 I just fixed。请尝试那里的开发版本:

    remotes::install_github('rstudio/bookdown')
    

    【讨论】:

    • 感谢您的及时答复!它现在可以工作了,但是(仅供参考)我在使用 bookdown::preview_chapter() 函数时遇到了同样的错误......
    • 完全相同的错误(即Error in files2[[format]])?我想不出为什么会发生这种情况的原因。您是否重新启动了 R 会话?
    • 你说得对,重启会话后就可以正常使用了,谢谢!
    猜你喜欢
    • 2023-04-04
    • 2020-06-19
    • 1970-01-01
    • 1970-01-01
    • 2015-07-13
    • 2018-03-23
    • 2016-06-10
    • 2016-01-24
    • 2020-07-28
    相关资源
    最近更新 更多