Bookdown: Exporting to a word document (Error in files2[[format]] : attempt to select less than one element in get1index)

让人想犯罪 __ 提交于 2020-01-24 16:58:05

问题


I am writing my thesis using the bookdown package and the memoir latex class. Everything works relatively fine when I am exporting to pdf or to html but I am unable to export the thesis to a word document...

I get the following mysterious error:

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

It is difficult to provide a reproducible example though, as I am working from my messy dissertation repository.

But here is (a part of) my _output.yml file:

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"
  ]

Any idea ?


回答1:


This is a bug of the bookdown package, which I just fixed on Github. Please try the development version there:

remotes::install_github('rstudio/bookdown')


来源:https://stackoverflow.com/questions/56061122/bookdown-exporting-to-a-word-document-error-in-files2format-attempt-to-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!