Search code examples
rr-markdownchinese-localebookdown

how to use zhmakeindex instead of makeindex in bookdown


in https://github.com/rstudio/bookdown. I find that in ./inst/example, makeindex is much usefull for my book. I want to add Chinese index in my book, but makeindex cannot work as expected for Chinese index.

I can compile index use zhmakeindex instead of makeindex without change the tex file, like the example in https://github.com/leo-liu/zhmakeindex.

as http://www.ituring.com.cn/article/207412 told.

bash xelatex -interaction=batchmode zhmakeindex.tex bibtex zhmakeindex zhmakeindex zhmakeindex xelatex -interaction=batchmode zhmakeindex.tex xelatex -interaction=batchmode zhmakeindex.tex

How can I use zhmakeindex instead of makeindex in bookdown? I cannot find where to write makeindex or zhmakeindex command. Thank you.


Solution

  • With the current development version of the tinytex package, you can set the global option tinytex.makeindex in your .Rprofile or an R code chunk in your book:

    devtools::install_github('yihui/tinytex')
    options(tinytex.makeindex= 'zhmakeindex')
    

    Further command-line options can be passed via the global option tinytex.makeindex.args, e.g.,

    options(tinytex.makeindex.args = c('-z', 'pinyin'))