yihui 确实很诡异。为了简化问题,我把 tinytex、TinyTeX、CTeX 都卸载了,然后仅重装 CTeX,没装 TinyTeX,仍然没解决。不管是在 bookdown 里,还是用别的编辑器例如 TeXStudio,都不能往 \bibliography{book} 里添加扩展名 .bib。只要一添加,系统就说找不到 book.bib.bib。不知道是谁给多添加了个 .bib。我记得几个月前是没有这个问题的。

我看到也有别人(路人甲路人乙)遇到了这个问题,看原因也没看出个所以然来,不过解决办法倒都是“去掉扩展名 '.bib'”。另外,有几处(示例1示例2)都强调在声明 \bibliography 时不要加扩展名。

应该是 BibTeX 的问题。我的 BibTeX, Version 0.99d (MiKTeX 2.9.6500),是在 MiKTeX 的包管理器里最新安装的最新版。

补充:更为奇怪的是,RStudio - New Files - Rmarkdown - From Template,选个 rticle 模板,里面的 yaml 都是带 .bib 扩展名的,编译出来的 pdf 参考文献却是正常的。所以我彻底糊涂了。

    Cloud2016 1. 这个问题有点复杂,不是三两分钟能搞定的事,我得再花点时间。关键是 texmf-var/fonts/conf/texlive-fontconfig.conf 里面的路径不对。

    1. 除非你安装了 LaTeX 包 latexmk 以及 Perl,否则 tinytex::latexmk() 应该会按你说的顺序执行。

    dapengde 是不是我仍然没说清楚……首先,不能加 .bib 扩展名是 MiKTeX 中的 bibtex 造成的坑(如果你说你的参考文献库是 foo,那么它就会去找 foo.bib;如果你说是 foo.bib,那么它就会……去找 foo.bib.bib;总之它是坚持一定要在你给的文件名后面再多加一个 .bib;蠢成这样,就问你想不想杀了它……可能也是聪明反被聪明误),这个坑本不应该存在;其次,因为这个坑已经存在多年(仅存在于 MiKTeX 中;因为 CTeX 本质是 MiKTeX 加一些杂七杂八的套件,所以 CTeX 也继承了这个坑),我在 tinytex R 包中已经把它填了;关键问题是有且仅有 tinytex R 包的 latexmk() 函数默默填了这个坑。只要你用 MiKTeX 或者 CTeX,就只能依赖 tinytex 去编译带参考文献的文档。如果是 R Markdown 文档,那么所有你需要做的就是安装那个 feature/tinytex 分支(这个分支会合并到下一个 rmarkdown 版本中)。TinyTeX 本质是 TeX Live,这个坑不存在,你装不装它,都不影响参考文献的编译。当然我是推荐你装它,因为它是跨平台的,省得一天到晚操心在不同系统下到底加不加 .bib 扩展名。

    你引的示例1说的并不是说 \bibliography{} 中不能加 .bib 扩展名,而是运行 bibtex 命令行时可以不加 .aux 扩展名。 这是由于 bibtex foobibtex foo.aux 通常是等价的。

    我刚更新了一下 tinytex R 包,如果检测到参考文献编不出来,就会自动打印出详细的错误信息。你可以再试试:

    devtools::install_github(
      c("yihui/tinytex", "rstudio/rmarkdown@feature/tinytex")
    )

    看到底具体的错误信息是什么。

      Cloud2016 字体问题我搞明白了,卸载再重装 xetex 包应该就好了:

      library(tinytex)
      tlmgr_remove('xetex'); tlmgr_install('xetex')

      如果要改变安装路径,最好是一开始就直接把路径传给 install_tinytex() 函数:

      tinytex::install_tinytex(dir = "D:\\TinyTeX")

      当然,既然你已经装好了,就没必要再重新折腾一遍了,按我前面说的重装 xetex 包就够了。

      另外,sourcesanspro 等包的正确使用姿势貌似应该是 \usepackage{} 而不是 \setmainfont{},如:

      \usepackage[default]{sourcesanspro}

      或者相应的 R Markdown:

      output:
        pdf_document:
          latex_engine: xelatex
          extra_dependencies:
            sourcesanspro: default

      还有,编译 .tex 文件的时候用具体的 tinytex::xelatex() 函数就可以了,不必打冗长的 latexmk(...)

        Cloud2016 太好了,这下只剩下唯一一个疑案了,就是 @dapengde 在 CTeX 下为啥编不出参考文献来。实在不行我就只能用最后一招了,远程桌面现场侦查……

          yihui 发现一个很奇怪的现象:

          我在 Rmd 源文档中写下如下代码块

          '鸢尾花数据的散点图'

          Knitr + XeLaTeX 编译后出来的效果却是
          cjkengspace
          '和 之间冒出来多余的空格,不知道怎么处理?

            Cloud2016 这是 ctex 包(注意我说的是包,不是 CTeX 套装)的默认行为:英文和中文字符之间默认加空格。显然在代码块中不能自动加空格,但 ctex 没有这么智能。我应该曾经找到过解决办法,但年代太久远,我也不知道放哪儿了。你终于踩到了一个我觉得还有点挑战性的坑,哈哈。

              yihui 这几天在折腾自己学校的硕士学位论文模板,又发现个问题 <https://github.com/yihui/bookdown-chinese/issues/9>,后来模板走 ctexart类 和 rticles::ctex 路线,绕开了,我发现这个问题同样影响 bookdownplus 但是@dapengde 很聪明地将标题和作者都转为英文,而其他部分是中文,这样警告就没有了,我测试的模板是article_zh

                Cloud2016 那个 #9 问题可以忽略之,只是一个无碍的警告信息,可能是 RStudio 在 Windows 下的某个缺陷。

                  上周出差了,没来得及最终安装一下,今天安装出问题了,fedora27 的结果如下:

                  tinytex::install_tinytex()
                  
                  #### 省略下载信息,省得看着太累,报错为:
                  
                  2017-12-17 17:42:15 (563 KB/s) - 已保存 “install-tl-unx.tar.gz” [4031343/4031343])
                  
                  Automated TeX Live installation using profile: ../texlive.profile
                  Loading http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb
                  ../install-tl-20171216/install-tl: checksum error when downloading /tmp/MX4YXw8BH2/RAXktNrP2d from http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb: digest disagree
                  rm: 无法删除'install-tl.log': No such file or directory
                  sh: 第 25 行:cd: bin/*: No such file or directory
                  sh:行26: ./tlmgr: No such file or directory
                  mv: 无法获取'texlive/*' 的文件状态(stat): No such file or directory
                  install-unx.sh:行24: /home/lovebluesky/.TinyTeX/bin/*/tlmgr: No such file or directory
                  install-unx.sh:行31: /home/lovebluesky/.TinyTeX/bin/*/tlmgr: No such file or directory
                  Warning message:
                  In tinytex::install_tinytex() :
                    TinyTeX was not successfully installed or configured.

                    yihui 在CentOS7 下测试TinyTeX的报告:
                    1. 使用默认方式安装 R

                    yum install epel-release
                    yum install -y R

                    这种方式顺带安装了不少 tex包,

                     texinfo               x86_64 5.1-4.el7                           base    961 k
                     texinfo-tex           x86_64 5.1-4.el7                           base    146 k
                     texlive-ae            noarch 2:svn15878.1.4-38.el7               base     95 k
                     texlive-algorithms    noarch 2:svn15878.0.1-38.el7               base     21 k
                     texlive-amscls        noarch 2:svn29207.0-38.el7                 base     53 k
                     texlive-amsfonts      noarch 2:svn29208.3.04-38.el7              base    3.6 M
                     texlive-amsmath       noarch 2:svn29327.2.14-38.el7              base     49 k
                     texlive-anysize       noarch 2:svn15878.0-38.el7                 base     18 k
                     texlive-attachfile    noarch 2:svn21866.v1.5b-38.el7             base     21 k
                     texlive-avantgar      noarch 2:svn28614.0-38.el7                 base    291 k
                     texlive-babel         noarch 2:svn24756.3.8m-38.el7              base    129 k
                     texlive-babelbib      noarch 2:svn25245.1.31-38.el7              base     49 k
                     texlive-base          noarch 2:2012-38.20130427_r30134.el7       base    325 k
                     texlive-beamer        noarch 2:svn29349.3.26-38.el7              base    242 k
                     texlive-bera          noarch 2:svn20031.0-38.el7                 base    347 k
                     texlive-beton         noarch 2:svn15878.0-38.el7                 base     18 k
                     texlive-bibtex        noarch 2:svn26689.0.99d-38.el7             base     33 k
                     texlive-bibtex-bin    x86_64 2:svn26509.0-38.20130427_r30134.el7 base     65 k
                     texlive-bookman       noarch 2:svn28614.0-38.el7                 base    332 k
                     texlive-booktabs      noarch 2:svn15878.1.61803-38.el7           base     19 k
                     texlive-breakurl      noarch 2:svn15878.1.30-38.el7              base     20 k
                     texlive-caption       noarch 2:svn29026.3.3__2013_02_03_-38.el7  base     51 k
                     texlive-carlisle      noarch 2:svn18258.0-38.el7                 base     29 k
                     texlive-charter       noarch 2:svn15878.0-38.el7                 base    201 k
                     texlive-chngcntr      noarch 2:svn17157.1.0a-38.el7              base     19 k
                     texlive-cite          noarch 2:svn19955.5.3-38.el7               base     42 k
                     texlive-cm            noarch 2:svn29581.0-38.el7                 base    291 k
                     texlive-cm-super      noarch 2:svn15878.0-38.el7                 base     62 M
                     texlive-cmap          noarch 2:svn26568.0-38.el7                 base     23 k
                     texlive-cmextra       noarch 2:svn14075.0-38.el7                 base     31 k
                     texlive-collection-basic
                                           noarch 2:svn26314.0-38.20130427_r30134.el7 base     16 k
                     texlive-collection-documentation-base
                                           noarch 2:svn17091.0-38.20130427_r30134.el7 base     16 k
                     texlive-collection-fontsrecommended
                                           noarch 2:svn28082.0-38.20130427_r30134.el7 base     16 k
                     texlive-collection-latex
                                           noarch 2:svn25030.0-38.20130427_r30134.el7 base     16 k
                     texlive-collection-latexrecommended
                                           noarch 2:svn25795.0-38.20130427_r30134.el7 base     17 k
                     texlive-colortbl      noarch 2:svn25394.v1.0a-38.el7             base     20 k
                     texlive-courier       noarch 2:svn28614.0-38.el7                 base    542 k
                     texlive-crop          noarch 2:svn15878.1.5-38.el7               base     22 k
                     texlive-csquotes      noarch 2:svn24393.5.1d-38.el7              base     36 k
                     texlive-ctable        noarch 2:svn26694.1.23-38.el7              base     20 k
                     texlive-currfile      noarch 2:svn29012.0.7b-38.el7              base     21 k
                     texlive-dvipdfm       noarch 2:svn26689.0.13.2d-38.el7           base     23 k
                     texlive-dvipdfm-bin   noarch 2:svn13663.0-38.20130427_r30134.el7 base     18 k
                     texlive-dvipdfmx      noarch 2:svn26765.0-38.el7                 base     53 k
                     texlive-dvipdfmx-bin  x86_64 2:svn26509.0-38.20130427_r30134.el7 base    278 k
                     texlive-dvipdfmx-def  noarch 2:svn15878.0-38.el7                 base     19 k
                     texlive-dvips         noarch 2:svn29585.0-38.el7                 base    217 k
                     texlive-dvips-bin     x86_64 2:svn26509.0-38.20130427_r30134.el7 base    129 k
                     texlive-ec            noarch 2:svn25033.1.0-38.el7               base    467 k
                     texlive-enctex        noarch 2:svn28602.0-38.el7                 base     47 k
                     texlive-enumitem      noarch 2:svn24146.3.5.2-38.el7             base     29 k
                     texlive-epsf          noarch 2:svn21461.2.7.4-38.el7             base     25 k
                     texlive-eso-pic       noarch 2:svn21515.2.0c-38.el7              base     21 k
                     texlive-etex          noarch 2:svn22198.2.1-38.el7               base     32 k
                     texlive-etex-pkg      noarch 2:svn15878.2.0-38.el7               base     22 k
                     texlive-etoolbox      noarch 2:svn20922.2.1-38.el7               base     25 k
                     texlive-euler         noarch 2:svn17261.2.5-38.el7               base     20 k
                     texlive-euro          noarch 2:svn22191.1.1-38.el7               base     19 k
                     texlive-eurosym       noarch 2:svn17265.1.4_subrfix-38.el7       base    158 k
                     texlive-extsizes      noarch 2:svn17263.1.4a-38.el7              base     30 k
                     texlive-fancybox      noarch 2:svn18304.1.4-38.el7               base     25 k
                     texlive-fancyhdr      noarch 2:svn15878.3.1-38.el7               base     26 k
                     texlive-fancyref      noarch 2:svn15878.0.9c-38.el7              base     20 k
                     texlive-fancyvrb      noarch 2:svn18492.2.8-38.el7               base     30 k
                     texlive-filecontents  noarch 2:svn24250.1.3-38.el7               base     19 k
                     texlive-filehook      noarch 2:svn24280.0.5d-38.el7              base     22 k
                     texlive-fix2col       noarch 2:svn17133.0-38.el7                 base     19 k
                     texlive-float         noarch 2:svn15878.1.3d-38.el7              base     20 k
                     texlive-fontspec      noarch 2:svn29412.v2.3a-38.el7             base     38 k
                     texlive-footmisc      noarch 2:svn23330.5.5b-38.el7              base     23 k
                     texlive-fp            noarch 2:svn15878.0-38.el7                 base     39 k
                     texlive-fpl           noarch 2:svn15878.1.002-38.el7             base    376 k
                     texlive-geometry      noarch 2:svn19716.5.6-38.el7               base     26 k
                     texlive-glyphlist     noarch 2:svn28576.0-38.el7                 base     43 k
                     texlive-graphics      noarch 2:svn25405.1.0o-38.el7              base     33 k
                     texlive-gsftopk       noarch 2:svn26689.1.19.2-38.el7            base     24 k
                     texlive-gsftopk-bin   x86_64 2:svn26509.0-38.20130427_r30134.el7 base     30 k
                     texlive-helvetic      noarch 2:svn28614.0-38.el7                 base    614 k
                     texlive-hyperref      noarch 2:svn28213.6.83m-38.el7             base    139 k
                     texlive-hyph-utf8     noarch 2:svn29641.0-38.el7                 base    2.2 M
                     texlive-hyphen-base   noarch 2:svn29197.0-38.el7                 base     39 k
                     texlive-ifetex        noarch 2:svn24853.1.2-38.el7               base     18 k
                     texlive-ifluatex      noarch 2:svn26725.1.3-38.el7               base     19 k
                     texlive-ifxetex       noarch 2:svn19685.0.5-38.el7               base     18 k
                     texlive-index         noarch 2:svn24099.4.1beta-38.el7           base     29 k
                     texlive-jknapltx      noarch 2:svn19440.0-38.el7                 base     28 k
                     texlive-kastrup       noarch 2:svn15878.0-38.el7                 base     18 k
                     texlive-koma-script   noarch 2:svn27255.3.11b-38.el7             base    5.1 M
                     texlive-kpathsea      noarch 2:svn28792.0-38.el7                 base    140 k
                     texlive-kpathsea-bin  x86_64 2:svn27347.0-38.20130427_r30134.el7 base     40 k
                     texlive-kpathsea-lib  x86_64 2:2012-38.20130427_r30134.el7       base     78 k
                     texlive-l3experimental
                                           noarch 2:svn29361.SVN_4467-38.el7          base     56 k
                     texlive-l3kernel      noarch 2:svn29409.SVN_4469-38.el7          base    107 k
                     texlive-l3packages    noarch 2:svn29361.SVN_4467-38.el7          base     36 k
                     texlive-latex         noarch 2:svn27907.0-38.el7                 base    197 k
                     texlive-latex-bin     noarch 2:svn26689.0-38.el7                 base     20 k
                     texlive-latex-bin-bin noarch 2:svn14050.0-38.20130427_r30134.el7 base     17 k
                     texlive-latex-fonts   noarch 2:svn28888.0-38.el7                 base     42 k
                     texlive-latexconfig   noarch 2:svn28991.0-38.el7                 base     26 k
                     texlive-listings      noarch 2:svn15878.1.4-38.el7               base    138 k
                     texlive-lm            noarch 2:svn28119.2.004-38.el7             base     13 M
                     texlive-lm-math       noarch 2:svn29044.1.958-38.el7             base    426 k
                     texlive-ltxmisc       noarch 2:svn21927.0-38.el7                 base     34 k
                     texlive-lua-alt-getopt
                                           noarch 2:svn29349.0.7.0-38.el7             base     19 k
                     texlive-lualatex-math noarch 2:svn29346.1.2-38.el7               base     21 k
                     texlive-luaotfload    noarch 2:svn26718.1.26-38.el7              base    101 k
                     texlive-luaotfload-bin
                                           noarch 2:svn18579.0-38.20130427_r30134.el7 base     17 k
                     texlive-luatex        noarch 2:svn26689.0.70.1-38.el7            base     37 k
                     texlive-luatex-bin    x86_64 2:svn26912.0-38.20130427_r30134.el7 base    1.7 M
                     texlive-luatexbase    noarch 2:svn22560.0.31-38.el7              base     27 k
                     texlive-makeindex     noarch 2:svn26689.2.12-38.el7              base     30 k
                     texlive-makeindex-bin x86_64 2:svn26509.0-38.20130427_r30134.el7 base     38 k
                     texlive-marginnote    noarch 2:svn25880.v1.1i-38.el7             base     20 k
                     texlive-marvosym      noarch 2:svn29349.2.2a-38.el7              base    151 k
                     texlive-mathpazo      noarch 2:svn15878.1.003-38.el7             base     84 k
                     texlive-mdwtools      noarch 2:svn15878.1.05.4-38.el7            base     38 k
                     texlive-memoir        noarch 2:svn21638.3.6j_patch_6.0g-38.el7   base     97 k
                     texlive-metafont      noarch 2:svn26689.2.718281-38.el7          base     63 k
                     texlive-metafont-bin  x86_64 2:svn26912.0-38.20130427_r30134.el7 base    185 k
                     texlive-metalogo      noarch 2:svn18611.0.12-38.el7              base     19 k
                     texlive-mflogo        noarch 2:svn17487.0-38.el7                 base     43 k
                     texlive-mfnfss        noarch 2:svn19410.0-38.el7                 base     20 k
                     texlive-mfware        noarch 2:svn26689.0-38.el7                 base     31 k
                     texlive-mfware-bin    x86_64 2:svn26509.0-38.20130427_r30134.el7 base     89 k
                     texlive-mh            noarch 2:svn29420.0-38.el7                 base     61 k
                     texlive-microtype     noarch 2:svn29392.2.5-38.el7               base     67 k
                     texlive-misc          noarch 2:svn24955.0-38.el7                 base     67 k
                     texlive-mparhack      noarch 2:svn15878.1.4-38.el7               base     20 k
                     texlive-mptopdf       noarch 2:svn26689.0-38.el7                 base     58 k
                     texlive-mptopdf-bin   noarch 2:svn18674.0-38.20130427_r30134.el7 base     17 k
                     texlive-ms            noarch 2:svn24467.0-38.el7                 base     24 k
                     texlive-multido       noarch 2:svn18302.1.42-38.el7              base     21 k
                     texlive-natbib        noarch 2:svn20668.8.31b-38.el7             base     35 k
                     texlive-ncntrsbk      noarch 2:svn28614.0-38.el7                 base    338 k
                     texlive-ntgclass      noarch 2:svn15878.0-38.el7                 base     35 k
                     texlive-oberdiek      noarch 2:svn26725.0-38.el7                 base    307 k
                     texlive-palatino      noarch 2:svn28614.0-38.el7                 base    384 k
                     texlive-paralist      noarch 2:svn15878.2.3b-38.el7              base     21 k
                     texlive-parallel      noarch 2:svn15878.0-38.el7                 base     21 k
                     texlive-parskip       noarch 2:svn19963.2.0-38.el7               base     19 k
                     texlive-pdfpages      noarch 2:svn27574.0.4t-38.el7              base     31 k
                     texlive-pdftex        noarch 2:svn29585.1.40.11-38.el7           base    140 k
                     texlive-pdftex-bin    x86_64 2:svn27321.0-38.20130427_r30134.el7 base    360 k
                     texlive-pdftex-def    noarch 2:svn22653.0.06d-38.el7             base     31 k
                     texlive-pgf           noarch 2:svn22614.2.10-38.el7              base    468 k
                     texlive-plain         noarch 2:svn26647.0-38.el7                 base     63 k
                     texlive-powerdot      noarch 2:svn25656.1.4i-38.el7              base     48 k
                     texlive-psfrag        noarch 2:svn15878.3.04-38.el7              base     21 k
                     texlive-pslatex       noarch 2:svn16416.0-38.el7                 base     24 k
                     texlive-psnfss        noarch 2:svn23394.9.2a-38.el7              base     45 k
                     texlive-pspicture     noarch 2:svn15878.0-38.el7                 base     19 k
                     texlive-pst-3d        noarch 2:svn17257.1.10-38.el7              base     21 k
                     texlive-pst-blur      noarch 2:svn15878.2.0-38.el7               base     19 k
                     texlive-pst-coil      noarch 2:svn24020.1.06-38.el7              base     21 k
                     texlive-pst-eps       noarch 2:svn15878.1.0-38.el7               base     20 k
                     texlive-pst-fill      noarch 2:svn15878.1.01-38.el7              base     21 k
                     texlive-pst-grad      noarch 2:svn15878.1.06-38.el7              base     21 k
                     texlive-pst-math      noarch 2:svn20176.0.61-38.el7              base     22 k
                     texlive-pst-node      noarch 2:svn27799.1.25-38.el7              base     40 k
                     texlive-pst-plot      noarch 2:svn28729.1.44-38.el7              base     36 k
                     texlive-pst-slpe      noarch 2:svn24391.1.31-38.el7              base     21 k
                     texlive-pst-text      noarch 2:svn15878.1.00-38.el7              base     21 k
                     texlive-pst-tree      noarch 2:svn24142.1.12-38.el7              base     24 k
                     texlive-pstricks      noarch 2:svn29678.2.39-38.el7              base     97 k
                     texlive-pstricks-add  noarch 2:svn28750.3.59-38.el7              base     41 k
                     texlive-pxfonts       noarch 2:svn15878.0-38.el7                 base    497 k
                     texlive-qstest        noarch 2:svn15878.0-38.el7                 base     22 k
                     texlive-rcs           noarch 2:svn15878.0-38.el7                 base     30 k
                     texlive-rotating      noarch 2:svn16832.2.16b-38.el7             base     20 k
                     texlive-rsfs          noarch 2:svn15878.0-38.el7                 base     75 k
                     texlive-sansmath      noarch 2:svn17997.1.1-38.el7               base     20 k
                     texlive-sauerj        noarch 2:svn15878.0-38.el7                 base     23 k
                     texlive-section       noarch 2:svn20180.0-38.el7                 base     27 k
                     texlive-seminar       noarch 2:svn18322.1.5-38.el7               base     43 k
                     texlive-sepnum        noarch 2:svn20186.2.0-38.el7               base     20 k
                     texlive-setspace      noarch 2:svn24881.6.7a-38.el7              base     24 k
                     texlive-showexpl      noarch 2:svn27790.v0.3j-38.el7             base     21 k
                     texlive-soul          noarch 2:svn15878.2.4-38.el7               base     23 k
                     texlive-subfig        noarch 2:svn15878.1.3-38.el7               base     24 k
                     texlive-symbol        noarch 2:svn28614.0-38.el7                 base     55 k
                     texlive-tetex         noarch 2:svn29585.3.0-38.el7               base     88 k
                     texlive-tetex-bin     noarch 2:svn27344.0-38.20130427_r30134.el7 base     18 k
                     texlive-tex           noarch 2:svn26689.3.1415926-38.el7         base     23 k
                     texlive-tex-bin       x86_64 2:svn26912.0-38.20130427_r30134.el7 base    171 k
                     texlive-tex-gyre      noarch 2:svn18651.2.004-38.el7             base    7.0 M
                     texlive-tex-gyre-math noarch 2:svn29045.0-38.el7                 base    582 k
                     texlive-texconfig     noarch 2:svn29349.0-38.el7                 base     32 k
                     texlive-texconfig-bin noarch 2:svn27344.0-38.20130427_r30134.el7 base     17 k
                     texlive-texlive.infra noarch 2:svn28217.0-38.el7                 base    137 k
                     texlive-texlive.infra-bin
                                           x86_64 2:svn22566.0-38.20130427_r30134.el7 base     16 k
                     texlive-textcase      noarch 2:svn15878.0-38.el7                 base     18 k
                     texlive-thumbpdf      noarch 2:svn26689.3.15-38.el7              base     38 k
                     texlive-thumbpdf-bin  noarch 2:svn6898.0-38.20130427_r30134.el7  base     17 k
                     texlive-times         noarch 2:svn28614.0-38.el7                 base    388 k
                     texlive-tipa          noarch 2:svn29349.1.3-38.el7               base    2.8 M
                     texlive-tools         noarch 2:svn26263.0-38.el7                 base     62 k
                     texlive-txfonts       noarch 2:svn15878.0-38.el7                 base    768 k
                     texlive-type1cm       noarch 2:svn21820.0-38.el7                 base     19 k
                     texlive-typehtml      noarch 2:svn17134.0-38.el7                 base     24 k
                     texlive-ucs           noarch 2:svn27549.2.1-38.el7               base    360 k
                     texlive-underscore    noarch 2:svn18261.0-38.el7                 base     22 k
                     texlive-unicode-math  noarch 2:svn29413.0.7d-38.el7              base     61 k
                     texlive-url           noarch 2:svn16864.3.2-38.el7               base     26 k
                     texlive-utopia        noarch 2:svn15878.0-38.el7                 base    233 k
                     texlive-varwidth      noarch 2:svn24104.0.92-38.el7              base     21 k
                     texlive-wasy          noarch 2:svn15878.0-38.el7                 base    256 k
                     texlive-wasysym       noarch 2:svn15878.2.0-38.el7               base     21 k
                     texlive-xcolor        noarch 2:svn15878.2.11-38.el7              base     35 k
                     texlive-xdvi          noarch 2:svn26689.22.85-38.el7             base     60 k
                     texlive-xdvi-bin      x86_64 2:svn26509.0-38.20130427_r30134.el7 base    278 k
                     texlive-xkeyval       noarch 2:svn27995.2.6a-38.el7              base     27 k
                     texlive-xunicode      noarch 2:svn23897.0.981-38.el7             base     44 k
                     texlive-zapfchan      noarch 2:svn28614.0-38.el7                 base    102 k
                     texlive-zapfding      noarch 2:svn28614.0-38.el7                 base     65 k

                    tex 安装的位置和版本如下

                    > which tex
                    /usr/bin/tex
                    > tex -v
                    TeX 3.1415926 (TeX Live 2013)
                    kpathsea version 6.1.1
                    Copyright 2013 D.E. Knuth.
                    There is NO warranty.  Redistribution of this software is
                    covered by the terms of both the TeX copyright and
                    the Lesser GNU General Public License.
                    For more information about these matters, see the file
                    named COPYING and the TeX source.
                    Primary author of TeX: D.E. Knuth.
                    1. 安装 tinytex
                    install.packages("tinytex")
                    Installing package into ‘/home/rstudio/R/x86_64-redhat-linux-gnu-library/3.4’
                    (as ‘lib’ is unspecified)
                    试开URL’https://cran.rstudio.com/src/contrib/tinytex_0.1.tar.gz'
                    Content type 'application/x-gzip' length 12812 bytes (12 KB)
                    ==================================================
                    downloaded 12 KB
                    
                    * installing *source* package ‘tinytex’ ...
                    ** 成功将‘tinytex’程序包解包并MD5和检查
                    ** R
                    ** preparing package for lazy loading
                    ** help
                    *** installing help indices
                      converting help for package ‘tinytex’
                        finding HTML links ...    install_tinytex                         html   好了
                    
                        latexmk                                 html  
                        parse_packages                          html  
                        r_texmf                                 html  
                        tlmgr                                   html  
                    ** building package indices
                    ** testing if installed package can be loaded
                    * DONE (tinytex)
                    
                    The downloaded source packages are in
                    	‘/tmp/Rtmpit3F1C/downloaded_packages’

                    TinyTeX 安装记录

                    > tinytex::install_tinytex()
                    试开URL’https://github.com/yihui/tinytex/raw/master/tools/install-unx.sh'
                    Content type 'text/plain; charset=utf-8' length 758 bytes
                    ==================================================
                    downloaded 758 bytes
                    
                    Downloading install-tl-unx.tar.gz to /tmp ...
                    --2017-12-18 11:10:36--  http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
                    正在解析主机 mirror.ctan.org (mirror.ctan.org)... 176.28.54.184, 2a01:488:67:1000:b01c:36b8:0:1
                    正在连接 mirror.ctan.org (mirror.ctan.org)|176.28.54.184|:80... 已连接。
                    已发出 HTTP 请求,正在等待回应... 302 Found
                    位置:http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz [跟随至新的 URL]
                    --2017-12-18 11:10:36--  http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz
                    正在解析主机 mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)... 202.38.95.110, 2001:da8:d800:95::110
                    正在连接 mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.38.95.110|:80... 已连接。
                    已发出 HTTP 请求,正在等待回应... 200 OK
                    长度:4031401 (3.8M) [application/gzip]
                    正在保存至: “install-tl-unx.tar.gz”
                    
                         0K .......... .......... .......... .......... ..........  1%  158K 25s
                        50K .......... .......... .......... .......... ..........  2% 1.84M 13s
                       100K .......... .......... .......... .......... ..........  3% 1.67M 9s
                       150K .......... .......... .......... .......... ..........  5% 5.54M 7s
                       200K .......... .......... .......... .......... ..........  6% 5.45M 6s
                       250K .......... .......... .......... .......... ..........  7% 4.58M 5s
                       300K .......... .......... .......... .......... ..........  8% 6.19M 4s
                       350K .......... .......... .......... .......... .......... 10% 8.26M 4s
                       400K .......... .......... .......... .......... .......... 11% 9.19M 3s
                       450K .......... .......... .......... .......... .......... 12% 1.09M 3s
                       500K .......... .......... .......... .......... .......... 13% 16.1M 3s
                       550K .......... .......... .......... .......... .......... 15% 9.69M 3s
                       600K .......... .......... .......... .......... .......... 16% 11.1M 2s
                       650K .......... .......... .......... .......... .......... 17% 10.2M 2s
                       700K .......... .......... .......... .......... .......... 19% 22.4M 2s
                       750K .......... .......... .......... .......... .......... 20% 11.7M 2s
                       800K .......... .......... .......... .......... .......... 21% 21.3M 2s
                       850K .......... .......... .......... .......... .......... 22% 7.88M 2s
                       900K .......... .......... .......... .......... .......... 24% 10.4M 2s
                       950K .......... .......... .......... .......... .......... 25% 26.2M 1s
                      1000K .......... .......... .......... .......... .......... 26% 6.99M 1s
                      1050K .......... .......... .......... .......... .......... 27% 5.19M 1s
                      1100K .......... .......... .......... .......... .......... 29% 2.21M 1s
                      1150K .......... .......... .......... .......... .......... 30% 2.48M 1s
                      1200K .......... .......... .......... .......... .......... 31%  445K 1s
                      1250K .......... .......... .......... .......... .......... 33% 40.7M 1s
                      1300K .......... .......... .......... .......... .......... 34%  358M 1s
                      1350K .......... .......... .......... .......... .......... 35% 23.5M 1s
                      1400K .......... .......... .......... .......... .......... 36% 4.18M 1s
                      1450K .......... .......... .......... .......... .......... 38% 3.68M 1s
                      1500K .......... .......... .......... .......... .......... 39% 4.41M 1s
                      1550K .......... .......... .......... .......... .......... 40% 2.44M 1s
                      1600K .......... .......... .......... .......... .......... 41% 2.22M 1s
                      1650K .......... .......... .......... .......... .......... 43% 2.45M 1s
                      1700K .......... .......... .......... .......... .......... 44% 2.25M 1s
                      1750K .......... .......... .......... .......... .......... 45% 2.28M 1s
                      1800K .......... .......... .......... .......... .......... 46%  663K 1s
                      1850K .......... .......... .......... .......... .......... 48%  491M 1s
                      1900K .......... .......... .......... .......... .......... 49%  532M 1s
                      1950K .......... .......... .......... .......... .......... 50% 1.72M 1s
                      2000K .......... .......... .......... .......... .......... 52% 11.1M 1s
                      2050K .......... .......... .......... .......... .......... 53% 2.44M 1s
                      2100K .......... .......... .......... .......... .......... 54% 2.19M 1s
                      2150K .......... .......... .......... .......... .......... 55% 2.30M 1s
                      2200K .......... .......... .......... .......... .......... 57% 2.24M 1s
                      2250K .......... .......... .......... .......... .......... 58% 2.44M 1s
                      2300K .......... .......... .......... .......... .......... 59%  622K 1s
                      2350K .......... .......... .......... .......... .......... 60%  673M 1s
                      2400K .......... .......... .......... .......... .......... 62% 7.69M 1s
                      2450K .......... .......... .......... .......... .......... 63% 2.39M 1s
                      2500K .......... .......... .......... .......... .......... 64% 9.60M 1s
                      2550K .......... .......... .......... .......... .......... 66% 3.15M 1s
                      2600K .......... .......... .......... .......... .......... 67% 2.34M 1s
                      2650K .......... .......... .......... .......... .......... 68% 2.21M 1s
                      2700K .......... .......... .......... .......... .......... 69% 2.18M 1s
                      2750K .......... .......... .......... .......... .......... 71% 2.45M 1s
                      2800K .......... .......... .......... .......... .......... 72%  632K 1s
                      2850K .......... .......... .......... .......... .......... 73% 18.2M 0s
                      2900K .......... .......... .......... .......... .......... 74% 22.6M 0s
                      2950K .......... .......... .......... .......... .......... 76% 2.13M 0s
                      3000K .......... .......... .......... .......... .......... 77% 4.44M 0s
                      3050K .......... .......... .......... .......... .......... 78% 3.66M 0s
                      3100K .......... .......... .......... .......... .......... 80% 2.65M 0s
                      3150K .......... .......... .......... .......... .......... 81% 2.30M 0s
                      3200K .......... .......... .......... .......... .......... 82% 2.20M 0s
                      3250K .......... .......... .......... .......... .......... 83% 2.21M 0s
                      3300K .......... .......... .......... .......... .......... 85% 2.46M 0s
                      3350K .......... .......... .......... .......... .......... 86% 2.30M 0s
                      3400K .......... .......... .......... .......... .......... 87% 2.14M 0s
                      3450K .......... .......... .......... .......... .......... 88% 2.31M 0s
                      3500K .......... .......... .......... .......... .......... 90% 2.33M 0s
                      3550K .......... .......... .......... .......... .......... 91% 2.36M 0s
                      3600K .......... .......... .......... .......... .......... 92% 2.09M 0s
                      3650K .......... .......... .......... .......... .......... 93% 2.33M 0s
                      3700K .......... .......... .......... .......... .......... 95% 2.48M 0s
                      3750K .......... .......... .......... .......... .......... 96% 2.29M 0s
                      3800K .......... .......... .......... .......... .......... 97% 2.14M 0s
                      3850K .......... .......... .......... .......... .......... 99% 2.42M 0s
                      3900K .......... .......... .......... ......               100% 2.25M=1.7s
                    
                    2017-12-18 11:10:38 (2.22 MB/s) - 已保存 “install-tl-unx.tar.gz” [4031401/4031401])
                    
                    Can't locate Digest/MD5.pm in @INC (@INC contains: ../install-tl-20171217/tlpkg /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ../install-tl-20171217/tlpkg/TeXLive/TLCrypto.pm line 9.
                    BEGIN failed--compilation aborted at ../install-tl-20171217/tlpkg/TeXLive/TLCrypto.pm line 9.
                    Compilation failed in require at ../install-tl-20171217/tlpkg/TeXLive/TLPOBJ.pm line 16.
                    BEGIN failed--compilation aborted at ../install-tl-20171217/tlpkg/TeXLive/TLPOBJ.pm line 16.
                    Compilation failed in require at ../install-tl-20171217/install-tl line 55.
                    BEGIN failed--compilation aborted at ../install-tl-20171217/install-tl line 55.
                    rm: 无法删除"install-tl.log": 没有那个文件或目录
                    sh: 第 25 行:cd: bin/*: 没有那个文件或目录
                    sh:行26: ./tlmgr: 没有那个文件或目录
                    mv: 无法获取"texlive/*" 的文件状态(stat): 没有那个文件或目录
                    install-unx.sh:行24: /home/rstudio/.TinyTeX/bin/*/tlmgr: 没有那个文件或目录
                    install-unx.sh:行31: /home/rstudio/.TinyTeX/bin/*/tlmgr: 没有那个文件或目录
                    Warning message:
                    In tinytex::install_tinytex() :
                      TinyTeX was not successfully installed or configured.
                    1. 相关软件 Rperl
                    devtools::session_info()
                    Session info ---------------------------------------------------------------------
                     setting  value                       
                     version  R version 3.4.2 (2017-09-28)
                     system   x86_64, linux-gnu           
                     ui       RStudio (1.1.383)           
                     language (EN)                        
                     collate  zh_CN.UTF-8                 
                     tz       Asia/Shanghai               
                     date     2017-12-18                  
                    
                    Packages -------------------------------------------------------------------------
                     package   * version date       source        
                     backports   1.1.2   2017-12-13 CRAN (R 3.4.2)
                     base      * 3.4.2   2017-10-30 local         
                     compiler    3.4.2   2017-10-30 local         
                     datasets  * 3.4.2   2017-10-30 local         
                     devtools    1.13.4  2017-11-09 CRAN (R 3.4.2)
                     digest      0.6.13  2017-12-14 CRAN (R 3.4.2)
                     evaluate    0.10.1  2017-06-24 CRAN (R 3.4.2)
                     graphics  * 3.4.2   2017-10-30 local         
                     grDevices * 3.4.2   2017-10-30 local         
                     htmltools   0.3.6   2017-04-28 CRAN (R 3.4.2)
                     knitr       1.17    2017-08-10 CRAN (R 3.4.2)
                     magrittr    1.5     2014-11-22 CRAN (R 3.4.2)
                     memoise     1.1.0   2017-04-21 CRAN (R 3.4.2)
                     methods   * 3.4.2   2017-10-30 local         
                     Rcpp        0.12.14 2017-11-23 CRAN (R 3.4.2)
                     rmarkdown   1.8     2017-11-17 CRAN (R 3.4.2)
                     rprojroot   1.2     2017-01-16 CRAN (R 3.4.2)
                     stats     * 3.4.2   2017-10-30 local         
                     stringi     1.1.6   2017-11-17 CRAN (R 3.4.2)
                     stringr     1.2.0   2017-02-18 CRAN (R 3.4.2)
                     tinytex     0.1     2017-12-13 CRAN (R 3.4.2)
                     tools       3.4.2   2017-10-30 local         
                     utils     * 3.4.2   2017-10-30 local         
                     withr       2.1.0   2017-11-01 CRAN (R 3.4.2)
                     yaml        2.1.16  2017-12-12 CRAN (R 3.4.2)
                    
                    > which perl
                    /usr/bin/perl
                    
                    > perl -v
                    
                    This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
                    (with 33 registered patches, see perl -V for more detail)
                    
                    Copyright 1987-2012, Larry Wall
                    
                    Perl may be copied only under the terms of either the Artistic License or the
                    GNU General Public License, which may be found in the Perl 5 source kit.
                    
                    Complete documentation for Perl, including FAQ lists, should be found on
                    this system using "man perl" or "perldoc perl".  If you have access to the
                    Internet, point your browser at http://www.perl.org/, the Perl Home Page.

                      lovebluesky 这个错误我不太明白是什么原因引起的(校验失败),听起来像是下载不完整。你可以重试一下。当然最好是 TinyTeX 能够提供一个设置初始 CTAN 镜像地址的选项,目前只能自动选择,在你的机器上自动选择的是清华的镜像,我也不知道为什么下载校验失败了。

                      Cloud2016 关于自动安装那一坨 texlive-* 包的问题,我不知道 CentOS 下有没有跟 Debian/Ubuntu 下的 equivs-build 类似的工具,能让你欺骗 yum 叫它不要安装那一坨依赖。参见 FAQ 9:https://yihui.name/tinytex/faq/

                      至于 install_tinytex() 失败的问题,我看不懂这个错误消息。而且我只熟悉 Debian/Ubuntu,几乎没用过 CentOS。

                        yihui 我接触CentOS的时间也比较短,很多问题搞不清楚状况,比如如何安装 tlmgr,我甚至找不到 ctex 包 (如果不用 texlive 全家桶),中文字体更是个老大难的问题,写中文文档的初步探索结果见 rmd文件

                        BTW,我很看好rocker项目 <https://github.com/rocker-org/rocker/>,但是 eddelbuettel 对是否用 tlmgr 代替那一坨 texlive-*包不太感兴趣 #266 ,好像宁愿多花4个G,我总觉得Docker 太大不是件好事,可能外国人不用中文,关系不太大,我用VBox打包了一个虚拟机镜像放在百度云,分享链接: https://pan.baidu.com/s/1nv67anJ 密码: v3mr,用账户 cloud2016 密码 cloud登陆即可使用,功能上和rocker/tidyverse 差不多 <https://hub.docker.com/r/rocker/tidyverse/>

                          yihui 我重试过几次,一样的报错,另外,忘记讲了,看了一下 Cloud2016 的问题我才记起来,我 fedora 虽然是前一段时间新安装的,没有主动安装过 texlive,但在安装某些东西的时候也安装了一些 texlive 的东西,具体是什么我也记不清了,不知有没有关系。

                            Cloud2016 那为啥还用 CentOS 呢?

                            eddelbuettel 大人很瞧不起我的工作,对 Debian 有强烈的信仰,认为无知的我在重造无谓的轮子,不过他理不理解这件事我懒得操心,能有一部分群众觉得好就好了。Docker 要是太大,对我来说就失去了它最大的优势之一(轻便)。

                            lovebluesky 我也不确定。如我前面所说,我对 CentOS 不熟,无法帮你,不行你就只能继续仰仗你的系统提供的那一大坨 TeX Live 包了。我只能帮 Debian/Ubuntu 用户。

                              yihui 觉得从 Ubuntu 过来,学起来应该不难。上面报告的错误只需安装 perl-Digest-MD5 即可

                              yum install perl-Digest-MD5

                              最新报告

                              > tinytex::install_tinytex()
                              
                              试开URL’https://github.com/yihui/tinytex/raw/master/tools/install-unx.sh'
                              Content type 'text/plain; charset=utf-8' length 758 bytes
                              ==================================================
                              downloaded 758 bytes
                              
                              Downloading install-tl-unx.tar.gz to /tmp ...
                              --2017-12-19 10:20:16--  http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
                              正在解析主机 mirror.ctan.org (mirror.ctan.org)... 176.28.54.184, 2a01:488:67:1000:b01c:36b8:0:1
                              正在连接 mirror.ctan.org (mirror.ctan.org)|176.28.54.184|:80... 已连接。
                              已发出 HTTP 请求,正在等待回应... 302 Found
                              位置:http://10.101.10.10/files/21100000016597FC/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz [跟随至新的 URL]
                              --2017-12-19 10:20:16--  http://10.101.10.10/files/21100000016597FC/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
                              正在连接 10.101.10.10:80... 已连接。
                              已发出 HTTP 请求,正在等待回应... 200 OK
                              长度:4031443 (3.8M) [application/octet-stream]
                              正在保存至: “install-tl-unx.tar.gz”
                              
                                   0K .......... .......... .......... .......... ..........  1% 7.06M 1s
                                  50K .......... .......... .......... .......... ..........  2% 11.7M 0s
                                 100K .......... .......... .......... .......... ..........  3% 10.0M 0s
                                 150K .......... .......... .......... .......... ..........  5% 12.5M 0s
                                 200K .......... .......... .......... .......... ..........  6% 8.79M 0s
                                 250K .......... .......... .......... .......... ..........  7% 12.6M 0s
                                 300K .......... .......... .......... .......... ..........  8% 12.3M 0s
                                 350K .......... .......... .......... .......... .......... 10% 7.80M 0s
                                 400K .......... .......... .......... .......... .......... 11% 20.7M 0s
                                 450K .......... .......... .......... .......... .......... 12% 10.2M 0s
                                 500K .......... .......... .......... .......... .......... 13% 12.7M 0s
                                 550K .......... .......... .......... .......... .......... 15% 10.8M 0s
                                 600K .......... .......... .......... .......... .......... 16% 11.9M 0s
                                 650K .......... .......... .......... .......... .......... 17% 11.3M 0s
                                 700K .......... .......... .......... .......... .......... 19% 7.47M 0s
                                 750K .......... .......... .......... .......... .......... 20% 23.8M 0s
                                 800K .......... .......... .......... .......... .......... 21% 8.34M 0s
                                 850K .......... .......... .......... .......... .......... 22% 16.7M 0s
                                 900K .......... .......... .......... .......... .......... 24% 9.79M 0s
                                 950K .......... .......... .......... .......... .......... 25% 13.1M 0s
                                1000K .......... .......... .......... .......... .......... 26% 11.2M 0s
                                1050K .......... .......... .......... .......... .......... 27% 11.2M 0s
                                1100K .......... .......... .......... .......... .......... 29% 11.3M 0s
                                1150K .......... .......... .......... .......... .......... 30% 7.44M 0s
                                1200K .......... .......... .......... .......... .......... 31% 22.3M 0s
                                1250K .......... .......... .......... .......... .......... 33% 8.52M 0s
                                1300K .......... .......... .......... .......... .......... 34% 16.4M 0s
                                1350K .......... .......... .......... .......... .......... 35% 8.33M 0s
                                1400K .......... .......... .......... .......... .......... 36% 11.5M 0s
                                1450K .......... .......... .......... .......... .......... 38% 10.6M 0s
                                1500K .......... .......... .......... .......... .......... 39% 10.6M 0s
                                1550K .......... .......... .......... .......... .......... 40% 11.2M 0s
                                1600K .......... .......... .......... .......... .......... 41% 7.56M 0s
                                1650K .......... .......... .......... .......... .......... 43% 23.2M 0s
                                1700K .......... .......... .......... .......... .......... 44% 8.41M 0s
                                1750K .......... .......... .......... .......... .......... 45% 16.2M 0s
                                1800K .......... .......... .......... .......... .......... 46% 10.1M 0s
                                1850K .......... .......... .......... .......... .......... 48% 12.8M 0s
                                1900K .......... .......... .......... .......... .......... 49% 11.2M 0s
                                1950K .......... .......... .......... .......... .......... 50% 11.5M 0s
                                2000K .......... .......... .......... .......... .......... 52% 11.2M 0s
                                2050K .......... .......... .......... .......... .......... 53% 7.40M 0s
                                2100K .......... .......... .......... .......... .......... 54% 24.9M 0s
                                2150K .......... .......... .......... .......... .......... 55% 8.21M 0s
                                2200K .......... .......... .......... .......... .......... 57% 18.5M 0s
                                2250K .......... .......... .......... .......... .......... 58% 9.29M 0s
                                2300K .......... .......... .......... .......... .......... 59% 13.3M 0s
                                2350K .......... .......... .......... .......... .......... 60% 10.7M 0s
                                2400K .......... .......... .......... .......... .......... 62% 11.8M 0s
                                2450K .......... .......... .......... .......... .......... 63% 11.3M 0s
                                2500K .......... .......... .......... .......... .......... 64% 7.42M 0s
                                2550K .......... .......... .......... .......... .......... 66% 22.7M 0s
                                2600K .......... .......... .......... .......... .......... 67% 8.47M 0s
                                2650K .......... .......... .......... .......... .......... 68% 17.2M 0s
                                2700K .......... .......... .......... .......... .......... 69% 9.71M 0s
                                2750K .......... .......... .......... .......... .......... 71% 13.6M 0s
                                2800K .......... .......... .......... .......... .......... 72% 11.2M 0s
                                2850K .......... .......... .......... .......... .......... 73% 11.5M 0s
                                2900K .......... .......... .......... .......... .......... 74% 11.1M 0s
                                2950K .......... .......... .......... .......... .......... 76% 7.22M 0s
                                3000K .......... .......... .......... .......... .......... 77% 27.1M 0s
                                3050K .......... .......... .......... .......... .......... 78% 8.00M 0s
                                3100K .......... .......... .......... .......... .......... 80% 19.4M 0s
                                3150K .......... .......... .......... .......... .......... 81% 9.09M 0s
                                3200K .......... .......... .......... .......... .......... 82% 14.7M 0s
                                3250K .......... .......... .......... .......... .......... 83% 10.8M 0s
                                3300K .......... .......... .......... .......... .......... 85% 11.9M 0s
                                3350K .......... .......... .......... .......... .......... 86% 10.3M 0s
                                3400K .......... .......... .......... .......... .......... 87% 12.6M 0s
                                3450K .......... .......... .......... .......... .......... 88% 11.3M 0s
                                3500K .......... .......... .......... .......... .......... 90% 11.4M 0s
                                3550K .......... .......... .......... .......... .......... 91% 10.8M 0s
                                3600K .......... .......... .......... .......... .......... 92% 7.62M 0s
                                3650K .......... .......... .......... .......... .......... 93% 24.0M 0s
                                3700K .......... .......... .......... .......... .......... 95% 8.54M 0s
                                3750K .......... .......... .......... .......... .......... 96% 16.9M 0s
                                3800K .......... .......... .......... .......... .......... 97% 9.55M 0s
                                3850K .......... .......... .......... .......... .......... 99% 13.8M 0s
                                3900K .......... .......... .......... ......               100% 8.77M=0.3s
                              
                              2017-12-19 10:20:16 (11.1 MB/s) - 已保存 “install-tl-unx.tar.gz” [4031443/4031443])
                              
                              Automated TeX Live installation using profile: ../texlive.profile
                              Loading http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb
                              Installing TeX Live 2017 from: http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet (verified)
                              Platform: x86_64-linux => 'GNU/Linux on x86_64'
                              Distribution: net  (downloading)
                              Using URL: http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet
                              Directory for temporary files: /tmp/74Fg2pfq89
                              Installing to: ./
                              Installing [1/7, time/total: ??:??/??:??]: hyphen-base [22k]
                              Installing [2/7, time/total: 00:00/00:00]: kpathsea [31k]
                              Installing [3/7, time/total: 00:00/00:00]: kpathsea.x86_64-linux [46k]
                              Installing [4/7, time/total: 00:00/00:00]: tetex [70k]
                              Installing [5/7, time/total: 00:01/00:02]: tetex.x86_64-linux [1k]
                              Installing [6/7, time/total: 00:01/00:02]: texlive.infra [203k]
                              Installing [7/7, time/total: 00:01/00:01]: texlive.infra.x86_64-linux [90k]
                              Time used for installing the packages: 00:01
                              running mktexlsr ./texmf-dist ...
                              writing fmtutil.cnf to ./texmf-dist/web2c/fmtutil.cnf
                              writing updmap.cfg to ./texmf-dist/web2c/updmap.cfg
                              writing language.dat to ./texmf-var/tex/generic/config/language.dat
                              writing language.def to ./texmf-var/tex/generic/config/language.def
                              writing language.dat.lua to ./texmf-var/tex/generic/config/language.dat.lua
                              running mktexlsr ./texmf-var ./texmf-config ./texmf-dist ...
                              running updmap-sys --nohash ...done
                              re-running mktexlsr ./texmf-var ./texmf-config ...
                              pre-generating all format files, be patient...
                              running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-strict --all ...done
                              running package-specific postactions
                              finished with package-specific postactions
                              
                              Logfile: ./install-tl.log
                              tlmgr: package repository http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet (verified)
                              [1/19, ??:??/??:??] install: babel [132k]
                              [2/19, 00:03/04:33] install: cm [233k]
                              [3/19, 00:03/01:38] install: etex [12k]
                              [4/19, 00:03/01:35] install: knuth-lib [30k]
                              [5/19, 00:04/01:58] install: latex [161k]
                              [6/19, 00:04/01:24] install: latex-bin.x86_64-linux [1k]
                              [7/19, 00:04/01:24] install: latex-bin [1k]
                              [8/19, 00:04/01:24] install: latex-fonts [18k]
                              [9/19, 00:04/01:22] install: latexconfig [5k]
                              [10/19, 00:04/01:21] install: luatex.x86_64-linux [3442k]
                              [11/19, 00:06/00:17] install: luatex [13k]
                              [12/19, 00:07/00:20] install: pdftex.x86_64-linux [763k]
                              [13/19, 00:08/00:19] install: pdftex [36k]
                              [14/19, 00:08/00:19] install: plain [60k]
                              [15/19, 00:08/00:19] install: tex-ini-files [4k]
                              [16/19, 00:08/00:19] install: unicode-data [220k]
                              [17/19, 00:08/00:18] install: xetex.x86_64-linux [6880k]
                              [18/19, 00:12/00:12] install: xetex [7k]
                              [19/19, 00:13/00:13] install: xetexconfig [1k]
                              running mktexlsr ...
                              done running mktexlsr.
                              running updmap-sys ...
                              done running updmap-sys.
                              regenerating fmtutil.cnf in /tmp/texlive/texmf-dist
                              running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine xetex ...
                              done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine xetex.
                              running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine luatex ...
                              done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine luatex.
                              running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine pdftex ...
                              done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine pdftex.
                              running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine luajittex ...
                              done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine luajittex.
                              tlmgr: package log updated: /tmp/texlive/texmf-var/web2c/tlmgr.log
                              tlmgr: package repository http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet (verified)
                              [1/49, ??:??/??:??] install: amscls [32k]
                              [2/49, 00:00/00:00] install: amsfonts [3542k]
                              [3/49, 00:03/00:16] install: amsmath [30k]
                              [4/49, 00:03/00:16] install: bibtex.x86_64-linux [70k]
                              [5/49, 00:04/00:21] install: bibtex [15k]
                              [6/49, 00:04/00:21] install: booktabs [3k]
                              [7/49, 00:04/00:21] install: caption [32k]
                              [8/49, 00:04/00:21] install: dvipdfmx.x86_64-linux [2k]
                              [9/49, 00:04/00:21] install: dvipdfmx [27k]
                              [10/49, 00:04/00:21] install: ec [258k]
                              [11/49, 00:05/00:25] install: etoolbox [8k]
                              [12/49, 00:05/00:25] install: euenc [4k]
                              [13/49, 00:05/00:25] install: fancyvrb [12k]
                              [14/49, 00:05/00:24] install: fontspec [26k]
                              [15/49, 00:05/00:24] install: framed [8k]
                              [16/49, 00:06/00:29] install: geometry [9k]
                              [17/49, 00:06/00:29] install: glyphlist [25k]
                              [18/49, 00:08/00:39] install: graphics [15k]
                              [19/49, 00:08/00:39] install: graphics-cfg [2k]
                              [20/49, 00:08/00:39] install: graphics-def [10k]
                              [21/49, 00:09/00:44] install: gsftopk.x86_64-linux [40k]
                              [22/49, 00:09/00:43] install: gsftopk [4k]
                              [23/49, 00:09/00:43] install: hyperref [106k]
                              [24/49, 00:09/00:42] install: ifluatex [3k]
                              [25/49, 00:09/00:42] install: iftex [2k]
                              [26/49, 00:09/00:42] install: ifxetex [2k]
                              [27/49, 00:09/00:42] install: l3kernel [125k]
                              [28/49, 00:10/00:45] install: l3packages [19k]
                              [29/49, 00:10/00:45] install: lm [11651k]
                              [30/49, 00:16/00:20] install: lualibs [72k]
                              [31/49, 00:16/00:19] install: luaotfload.x86_64-linux [1k]
                              [32/49, 00:16/00:19] install: luaotfload [432k]
                              [33/49, 00:18/00:21] install: makeindex.x86_64-linux [47k]
                              [34/49, 00:18/00:21] install: makeindex [5k]
                              [35/49, 00:18/00:21] install: mathspec [10k]
                              [36/49, 00:18/00:21] install: metafont.x86_64-linux [186k]
                              [37/49, 00:19/00:22] install: metafont [33k]
                              [38/49, 00:19/00:22] install: mfware.x86_64-linux [118k]
                              [39/49, 00:19/00:22] install: mfware [4k]
                              [40/49, 00:19/00:22] install: natbib [17k]
                              [41/49, 00:19/00:22] install: oberdiek [221k]
                              [42/49, 00:20/00:23] install: tipa [2809k]
                              [43/49, 00:21/00:21] install: titling [3k]
                              [44/49, 00:21/00:21] install: tools [39k]
                              [45/49, 00:22/00:22] install: upquote [2k]
                              [46/49, 00:22/00:22] install: url [6k]
                              [47/49, 00:22/00:22] install: xkeyval [13k]
                              [48/49, 00:22/00:22] install: xunicode [26k]
                              [49/49, 00:22/00:22] install: zapfding [46k]
                              running mktexlsr ...
                              done running mktexlsr.
                              running updmap-sys ...
                              done running updmap-sys.
                              regenerating fmtutil.cnf in /home/rstudio/.TinyTeX/texmf-dist
                              running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --byfmt mf ...
                              done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --byfmt mf.
                              tlmgr: package log updated: /home/rstudio/.TinyTeX/texmf-var/web2c/tlmgr.log
                              Warning message:
                              In tinytex::install_tinytex() :
                                TinyTeX was not successfully installed or configured.

                              只剩最后一个警告

                              > tinytex::tlmgr_install('ctex')
                              
                              tlmgr install ctex
                              sh: tlmgr: 未找到命令
                              tlmgr path add
                              Warning messages:
                              1: In tlmgr(c("install", pkgs), usermode) :
                                TeX Live does not seem to be installed. See https://yihui.name/tinytex/.
                              2: In tlmgr(c("path", match.arg(action))) :
                                TeX Live does not seem to be installed. See https://yihui.name/tinytex/.
                                
                                
                              > tlmgr --version
                              
                              tlmgr revision 46034 (2017-12-11 02:54:21 +0100)
                              tlmgr using installation: /home/rstudio/.TinyTeX
                              TeX Live (http://tug.org/texlive) version 2017
                              
                              > tex -v
                              
                              TeX 3.1415926 (TeX Live 2013)
                              kpathsea version 6.1.1
                              Copyright 2013 D.E. Knuth.
                              There is NO warranty.  Redistribution of this software is
                              covered by the terms of both the TeX copyright and
                              the Lesser GNU General Public License.
                              For more information about these matters, see the file
                              named COPYING and the TeX source.
                              Primary author of TeX: D.E. Knuth.

                              综上,那个警告应该是没有配置新的 tex 替换旧的 tex,而要是先卸载旧的会连同R一块卸载,怎么办?

                              附上环境变量

                              echo $PATH
                              /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:bin/msys-ssh-1000-18:/home/rstudio/.local/bin:/home/rstudio/bin:bin/msys-ssh-1000-18:/home/rstudio/.local/bin:/home/rstudio/bin:bin/msys-ssh-1000-18:/home/rstudio/.local/bin:/home/rstudio/bin:/home/rstudio/.TinyTeX/bin/x86_64-linux

                                Cloud2016 哇,我都不知道我有这么聪明……我填不了的坑,就留给了用户自己?

                                yihui "是不是我仍然没说清楚"……唉,我看明白你说的了,但是按你说的办法解决不了问题啊。"这个坑已经存在多年",可是我上半年开始用 bookdown 的时候就没有这个问题啊,一口气编译出来 pdf 、gitbook、word 格式的文档,妥妥的,参考文献没有任何问题。而现在……编译 pdf 时我就去掉 yaml 里的 .bib,编译别的就添上 .bib。后来我索性写个代码,根据编译的格式来自动修改 yaml ?

                                我觉得好像我说不清了,还是及时止损,远程协助把我捞出来吧,QQ 还是 teamviewer 都行。

                                这几天我去山里隐居,回来就重新拎起 tinytex,人世间好像出了什么事儿?瞧,又出现几个新问题:

                                1. 分支 rstudio/rmarkdown@feature/tinytex 怎么不见了:
                                  devtools::install_github("rstudio/rmarkdown@feature/tinytex")
                                  ## Downloading GitHub repo rstudio/rmarkdown@feature/tinytex
                                  ## from URL https://api.github.com/repos/rstudio/rmarkdown/zipball/feature/tinytex
                                  ## Installation failed: 404: Not Found
                                  ##  (404)

                                所以 devtools::install_github( c("yihui/tinytex", "rstudio/rmarkdown@feature/tinytex")) 也是同样的出错信息。

                                我目前的 rmarkdown 版本是 rmarkdown 1.8.3 2017-12-12 Github (rstudio/rmarkdown@d6edecd),应该是已经安装了这个分支了.

                                1. tinytex::pdflatex()tinytex::xelatex() 为嘛不好使了?但是 tinytex::latexmk(engine = 'pdflatex') 却好使。
                                pdflatex('test.tex')
                                ## Error: Failed to compile test.tex.
                                ## In addition: Warning message:
                                ## running command '"pdflatex" -halt-on-error -interaction=batchmode "test.tex"' had status 1 
                                xelatex('test.tex')
                                ## Error: Failed to compile test.tex.
                                ## In addition: Warning message:
                                ## running command '"xelatex" -halt-on-error -interaction=batchmode "test.tex"' had status 1 

                                  Cloud2016 目测 $HOME/bin 在 PATH 中的优先程度不够高(不够靠前),而且你应该检查 R 中的 Sys.getenv('PATH'),因为 R 读的环境变量跟 bash 读的环境变量未必一致(比如 R 不会读你的 ~/.bash_profile)。不过你这情况我估计提前了也不管用,你的问题混合着好几件麻烦事:

                                  1. 要么你保证 $HOME/bin 能提前出现(同时保证 Sys.getenv('PATH') 在 R 中也能得到 $HOME/bin,这需要你对 R 的配置文件有相当的了解,比如 ~/.Rprofile~/.Renviron),要么把系统自己安装的 texlive 系列包删掉,不要让它干扰到 TinyTeX;

                                  2. 因为 Linux 的依赖地狱,R 跟 LaTeX 被贵操作系统的打包者强行捆绑了(这特么到底有什么意义),我不知道在贵系统下如何拆开它们。我前面说了,我只能提供在 Debian/Ubuntu 下的逃避办法(FAQ 9),你需要自行找到在 CentOS 下对等的办法。

                                  如果 R 跟 LaTeX 无法拆开,用 TinyTeX 就没什么意义,因为你顶多就是装一坨 CentOS 提供的 texlive 包,然后另外安装 TinyTeX,然后让 TinyTeX 的 bin 路径在系统 PATH 中足够靠前。躲不开系统自带的 texlive。

                                  所以这问题不是没有解决办法,比如 ~/.RprofileSys.setenv(PATH = ...),但这只是把问题藏起来的办法。鉴于它是如此之麻烦,我实在忍不了这么不干净利索的解决办法,我建议你要么不要折腾 CentOS,要么不要折腾 TinyTeX,不值得浪费这个时间。

                                  dapengde 那个 rmarkdown 的分支我已经合并并删除了,你直接 devtools::install_github("rstudio/rmarkdown")

                                    yihui 1. 多谢提点,改了 .Rprofile 解决了。如果使用 CentOS 仓库自带的R是肯定捆绑的,我始终没有找到替代办法。
                                    2. 我用非常干净的 CentOS minimal 版本,先按照

                                    wget -qO- \
                                      "https://github.com/yihui/tinytex/raw/master/tools/install-unx.sh" | sh

                                    TinyTeX 装好,自己把依赖找齐,然后编译 R, 再设置 .Rprofiletinytex 包也可以继续用了