Cloud2016 谢谢!直接在 R 里面运行 normalizePath("~/bin") 也会出警告吗?path.expand("~/bin") 是否成功?(我估计也不行)

环境变量 Sys.getenv('HOME') 呢?

    yihui 都能运行正常,但是终端里 tex -v 没有反应,应该是路径没加上,测试环境是拉取 rocker/tidyverse 镜像,里面不包含TeX套件

    > tinytex::install_tinytex(TRUE, repository = 'http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet')
    trying URL 'https://github.com/yihui/tinytex/raw/master/tools/install-unx.sh'
    Content type 'text/plain; charset=utf-8' length 604 bytes
    ==================================================
    downloaded 604 bytes
    
    Downloading install-tl-unx.tar.gz to /tmp ...
    Automated TeX Live installation using profile: ../texlive.profile
    Loading http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb
    Installing TeX Live 2017 from: http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (not verified)
    Platform: x86_64-linux => 'GNU/Linux on x86_64'
    Distribution: net  (downloading)
    Using URL: http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet
    Directory for temporary files: /tmp/GQudatKm4j
    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:00/00:00]: tetex.x86_64-linux [1k]
    Installing [6/7, time/total: 00:00/00:00]: texlive.infra [203k]
    Installing [7/7, time/total: 00:00/00:00]: 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: setting default package repository to http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet
    tlmgr: package repository http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (not verified: gpg unavailable)
    tlmgr: no updates available
    tlmgr: package repository http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (not verified: gpg unavailable)
    [1/19, ??:??/??:??] install: babel [134k]
    [2/19, 00:00/00:00] install: cm [233k]
    [3/19, 00:00/00:00] install: etex [12k]
    [4/19, 00:00/00:00] install: knuth-lib [30k]
    [5/19, 00:00/00:00] install: latex [161k]
    [6/19, 00:00/00:00] install: latex-bin.x86_64-linux [1k]
    [7/19, 00:00/00:00] install: latex-bin [1k]
    [8/19, 00:00/00:00] install: latex-fonts [18k]
    [9/19, 00:00/00:00] install: latexconfig [5k]
    [10/19, 00:00/00:00] install: luatex.x86_64-linux [3442k]
    [11/19, 00:02/00:05] install: luatex [13k]
    [12/19, 00:02/00:05] install: pdftex.x86_64-linux [763k]
    [13/19, 00:02/00:04] install: pdftex [36k]
    [14/19, 00:02/00:04] install: plain [60k]
    [15/19, 00:02/00:04] install: tex-ini-files [4k]
    [16/19, 00:02/00:04] install: unicode-data [220k]
    [17/19, 00:02/00:04] install: xetex.x86_64-linux [6880k]
    [18/19, 00:06/00:06] install: xetex [7k]
    [19/19, 00:06/00:06] 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 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 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 luajittex ...
    done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine luajittex.
    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.
    tlmgr: package log updated: /tmp/texlive/texmf-var/web2c/tlmgr.log
    tlmgr: package repository http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (not verified: gpg unavailable)
    [1/49, ??:??/??:??] install: amscls [32k]
    [2/49, 00:00/00:00] install: amsfonts [3542k]
    [3/49, 00:02/00:11] install: amsmath [30k]
    [4/49, 00:02/00:11] install: bibtex.x86_64-linux [70k]
    [5/49, 00:02/00:10] install: bibtex [15k]
    [6/49, 00:02/00:10] install: booktabs [3k]
    [7/49, 00:02/00:10] install: caption [32k]
    [8/49, 00:02/00:10] install: dvipdfmx.x86_64-linux [2k]
    [9/49, 00:02/00:10] install: dvipdfmx [27k]
    [10/49, 00:02/00:10] install: ec [258k]
    [11/49, 00:02/00:10] install: etoolbox [8k]
    [12/49, 00:02/00:10] install: euenc [4k]
    [13/49, 00:02/00:10] install: fancyvrb [12k]
    [14/49, 00:02/00:10] install: fontspec [26k]
    [15/49, 00:02/00:09] install: framed [8k]
    [16/49, 00:02/00:09] install: geometry [9k]
    [17/49, 00:02/00:09] install: glyphlist [25k]
    [18/49, 00:02/00:09] install: graphics [15k]
    [19/49, 00:02/00:09] install: graphics-cfg [2k]
    [20/49, 00:02/00:09] install: graphics-def [10k]
    [21/49, 00:02/00:09] install: gsftopk.x86_64-linux [40k]
    [22/49, 00:02/00:09] install: gsftopk [4k]
    [23/49, 00:02/00:09] install: hyperref [106k]
    [24/49, 00:02/00:09] install: ifluatex [3k]
    [25/49, 00:02/00:09] install: iftex [2k]
    [26/49, 00:02/00:09] install: ifxetex [2k]
    [27/49, 00:03/00:14] install: l3kernel [125k]
    [28/49, 00:03/00:13] install: l3packages [19k]
    [29/49, 00:03/00:13] install: lm [11651k]
    [30/49, 00:08/00:10] install: lualibs [72k]
    [31/49, 00:08/00:09] install: luaotfload.x86_64-linux [1k]
    [32/49, 00:08/00:09] install: luaotfload [432k]
    [33/49, 00:09/00:10] install: makeindex.x86_64-linux [47k]
    [34/49, 00:09/00:10] install: makeindex [5k]
    [35/49, 00:09/00:10] install: mathspec [10k]
    [36/49, 00:09/00:10] install: metafont.x86_64-linux [186k]
    [37/49, 00:09/00:10] install: metafont [33k]
    [38/49, 00:09/00:10] install: mfware.x86_64-linux [118k]
    [39/49, 00:09/00:10] install: mfware [4k]
    [40/49, 00:09/00:10] install: natbib [17k]
    [41/49, 00:09/00:10] install: oberdiek [221k]
    [42/49, 00:09/00:10] install: tipa [2809k]
    [43/49, 00:10/00:10] install: titling [3k]
    [44/49, 00:11/00:11] install: tools [39k]
    [45/49, 00:11/00:11] install: upquote [2k]
    [46/49, 00:11/00:11] install: url [6k]
    [47/49, 00:11/00:11] install: xkeyval [13k]
    [48/49, 00:11/00:11] install: xunicode [26k]
    [49/49, 00:11/00:11] install: zapfding [46k]
    running mktexlsr ...
    done running mktexlsr.
    running updmap-sys ...
    done running updmap-sys.
    regenerating fmtutil.cnf in /home/xiangyun/.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/xiangyun/.TinyTeX/texmf-var/web2c/tlmgr.log
    TinyTeX installed to /home/xiangyun/.TinyTeX
    Warning message:
    In normalizePath("~/bin") :
      path[1]="/home/xiangyun/bin": No such file or directory
    > normalizePath("~/bin")
    [1] "/home/xiangyun/bin"
    > path.expand("~/bin")
    [1] "/home/xiangyun/bin"
    > Sys.getenv('HOME')
    [1] "/home/xiangyun"

    此外,还在 rocker/geospatial 测试,这个docker镜像自带 tinytex,当前目录下本身不带 bin 目录的,发现如下情况,此时感觉警告信息是多余的

    tinytex::tlmgr(
    +     c('option', 'repository', 'https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet')
    + )
    tlmgr option repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet
    tlmgr: setting default package repository to https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet
    Warning message:
    In normalizePath("~/bin") :
      path[1]="/home/xiangyun/bin": No such file or directory
    > tinytex::tlmgr_install('fandol')
    tlmgr install fandol
    tlmgr: package repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (not verified: gpg unavailable)
    [1/1, ??:??/??:??] install: fandol [21077k]
    running mktexlsr ...
    done running mktexlsr.
    tlmgr: package log updated: /opt/TinyTeX/texmf-var/web2c/tlmgr.log
    tlmgr path add
    Warning messages:
    1: In normalizePath("~/bin") :
      path[1]="/home/xiangyun/bin": No such file or directory
    2: In normalizePath("~/bin") :
      path[1]="/home/xiangyun/bin": No such file or directory

      Cloud2016 谢谢,这个警告问题应该在最新版中修正了:devtools::install_github('yihui/tinytex')

      yufree 这个 texlive_root() 是参数默认取值,不需要导出,你真正使用的时候用 uninstall_tinytex() 就可以了,不用把参数写全。

        yihui 谢谢!明白了,我当时直接复制了帮助文件中的命令运行提示找不到函数,参数留空反而可以了

        2 个月 后

        @yihui 请问能否在lyx中使用TinyTex?没有搜到相关的文档。我从R中直接安装的,也不知道怎么和lyx连接起来,求助。

          bayeswhu 可以,不用特别的连接,装了就可以用(不管用什么方式装)。

          貌似看见一个眼熟的 ID,话说你这有几年没来了啊。

          @yihui 谢谢答复,我再试试。难得你还记得我啊,呵呵。
          是的,前几年因为主要在用R和lyx写些东西,所以来的比较频繁,之后一段时间,转而用jupyter notebook写python去了,所以这边来得少一些。不过一直在关注你,blog也一直在看,看你有好东西,这不是马上就来了么~~~?

          大神啊,我试了下中文文档,出现如下错误:
          output file: test.knit.md

          "D:/software/Rstudio/bin/pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.tex --template "D:\software\R\library\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in"
          ! Package inputenc Error: Unicode char 绗?(U+7B2C)
          (inputenc) not set up for use with LaTeX.

          错误: Failed to compile test.tex. See test.log for more info.
          此外: Warning messages:
          1: 运行命令'"pdflatex" -halt-on-error -interaction=batchmode "test.tex"'的状态是1
          2: In grepl("==> Fatal error occurred", x, fixed = TRUE) :
          输入的字符串1不适用于此语言环境
          停止执行

          这是什么鬼啊

            19 天 后

            yihui 我发现 tinytex::tlmgr_update 不能升级 TinyTeX,考虑写个函数 tlmgr_upgrade 怎么样?

            我查看了 TeXLive 的官方升级指南 <https://tug.org/texlive/upgrade.html> 强推大家卸载重装,不喜欢!不喜欢!

            1. 手动下载 update-tlmgr-latest.sh(exe)
            2. 升级
            sudo sh update-tlmgr-latest.sh  -- --upgrade
            tlmgr option repository yourrepo (这个可以省,之前安装过 TinyTeX,如果设置过)
            tlmgr update --self --all

            在 Windows 命令行窗口操作,

            update-tlmgr-latest.exe  -- --upgrade 
            tlmgr option repository yourrepo (这个可以省,之前安装过 TinyTeX,如果设置过)
            tlmgr update --self --all

            注意 windows 下 执行第一行有个弹窗,点击安装就好

            然后就升级完成了。

            附升级日志

            sudo sh update-tlmgr-latest.sh -- --upgrade
            Verifying archive integrity... All good.
            Uncompressing TeX Live Manager Updater  100%
            ./runme.sh: updating in /opt/TinyTeX...
            ./runme.sh: tlmgr version says this is TeX Live 2018
            ./runme.sh: have TL 2018, new version also 2018;
            ./runme.sh: using --upgrade doesn't make sense; terminating.
            tlmgr update --self --all
            tlmgr: package repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (verified)
            [1/1, ??:??/??:??] update: texlive.infra [204k] (46470 -> 47457) ... done
            Restarting tlmgr to complete update ...
            tlmgr: package repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet (verified)
            [ 1/35, ??:??/??:??] update: amsmath [30k] (45246 -> 47349) ... done
            [ 2/35, 00:00/00:00] update: bibtex.x86_64-linux [72k] (43804 -> 47063) ... done
            [ 3/35, 00:00/00:00] update: bibtex [15k] (44166 -> 47198) ... done
            [ 4/35, 00:00/00:00] update: dvipdfmx [27k] (44224 -> 47198) ... done
            [ 5/35, 00:01/02:06] update: geometry [9k] (19716 -> 47106) ... done
            [ 6/35, 00:01/01:59] update: graphics [15k] (44703 -> 47350) ... done
            [ 7/35, 00:01/01:48] update: gsftopk.x86_64-linux [40k] (43804 -> 47063) ... done
            [ 8/35, 00:01/01:27] update: gsftopk [4k] (44166 -> 47198) ... done
            [ 9/35, 00:01/01:26] update: hyphen-base [22k] (45751 -> 47260) ... done
            [10/35, 00:01/01:17] update: ifluatex [3k] (46447 -> 47293) ... done
            [11/35, 00:01/01:17] update: kpathsea.x86_64-linux [47k] (43804 -> 47063) ... done
            [12/35, 00:01/01:04] update: kpathsea [31k] (46655 -> 47198) ... done
            [13/35, 00:02/01:55] update: l3kernel [125k] (46720 -> 46875) ... done
            [14/35, 00:02/01:22] update: latex [163k] (43813 -> 47377) ... done
            [15/35, 00:02/00:59] update: latex-bin [1k] (45751 -> 47198) ... done
            [16/35, 00:02/00:59] update: luaotfload [432k] (43194 -> 47444) ... done
            [17/35, 00:03/00:52] update: luatex.x86_64-linux [7301k] (44582 -> 47245) ... done
            [18/35, 00:07/00:14] update: luatex [13k] (46508 -> 47235) ... done
            [19/35, 00:07/00:14] update: makeindex.x86_64-linux [49k] (43804 -> 47063) ... done
            [20/35, 00:08/00:17] update: makeindex [5k] (44166 -> 47198) ... done
            [21/35, 00:08/00:16] update: metafont.x86_64-linux [189k] (44013 -> 47063) ... done
            [22/35, 00:08/00:16] update: metafont [33k] (45678 -> 47198) ... done
            [23/35, 00:08/00:16] update: mfware.x86_64-linux [120k] (43804 -> 47063) ... done
            [24/35, 00:08/00:16] update: mfware [4k] (44166 -> 47198) ... done
            [25/35, 00:08/00:16] update: oberdiek [222k] (46447 -> 47293) ... done
            [26/35, 00:09/00:17] update: pdftex.x86_64-linux [795k] (44065 -> 47140) ... done
            [27/35, 00:09/00:16] update: pdftex [36k] (44166 -> 47199) ... done
            [28/35, 00:09/00:16] update: tetex [70k] (46595 -> 47198) ... done
            [29/35, 00:09/00:16] update: tex.x86_64-linux [172k] (44013 -> 47063) ... done
            [30/35, 00:10/00:17] update: tex [1k] (44166 -> 47198) ... done
            [31/35, 00:10/00:17] update: tools [39k] (43813 -> 47377) ... done
            [32/35, 00:10/00:17] update: ttfutils.x86_64-linux [410k] (43804 -> 47063) ... done
            [33/35, 00:10/00:17] update: ttfutils [106k] (45845 -> 47198) ... done
            [34/35, 00:10/00:16] update: xecjk [126k] (46756 -> 47362) ... done
            [35/35, 00:11/00:18] update: xetex.x86_64-linux [7123k] (44328 -> 47245) ... done
            running mktexlsr ...
            done running mktexlsr.
            running updmap-sys ...
            done running updmap-sys.
            regenerating fmtutil.cnf in /opt/TinyTeX/texmf-dist
            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.
            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 tex ...
            done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine tex.
            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: /opt/TinyTeX/texmf-var/web2c/tlmgr.log

            测试环境
            Windows 8.1
            R 3.5.0

            sessionInfo()
            R version 3.5.0 (2018-04-23)
            Platform: x86_64-w64-mingw32/x64 (64-bit)
            Running under: Windows 8.1 x64 (build 9600)
            
            Matrix products: default
            
            locale:
            [1] LC_COLLATE=Chinese (Simplified)_China.936 
            [2] LC_CTYPE=Chinese (Simplified)_China.936   
            [3] LC_MONETARY=Chinese (Simplified)_China.936
            [4] LC_NUMERIC=C                              
            [5] LC_TIME=Chinese (Simplified)_China.936    
            
            attached base packages:
            [1] stats     graphics  grDevices utils     datasets  methods   base     
            
            loaded via a namespace (and not attached):
            [1] compiler_3.5.0 tools_3.5.0    tinytex_0.5  

            Linux 即带 TinyTeX 的 rocker 镜像

            sessionInfo()
            R version 3.4.4 (2018-03-15)
            Platform: x86_64-pc-linux-gnu (64-bit)
            Running under: Debian GNU/Linux 9 (stretch)
            
            Matrix products: default
            BLAS: /usr/lib/openblas-base/libblas.so.3
            LAPACK: /usr/lib/libopenblasp-r0.2.19.so
            
            locale:
             [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
             [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C             
             [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
            [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
            
            attached base packages:
            [1] stats     graphics  grDevices utils     datasets  methods   base     
            
            loaded via a namespace (and not attached):
            [1] compiler_3.4.4 tools_3.4.4    yaml_2.1.18   

            吊诡的是 tlmgr update --self --all 竟然不能升级,虽然能更新包管理器和 TeX 包,目前的方案是,如果 执行tlmgr_upgrade 就根据系统类型下载 update-tlmgr-latest.sh (update-tlmgr-latest.exe),并执行

              Cloud2016 算了,我看官方的描述如此复杂以及强烈不推荐升级,那还是按官方说的删了重装新的好了,反正就是几分钟的事儿。

              tinytex::uninstall_tinytex()
              tinytex::install_tinytex()

              另外,官方文档中已经没有 update-tlmgr-latest.exe 了。

                yihui <https://tug.org/texlive/upgrade.html> 这里的指南是给 TeX Live 2017 to 2018,所以搞得那么复杂,我是意识到 TinyTeX 不像 TeXLive 有版本号(比如 2017,2018等年份),升级过程其实是简化成两行了(如果用管道就是一行)

                wget http://mirrors.rit.edu/CTAN/systems/texlive/tlnet/update-tlmgr-latest.sh
                sudo sh update-tlmgr-latest.sh  -- --upgrade

                其中 <http://mirrors.rit.edu/CTAN/> 可以拿离自己最近的镜像站代替如 <https://mirrors.tuna.tsinghua.edu.cn/CTAN/>

                类似地,Windows 下

                wget http://mirrors.rit.edu/CTAN/systems/texlive/tlnet/update-tlmgr-latest.exe
                update-tlmgr-latest.exe  -- --upgrade 

                exe 文件是有的,打开 <http://mirrors.rit.edu/CTAN/systems/texlive/tlnet/> 可以看到

                最后,卸载重装的办法,主要是我嫌麻烦,之前装过的又得再装一遍,另一方面不全记得装过哪些包。幸好 rmarkdown 具有自动安装缺失包的特点,基本解决了重装带来的后遗症。

                  Cloud2016 官方升级文档中没有提 Windows 下的 exe 程序,既然他们没提,我觉得还是不要用的好,尽管你能从他们的老坟里把这个文件刨出来。

                  现有的 LaTeX 包可以用 tinytex::tl_pkgs() 提取;我刚提交了一个新的函数让你能自动重装当前装好的包。

                  devtools::install_github('yihui/tinytex')
                  tinytex::reinstall_tinytex()
                    4 个月 后

                    搬了新家,有了新电脑,发现装不上 TinyTeX ? 求助。

                    故障简述(完整详细信息附后)

                    1. tinytex::install_tinytex(),主要的故障信息是:
                       'query_ctan_mirror: Programs not set up, trying wget
                        cannot contact mirror.ctan.org, returning a backbone server!
                    2. 怀疑是网络问题,于是安装 prebuilt 版,tinytex:::install_prebuilt(),成功。
                    3. 但是,在用bookdown 编译一份中文文档时,需要用到 ctexbook.cls,貌似 tlmgr search 查找这个文件时失败。很多 .exe 文件无法正常工作。编译失败。
                    ! LaTeX Error: File `ctexbook.cls' not found.
                    1. 无奈下,去 texlive 官网 下载 texlive 的安装包,但是安装居然失败:运行 'install-tl-windows.bat',死在了 perl.exe这一步:'perl.exe has stopped working'。安装失败。
                    2. 于是重新操起旧工具:下载安装 CTeX。倒是安装成功了,但是编译中文文档仍然出错。我想起旧电脑是对所有宏包升了级的,于是去 MiKTeX 的升级管理器里升级,但是怪事发生了:每升级几个包,就会中断退出,错误信息是 'unsupported protocal'。
                    3. 最后,我去 MiKTeX 官网下载了最新的 MiKTeX 并安装,然后安装了 xetex 相关的几个包,才算是解决了问题。

                    综上,TinyTeX、TeXLive、CTeX 三者的安装目前我都遇见了故障。注意力有点分散。虽然最后能用了,但是还是希望集中解决 TinyTeX 自身的安装问题,以及 TinyTeX 对缺失宏包的安装问题。哪位能帮忙看看?多谢啦!

                    完整详细信息

                    > devtools::session_info()
                    Session info --------------------------------------------------------------------------------------------------------
                     setting  value                                              
                     version  R version 3.5.1 (2018-07-02)                       
                     system   x86_64, mingw32                                    
                     ui       RStudio (1.1.456)                                  
                     language (EN)                                               
                     collate  Chinese (Simplified)_People's Republic of China.936
                     tz       Europe/Berlin                                      
                     date     2018-09-10                                         
                    
                    Packages ------------------------------------------------------------------------------------------------------------
                     package   * version date       source                        
                     backports   1.1.2   2017-12-13 CRAN (R 3.5.0)                
                     base      * 3.5.1   2018-07-02 local                         
                     compiler    3.5.1   2018-07-02 local                         
                     datasets  * 3.5.1   2018-07-02 local                         
                     devtools    1.13.6  2018-06-27 CRAN (R 3.5.1)                
                     digest      0.6.16  2018-08-22 CRAN (R 3.5.1)                
                     evaluate    0.11    2018-07-17 CRAN (R 3.5.1)                
                     graphics  * 3.5.1   2018-07-02 local                         
                     grDevices * 3.5.1   2018-07-02 local                         
                     htmltools   0.3.6   2017-04-28 CRAN (R 3.5.1)                
                     knitr       1.20    2018-02-20 CRAN (R 3.5.1)                
                     magrittr    1.5     2014-11-22 CRAN (R 3.5.1)                
                     memoise     1.1.0   2017-04-21 CRAN (R 3.5.1)                
                     methods   * 3.5.1   2018-07-02 local                         
                     Rcpp        0.12.18 2018-07-23 CRAN (R 3.5.1)                
                     rmarkdown   1.10    2018-06-11 CRAN (R 3.5.1)                
                     rprojroot   1.3-2   2018-01-03 CRAN (R 3.5.1)                
                     stats     * 3.5.1   2018-07-02 local                         
                     stringi     1.1.7   2018-03-12 CRAN (R 3.5.0)                
                     stringr     1.3.1   2018-05-10 CRAN (R 3.5.1)                
                     tinytex     0.8.1   2018-09-09 Github (yihui/tinytex@e5c65c5)
                     tools       3.5.1   2018-07-02 local                         
                     utils     * 3.5.1   2018-07-02 local                         
                     withr       2.1.2   2018-03-15 CRAN (R 3.5.1)                
                     xfun        0.3     2018-07-06 CRAN (R 3.5.1)                
                     yaml        2.2.0   2018-07-25 CRAN (R 3.5.1)      

                    > tinytex::install_tinytex()
                    trying URL 'http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip'
                    Content length 355 bytes
                    trying URL 'https://github.com/yihui/tinytex/raw/master/tools/pkgs-custom.txt'
                    Content length 142 bytes
                    downloaded 275 bytes
                    
                    trying URL 'https://github.com/yihui/tinytex/raw/master/tools/texlive.profile'
                    Content length 142 bytes
                    downloaded 295 bytes
                    
                    Starting to install TinyTeX to C:\Users\PengZhao\AppData\Roaming/TinyTeX. It will take a few minutes.
                    PATH=C:\Users\PengZhao\AppData\Local\Temp\RtmpeYk32F\install-tl-20180909\tlpkg\tlperl\bin;d:\Program Files\R\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Users\PengZhao\AppData\Local\GitHubDesktop\app-1.3.4\resources\app\git\cmd\;D:\Program Files\python364\Scripts\;D:\Program Files\python364\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\PengZhao\AppData\Local\GitHubDesktop\bin;D:\Program Files\CTEX\UserData\miktex/bin\;C:\Users\PengZhao\AppData\Roaming\TinyTeX\bin\win32;d:\Program Files\wget;C:\Windows\System32\WindowsPowerShell\v1.0\
                    "C:\Users\PengZhao\AppData\Local\Temp\RtmpeYk32F\install-tl-20180909\install-tl" -profile=../texlive.profile
                    Use of uninitialized value $ver in scalar chomp at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLWinGoo.pm line 204.
                    Use of uninitialized value $ver in substitution (s///) at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLWinGoo.pm line 205.
                    Use of uninitialized value $ver in substitution (s///) at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLWinGoo.pm line 205.
                    Automated TeX Live installation using profile: ../texlive.profile
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up tar with C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/installer/tar.exe as C:\Users\PengZhao\AppData\Local\Temp\RtmpeYk32F\install-tl-20180909\tlpkg\installer\tar.exe didn't work
                    GNU tar 1.11.8 + 2.2(WIN32)
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up wget with C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/installer/wget/wget.exe as C:\Users\PengZhao\AppData\Local\Temp\RtmpeYk32F\install-tl-20180909\tlpkg\installer\wget\wget.exe didn't work
                    GNU Wget 1.19.1 built on mingw32.
                    
                    -cares +digest -gpgme +https +ipv6 -iri +large-file -metalink -nls 
                    -ntlm +opie -psl +ssl/gnutls 
                    
                    Wgetrc: 
                        C:/usr/anothermsys/local/etc/wgetrc (system)
                    Compile: 
                        gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc" 
                        -DLOCALEDIR="/usr/local/share/locale" -I. -I../lib -I../lib 
                        -I/usr/local/include -DNDEBUG -static 
                    Link: 
                        gcc -DNDEBUG -static /usr/local/lib/libgnutls.a -lz -lws2_32 
                        /usr/local/lib/libnettle.a /usr/local/lib/libhogweed.a 
                        /usr/local/lib/libgmp.a -lcrypt32 -lz -lws2_32 ftp-opie.o 
                        mswindows.o gnutls.o ../lib/libgnu.a -lws2_32 -lws2_32 -lws2_32 
                        -lws2_32 /usr/local/lib/libiconv.a -lws2_32 
                    
                    Copyright (C) 2015 Free Software Foundation, Inc.
                    License GPLv3+: GNU GPL version 3 or later
                    <http://www.gnu.org/licenses/gpl.html>.
                    This is free software: you are free to change and redistribute it.
                    There is NO WARRANTY, to the extent permitted by law.
                    
                    Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
                    Please send bug reports and questions to <bug-wget@gnu.org>.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up xz with C:/Users/PengZhao/AppData/Local/Temp/RtmpeYk32F/install-tl-20180909/tlpkg/installer/xz/xz.exe as C:\Users\PengZhao\AppData\Local\Temp\RtmpeYk32F\install-tl-20180909\tlpkg\installer\xz\xz.exe didn't work
                    xz (XZ Utils) 5.2.3
                    liblzma 5.2.3
                    query_ctan_mirror: Programs not set up, trying wget
                    cannot contact mirror.ctan.org, returning a backbone server!
                    C:\Users\PengZhao\AppData\Local\Temp\RtmpeYk32F\install-tl-20180909\install-tl: TLPDB::from_file could not download http://www.tex.ac.uk/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb;
                    C:\Users\PengZhao\AppData\Local\Temp\RtmpeYk32F\install-tl-20180909\install-tl: maybe the repository setting should be changed.
                    Loading http://www.tex.ac.uk/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb
                    TinyTeX installed to C:\Users\PengZhao\AppData\Roaming/TinyTeX
                    Please restart your R session and IDE (if you are using one, such as RStudio or Emacs) and check if tinytex:::is_tinytex() is TRUE.
                    Warning message:
                    In file.remove("TinyTeX/install-tl.log") :
                      cannot remove file 'TinyTeX/install-tl.log', reason 'No such file or directory'

                    > tinytex:::install_prebuilt()
                    trying URL 'https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.zip'
                     length 93989978 bytes (89.6 MB)
                    downloaded 89.6 MB
                    
                    tlmgr path add
                    Use of uninitialized value $ver in scalar chomp at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLWinGoo.pm line 204.
                    Use of uninitialized value $ver in substitution (s///) at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLWinGoo.pm line 205.
                    Use of uninitialized value $ver in substitution (s///) at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLWinGoo.pm line 205.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up tar with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/tar.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\tar.exe didn't work
                    GNU tar 1.11.8 + 2.2(WIN32)
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up wget with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/wget/wget.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\wget\wget.exe didn't work
                    GNU Wget 1.19.1 built on mingw32.
                    
                    -cares +digest -gpgme +https +ipv6 -iri +large-file -metalink -nls 
                    -ntlm +opie -psl +ssl/gnutls 
                    
                    Wgetrc: 
                        C:/usr/anothermsys/local/etc/wgetrc (system)
                    Compile: 
                        gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc" 
                        -DLOCALEDIR="/usr/local/share/locale" -I. -I../lib -I../lib 
                        -I/usr/local/include -DNDEBUG -static 
                    Link: 
                        gcc -DNDEBUG -static /usr/local/lib/libgnutls.a -lz -lws2_32 
                        /usr/local/lib/libnettle.a /usr/local/lib/libhogweed.a 
                        /usr/local/lib/libgmp.a -lcrypt32 -lz -lws2_32 ftp-opie.o 
                        mswindows.o gnutls.o ../lib/libgnu.a -lws2_32 -lws2_32 -lws2_32 
                        -lws2_32 /usr/local/lib/libiconv.a -lws2_32 
                    
                    Copyright (C) 2015 Free Software Foundation, Inc.
                    License GPLv3+: GNU GPL version 3 or later
                    <http://www.gnu.org/licenses/gpl.html>.
                    This is free software: you are free to change and redistribute it.
                    There is NO WARRANTY, to the extent permitted by law.
                    
                    Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
                    Please send bug reports and questions to <bug-wget@gnu.org>.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up lz4 with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/lz4/lz4.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\lz4\lz4.exe didn't work
                    *** LZ4 command line interface 32-bits v1.8.2, by Yann Collet ***
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up xz with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/xz/xz.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\xz\xz.exe didn't work
                    xz (XZ Utils) 5.2.3
                    liblzma 5.2.3
                    Use of uninitialized value in bitwise or (|) at C:\Users\PengZhao\AppData\Roaming\TinyTeX\texmf-dist\scripts\texlive\tlmgr.pl line 1482.
                    texhash: Updating C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-local/ls-R...
                    texhash: Updated C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-local/ls-R.
                    texhash: Updating C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-config/ls-R...
                    texhash: Updated C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-config/ls-R.
                    texhash: Updating C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-var/ls-R...
                    texhash: Updated C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-var/ls-R.
                    texhash: Updating C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-dist/ls-R...
                    texhash: Updated C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-dist/ls-R.
                    texhash: Done.
                    ...PengZhao\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:824: ...PengZhao\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:779: no appropriate script or program found: fmtuti~1
                    ...PengZhao\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:824: ...PengZhao\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:779: no appropriate script or program found: updmap~1
                    Note that it needs some time to create caches,
                    especially if there are many large font files.
                    Wait with patience.
                    
                    C:/windows/fonts: caching, new cache contents: 1063 fonts, 0 dirs
                    C:/Users/appveyor/AppData/Roaming/TinyTeX/texmf-dist/fonts/opentype: skipping, no such directory
                    C:/Users/appveyor/AppData/Roaming/TinyTeX/texmf-dist/fonts/truetype: skipping, no such directory
                    C:/Users/PengZhao/AppData/Roaming/TinyTeX/texmf-var/fonts/cache: cleaning cache directory
                    C:\Users\PengZhao\AppData\Roaming\TinyTeX\bin\win32\fc-cache.exe: succeeded

                    > tinytex::tlmgr_search('ctexbook.cls')
                    tlmgr search --file --global "ctexbook.cls"
                    Use of uninitialized value $ver in scalar chomp at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLWinGoo.pm line 204.
                    Use of uninitialized value $ver in substitution (s///) at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLWinGoo.pm line 205.
                    Use of uninitialized value $ver in substitution (s///) at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLWinGoo.pm line 205.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up tar with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/tar.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\tar.exe didn't work
                    GNU tar 1.11.8 + 2.2(WIN32)
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up wget with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/wget/wget.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\wget\wget.exe didn't work
                    GNU Wget 1.19.1 built on mingw32.
                    
                    -cares +digest -gpgme +https +ipv6 -iri +large-file -metalink -nls 
                    -ntlm +opie -psl +ssl/gnutls 
                    
                    Wgetrc: 
                        C:/usr/anothermsys/local/etc/wgetrc (system)
                    Compile: 
                        gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc" 
                        -DLOCALEDIR="/usr/local/share/locale" -I. -I../lib -I../lib 
                        -I/usr/local/include -DNDEBUG -static 
                    Link: 
                        gcc -DNDEBUG -static /usr/local/lib/libgnutls.a -lz -lws2_32 
                        /usr/local/lib/libnettle.a /usr/local/lib/libhogweed.a 
                        /usr/local/lib/libgmp.a -lcrypt32 -lz -lws2_32 ftp-opie.o 
                        mswindows.o gnutls.o ../lib/libgnu.a -lws2_32 -lws2_32 -lws2_32 
                        -lws2_32 /usr/local/lib/libiconv.a -lws2_32 
                    
                    Copyright (C) 2015 Free Software Foundation, Inc.
                    License GPLv3+: GNU GPL version 3 or later
                    <http://www.gnu.org/licenses/gpl.html>.
                    This is free software: you are free to change and redistribute it.
                    There is NO WARRANTY, to the extent permitted by law.
                    
                    Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
                    Please send bug reports and questions to <bug-wget@gnu.org>.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up lz4 with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/lz4/lz4.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\lz4\lz4.exe didn't work
                    *** LZ4 command line interface 32-bits v1.8.2, by Yann Collet ***
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2464.
                    Can't spawn "cmd.exe": No such file or directory at C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/TeXLive/TLUtils.pm line 2481.
                    Setting up xz with C:/Users/PengZhao/AppData/Roaming/TinyTeX/tlpkg/installer/xz/xz.exe as C:\Users\PengZhao\AppData\Roaming\TinyTeX\tlpkg\installer\xz\xz.exe didn't work
                    xz (XZ Utils) 5.2.3
                    liblzma 5.2.3
                    tlmgr.pl: package repository http://mirror.las.iastate.edu/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
                    ctex:
                    	texmf-dist/tex/latex/ctex/ctexbook.cls

                      dapengde 这我也不知道是怎么回事。我在云端设置了每天自动编译一遍,但并没有发现最近几天有失败的记录:https://ci.appveyor.com/project/yihui/tinytex/history 我刚在自己的 Windows 上试了一下,也可以成功安装。可能是临时的网络问题,或者是开发者恰好在某个时段把什么东西搞砸了?

                        yihui 最近几天我在不同的时段和不同的网络环境(家,办公室)试过多次,都失败。我觉得可能是我新电脑的问题,怀疑是哪个端口被什么东西屏蔽了。改天换台电脑试试。

                        网上搜 'cannot contact mirror.ctan.org, returning a backbone server!',得到一大堆结果,但是没有发现好用的办法。累觉不爱,暂用 MiKTeX 了。

                        yihui 经过了多种努力,终于从这个安装失败的坑里爬出来了!

                        解决方法很简单: windows 操作系统的环境变量里添加 PATH:c:\Windows\System32?

                        操作系统是 windows 7。

                        故障原因,我猜可能是某次折腾时某个软件把这个路径环境变量里覆盖了。

                        网上提供的多个解决办法,例如安装 strawberryperl,例如查看防火墙或杀毒软件是不是在作祟……这些都不是我这次故障的原因。

                        现在,TinyTex 成功安装了。不过,新问题来了:

                        我参加 bookdown 大赛制作的两个中文模板(北京大学学位论文中科院大学学位论文),都无法编译成 pdf。后者说是 \CJKunderlinecolor undefined.。前者比较诡异,没有任何故障信息,貌似成功编译了,但就是没有生成 pdf 文件。

                        此外,我在编译一个英文的 bookdown 项目时,通过点击 RStudio 的 build 按钮,第一次生成的 pdf 里的参考文献都显示的是问号。后来重新编译一次就好了。

                        为了对比,我卸载了 TinyTeX,安装 MikTeX,升级到最新,安装 xetex 宏包和 pkuthss 包,然后编译 上面说的两个中文 bookdown 项目,都成功了。这是不是因为 MikTeX 里有些包在 TeX Live 里不存在?

                          dapengde 我暂时没空检查这个问题。先看别的壮士(如 @Cloud2016 @yufree @tctcab 等)是否可以重现你的问题吧,如果问题在别人那里也可以重现,我再研究一下。

                          还有,你这 c:\Windows\System32 坑太深了。