运行 tinytex::install_tinytex() 报错
- 已编辑
Year 可否请你帮忙再测试一下下面的代码告诉我结果:
# 测试解压缩 zip 文件
unlink('TinyTeX.zip')
tinytex:::download_installer('TinyTeX.zip')
str(unzip('TinyTeX.zip'))
list.files('TinyTeX')
# 测试解压缩 tar.gz 文件
tinytex:::download_installer('TinyTeX.tar.gz')
str(untar('TinyTeX.tar.gz'))
list.files('.TinyTeX')
# 清理解压缩文件
unlink(c('TinyTeX', '.TinyTeX', 'TinyTeX.zip', 'TinyTeX.tar.gz'), recursive = TRUE)
如果 untar()
能成功的话,那我可以考虑为 Windows 用户提供 tar.gz 格式的安装包。谢谢!
Year 我已经调整了链接(不再访问 Github 地址),你现在用 tinytex::install_tinytex()
应该可以成功安装了。
- 已编辑
先把结果贴上来,回头我有空的时候整理下。
注:两个包我都是下载软件下载的。其中TinyTeX.zip是155M,TinyTeX.tar.gz是124M。
tinytex:::download_installer('TinyTeX.zip')
trying URL 'https://yihui.org/tinytex/TinyTeX.zip'
str(unzip('C:/Users/cxy/Desktop/test/TinyTeX.zip'))
chr [1:16083] "./TinyTeX/install-tl" "./TinyTeX/install-tl-windows.bat" ...
list.files('TinyTeX')
[1] "bin" "install-tl" "install-tl-windows.bat"
[4] "LICENSE.CTAN" "LICENSE.TL" "release-texlive.txt"
[7] "texmf-config" "texmf-dist" "texmf-local"
[10] "texmf-var" "texmf.cnf" "texmfcnf.lua"
[13] "tl-tray-menu.exe" "tlpkg"
tinytex:::download_installer('TinyTeX.tar.gz')
trying URL 'https://yihui.org/tinytex/TinyTeX.tar.gz'
str(untar('C:/Users/cxy/Desktop/test/TinyTeX.tar.gz'))
/Rtools/bin/tar: .TinyTeX/texmf-var/fonts/map/dvips/updmap/psfonts.map: Cannot create symlink to
'psfonts_t1.map': No such file or directory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/extractbb: Cannot create symlink to 'xdvipdfmx': No such file ordirectory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/texlua: Cannot create symlink to 'luatex': No such file or directory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/dvipdfm: Cannot create symlink to 'xdvipdfmx': No such file ordirectory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/texluac: Cannot create symlink to 'luatex': No such file ordirectory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/lualatex: Cannot create symlink to 'luahbtex': No such file ordirectory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/texhash: Cannot create symlink to 'mktexlsr': No such file ordirectory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/inimf: Cannot create symlink to 'mf': No such file or directory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/mktexfmt: Cannot create symlink to 'fmtutil': No such file ordirectory
/Rtools/bin/tar: .TinyTeX/bin/x86_64-linux/man: Cannot create symlink to '../../texmf-dist/doc/man': No suchfile or directory
/Rtools/bin/tar: Exiting with failure status due to previous errors
int 2
Warning message:
In untar("C:/Users/cxy/Desktop/test/TinyTeX.tar.gz") :
‘tar.exe -xf "C:/Users/cxy/Desktop/test/TinyTeX.tar.gz"’ returned error code 2
list.files('.TinyTeX')
[1] "bin" "install-tl" "LICENSE.CTAN"
[4] "LICENSE.TL" "release-texlive.txt" "texmf-config"
[7] "texmf-dist" "texmf-local" "texmf-var"
[10] "texmf.cnf" "texmfcnf.lua" "tlpkg"
- 已编辑
tinytex::install_tinytex()确实舒服多了。安装过程中弹出一个信息框,说可能有两个地方报错,但是可以忽略。
注:我之前安装latex包的时候设置镜像为华中科技大学的镜像。
测试结果
tinytex::install_tinytex()
tlmgr revision 54446 (2020-03-21 17:45:22 +0100)
tlmgr using installation: C:/Users/cxy/AppData/Roaming/TinyTeX
TeX Live (https://tug.org/texlive) version 2020
trying URL 'http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip'
Content length 339 bytes
downloaded 23.1 MBtrying URL 'https://yihui.org/gh/tinytex/tools/pkgs-custom.txt'
Content length 57 bytes
downloaded 547 bytestrying URL 'https://yihui.org/gh/tinytex/tools/tinytex.profile'
Content length 57 bytes
downloaded 183 bytesStarting to install TinyTeX to C:\Users\cxy\AppData\Roaming/TinyTeX. It will take a few minutes.
Automated TeX Live installation using profile: ../tinytex.profile
Loading http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb
Installing TeX Live 2020 from: http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet (not verified)
Platform: win32 => 'Windows'
Distribution: net (downloading)
Using URL: http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet
Directory for temporary files: C:\Users\cxy\AppData\Local\Temp\Krel1rQotS
Installing to: ./TinyTeX/
Installing [01/10, time/total: ??:??/??:??]: texlive.infra [221k]
Installing [02/10, time/total: 00:24/31:09]: texlive.infra.win32 [1397k]
Installing [03/10, time/total: 00:49/08:41]: tlperl.win32 [6816k]
Installing [04/10, time/total: 02:20/04:45]: hyphen-base [22k]
Installing [05/10, time/total: 02:42/05:29]: kpathsea [32k]
Installing [06/10, time/total: 03:07/06:19]: kpathsea.win32 [476k]
Installing [07/10, time/total: 04:58/09:32]: texlive-scripts [130k]
Installing [08/10, time/total: 05:00/09:27]: texlive-scripts.win32 [36k]
Installing [09/10, time/total: 05:59/11:17]: tlgs.win32 [6674k]
Installing [10/10, time/total: 07:18/07:57]: tlpsv.win32 [1411k]
Time used for installing the packages: 08:16
running mktexlsr ./TinyTeX/texmf-dist ...
mktexlsr: Updating ./TinyTeX/texmf-dist/ls-R...
mktexlsr: Updated ./TinyTeX/texmf-dist/ls-R.
mktexlsr: Done.
writing fmtutil.cnf to ./TinyTeX/texmf-dist/web2c/fmtutil.cnf
writing updmap.cfg to ./TinyTeX/texmf-dist/web2c/updmap.cfg
writing language.dat to ./TinyTeX/texmf-var/tex/generic/config/language.dat
writing language.def to ./TinyTeX/texmf-var/tex/generic/config/language.def
writing language.dat.lua to ./TinyTeX/texmf-var/tex/generic/config/language.dat.lua
running mktexlsr ./TinyTeX/texmf-var ./TinyTeX/texmf-config ./TinyTeX/texmf-dist ...
mktexlsr: Updating ./TinyTeX/texmf-var/ls-R...
mktexlsr: Updated ./TinyTeX/texmf-var/ls-R.
Cannot open ./TinyTeX/texmf-config/ls-R to write.
Cannot open ./TinyTeX/texmf-dist/ls-R to write.
mktexlsr: Done.
running updmap-sys --nohash ...C:\Users\cxy\AppData\Local\Temp\RtmpwhjEuQ\install-tl-20200520\install-tl: updmap-sys --nohash failed (status 53):
failed
re-running mktexlsr ./TinyTeX/texmf-var ./TinyTeX/texmf-config ...
mktexlsr: Updating ./TinyTeX/texmf-var/ls-R...
mktexlsr: Updated ./TinyTeX/texmf-var/ls-R.
Cannot open ./TinyTeX/texmf-config/ls-R to write.
mktexlsr: Done.
pre-generating all format files, be patient...
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-strict --all ...C:\Users\cxy\AppData\Local\Temp\RtmpwhjEuQ\install-tl-20200520\install-tl: fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-strict --all failed (status 53):C:\Users\cxy\AppData\Local\Temp\RtmpwhjEuQ\install-tl-20200520\install-tl: errors in installation reported above
Summary of warnings:
C:\Users\cxy\AppData\Local\Temp\RtmpwhjEuQ\install-tl-20200520\install-tl: updmap-sys --nohash failed (status 53):
C:\Users\cxy\AppData\Local\Temp\RtmpwhjEuQ\install-tl-20200520\install-tl: fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-strict --all failed (status 53):
The following environment variables contain the string "tex"
(case-independent). If you're doing anything but adding personal
directories to the system paths, they may well cause trouble somewhere
while running TeX. If you encounter problems, try unsetting them.
Please ignore spurious matches unrelated to TeX.II=C:\Users\cxy\AppData\Roaming\TinyTeX\bin\win32
failed
running package-specific postactions
finished with package-specific postactionsWelcome to TeX Live!
See ./TinyTeX//index.html for links to documentation.
The TeX Live web site (https://tug.org/texlive/) contains any updates and
corrections. TeX Live is a joint project of the TeX user groups around the
world; please consider supporting it by joining the group best for you. The
list of groups is available on the web at https://tug.org/usergroups.html.
Logfile: ./TinyTeX/install-tl.log
tlmgr.pl: package repository http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet (not verified: gpg unavailable)
[1/103, ??:??/??:??] install: amsfonts [3542k]
[2/103, 00:40/06:53] install: amsmath [30k]
[3/103, 00:40/06:49] install: atbegshi [5k]
[4/103, 00:41/06:59] install: atveryend [4k]
[5/103, 00:41/06:58] install: auxhook [2k]
[6/103, 00:41/06:58] install: babel [162k]
[7/103, 00:45/07:19] install: bibtex.win32 [41k]
[8/103, 00:46/07:24] install: bibtex [15k]
[9/103, 00:46/07:22] install: bigintcalc [7k]
[10/103, 00:47/07:31] install: bitset [6k]
[11/103, 00:47/07:31] install: booktabs [3k]
[12/103, 00:47/07:30] install: cm [233k]
[13/103, 00:50/07:32] install: dehyph [46k]
[14/103, 00:53/07:53] install: dvipdfmx.win32 [315k]
[15/103, 00:55/07:36] install: dvipdfmx [27k]
[16/103, 00:56/07:42] install: dvips.win32 [92k]
[17/103, 00:57/07:40] install: dvips [57k]
[18/103, 00:57/07:35] install: ec [258k]
[19/103, 01:03/07:56] install: epstopdf-pkg [5k]
[20/103, 01:09/08:41] install: etex [12k]
[21/103, 01:11/08:55] install: etexcmds [3k]
[22/103, 01:15/09:25] install: etoolbox [9k]
[23/103, 01:15/09:24] install: euenc [4k]
[24/103, 01:15/09:23] install: fancyvrb [12k]
[25/103, 01:16/09:29] install: filehook [5k]
[26/103, 01:16/09:29] install: float [3k]
[27/103, 01:16/09:29] install: fontspec [27k]
[28/103, 01:16/09:26] install: framed [8k]
[29/103, 01:17/09:32] install: geometry [9k]
[30/103, 01:17/09:31] install: gettitlestring [3k]
[31/103, 01:17/09:31] install: glyphlist [25k]
[32/103, 01:18/09:35] install: graphics [15k]
[33/103, 01:18/09:34] install: graphics-cfg [2k]
[34/103, 01:18/09:34] install: graphics-def [10k]
[35/103, 01:18/09:32] install: grffile [4k]
[36/103, 01:19/09:39] install: helvetic [527k]
[37/103, 01:21/08:57] install: hycolor [4k]
[38/103, 01:22/09:03] install: hyperref [96k]
[39/103, 01:22/08:54] install: hyph-utf8 [16k]
[40/103, 01:23/08:59] install: iftex [3k]
[41/103, 01:31/09:51] install: inconsolata [293k]
[42/103, 01:34/09:40] install: infwarerr [3k]
[43/103, 01:35/09:46] install: intcalc [6k]
[44/103, 01:35/09:46] install: knuth-lib [30k]
[45/103, 01:36/09:49] install: kvdefinekeys [3k]
[46/103, 01:36/09:49] install: kvoptions [7k]
[47/103, 01:36/09:48] install: kvsetkeys [4k]
[48/103, 01:36/09:48] install: l3backend [12k]
[49/103, 01:37/09:52] install: l3kernel [150k]
[50/103, 01:37/09:38] install: l3packages [21k]
[51/103, 01:38/09:42] install: latex [165k]
[52/103, 01:39/09:33] install: latex-amsmath-dev [30k]
[53/103, 01:40/09:36] install: latex-bin.win32 [1k]
[54/103, 01:40/09:36] install: latex-bin [1k]
[55/103, 01:40/09:36] install: latex-fonts [18k]
[56/103, 01:41/09:40] install: latex-tools-dev [35k]
[57/103, 01:41/09:37] install: latexconfig [4k]
[58/103, 01:42/09:42] install: latexmk.win32 [1k]
[59/103, 01:42/09:42] install: latexmk [92k]
[60/103, 01:42/09:34] install: letltxmacro [3k]
[61/103, 01:43/09:39] install: lm [11665k]
[62/103, 02:10/04:21] install: lm-math [369k]
[63/103, 02:22/04:40] install: ltxcmds [5k]
[64/103, 02:22/04:40] install: luahbtex.win32 [1515k]
[65/103, 02:25/04:24] install: luahbtex [1k]
[66/103, 02:25/04:24] install: lualatex-math [4k]
[67/103, 02:26/04:26] install: lualibs [119k]
[68/103, 02:26/04:24] install: luaotfload.win32 [1k]
[69/103, 02:27/04:26] install: luaotfload [572k]
[70/103, 02:29/04:22] install: luatex.win32 [1780k]
[71/103, 02:36/04:13] install: luatex [13k]
[72/103, 02:37/04:14] install: mdwtools [19k]
[73/103, 02:37/04:14] install: metafont.win32 [142k]
[74/103, 02:38/04:14] install: metafont [9k]
[75/103, 02:39/04:16] install: mfware.win32 [58k]
[76/103, 02:40/04:17] install: mfware [4k]
[77/103, 02:42/04:20] install: modes [27k]
[78/103, 02:43/04:21] install: natbib [17k]
[79/103, 02:43/04:21] install: pdfescape [5k]
[80/103, 02:44/04:22] install: pdftex.win32 [693k]
[81/103, 02:46/04:18] install: pdftex [37k]
[82/103, 02:47/04:19] install: pdftexcmds [7k]
[83/103, 02:47/04:19] install: plain [70k]
[84/103, 02:48/04:20] install: refcount [3k]
[85/103, 02:48/04:20] install: rerunfilecheck [4k]
[86/103, 02:48/04:20] install: stringenc [23k]
[87/103, 02:49/04:21] install: tex.win32 [130k]
[88/103, 02:50/04:21] install: tex [1k]
[89/103, 02:51/04:22] install: tex-ini-files [4k]
[90/103, 02:51/04:22] install: times [281k]
[91/103, 02:54/04:24] install: tipa [2809k]
[92/103, 03:12/04:21] install: tools [41k]
[93/103, 03:14/04:23] install: unicode-data [285k]
[94/103, 03:23/04:32] install: unicode-math [42k]
[95/103, 03:26/04:36] install: uniquecounter [3k]
[96/103, 03:26/04:36] install: url [6k]
[97/103, 03:26/04:36] install: xcolor [17k]
TLUtils::check_file: checksums differ for C:\Users\cxy\AppData\Local\Temp\bRFUs2ZeiL\rQ1LvcP4Oh/xetex.win32.tar.xz:
TLUtils::check_file: tlchecksum=0d48d24beac4105c288a564e54e9e55a3ad0252178c6171ce1db1be889aed96de1892da7933f2de66531609b66aaea36bcd7698d00a3a0a18980d87dd8addf08, arg=bd474df98c6b11e7e8c04ba93dcdec91d0cbf6e56495aa7e3fa950a7d26c8ccb8ea287bcd34e1721b1d6a33f95c786ff94fb135da5d08481478029d8c8c87f17
TLUtils::check_file: removing C:\Users\cxy\AppData\Local\Temp\bRFUs2ZeiL\rQ1LvcP4Oh/xetex.win32.tar.xz, but saving copy in C:\Users\cxy\AppData\Local\Temp\6KZiVBDa7v
TLPDB::_install_package: downloading did not succeed (check_file_and_remove failed)
[98/103, 03:27/04:37] install: xetex.win32 [9216k]
[99/103, 05:18/05:18] install: xetex [7k]
复制了 3 个文件
复制了 1 个文件
Running fc-cache -v -r
[100/103, 06:32/06:32] install: xetexconfig [1k]
[101/103, 06:33/06:33] install: xkeyval [13k]
[102/103, 06:34/06:34] install: xunicode [26k]
[103/103, 07:04/07:04] install: zapfding [46k]
running mktexlsr ...
done running mktexlsr.
running updmap-sys ...
done running updmap-sys.
regenerating fmtutil.cnf in C:/Users/cxy/AppData/Roaming/TinyTeX/texmf-dist
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine pdftex ...
done running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine pdftex.
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine tex ...
done running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine tex.
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine luatex ...
done running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine luatex.
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine xetex ...
done running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine xetex.
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine luahbtex ...
done running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-error-if-no-format --byengine luahbtex.
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --byfmt mf ...
done running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --byfmt mf.
tlmgr.pl: package log updated: C:/Users/cxy/AppData/Roaming/TinyTeX/texmf-var/web2c/tlmgr.log
Use of uninitialized value in bitwise or (|) at C:\Users\cxy\AppData\Roaming\TinyTeX\texmf-dist\scripts\texlive\tlmgr.pl line 1497.
Please quit and reopen your R session and IDE (if you are using one, such as RStudio or Emacs) and check if tinytex:::is_tinytex() is TRUE.
系统环境
R version 3.6.3 (2020-02-29)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3 yaml_2.2.1 tinytex_0.23 xfun_0.14
- 已编辑
yihui tinytex::install_tinytex()
函数是否可以增加一个参数,让用户可以设置国内镜像,比如我想从清华大学的镜像下载,那么我希望命令是如下这般:
tinytex::install_tinytex(repos = "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet")
chuxinyuan 你这自己不就把答案写出来了吗?就差真的运行了。repos
参数全名 repository
,参见帮助文档 ?tinytex::install_tinytex
chuxinyuan 多谢测试!我再等一下 Year 的测试结果。
yihui 所有的安排都很舒心啊!参数没写全,用repos
竟然也能运行,赞!
chuxinyuan R 的函数参数名不用写全,R 会采用部分匹配的方式传递参数,只要你写出来的部分字符串足够匹配该函数的唯一参数,那么R 就会把值传递给那个参数。
yihui 这个比较人性的设计,受教了!
chuxinyuan 其实我并不是很喜欢这种部分匹配的功能。它走火的可能性盖过了它的便利性。最好的办法还是自动补全,敲 repos 自动补全为 repository 就好了。这种为了临时的便利性而牺牲严谨性的做法一旦出问题,查起错来会非常头疼。
老师您好,运行程序时报错,请教下原因。
install.packages('tinytex')
将程序包安装入‘C:/Users/bosha/AppData/Local/R/win-library/4.2’
(因为‘lib’没有被指定)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/tinytex_0.40.zip'
Content type 'application/zip' length 134216 bytes (131 KB)
downloaded 131 KB
程序包‘tinytex’打开成功,MD5和检查也通过
下载的二进制程序包在
C:\Users\bosha\AppData\Local\Temp\Rtmpq8xTGx\downloaded_packages里
tinytex::install_tinytex()
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 103 0 103 0 0 58 0 --:--:-- 0:00:01 --:--:-- 58
0 0 0 0 0 0 0 0 --:--:-- 0:00:22 --:--:-- 0
curl: (28) Failed to connect to github.com port 443 after 21029 ms: Timed out
Error in xfun::download_file(..., quiet = Sys.getenv("APPVEYOR") != "") :
No download method works (auto/wininet/wget/curl/lynx)
这是因为国内上不去github