我在 Linux Slackware 15.0 PC 上安装了 TeXLive 2022。安装以 root 身份完成。然后我texlive.sh
在 /etc/profile 目录中添加了一个脚本:
#!/bin/bash
export PATH=$PATH:/usr/local/texlive/2022/bin/x86_64-linux
export INFOPATH=$INFOPATH:/usr/local/texlive/2022/texmf-dist/doc/info
export MANPATH=$MANPATH:/usr/local/texlive/2022/texmf-dist/doc/man
因此系统中的每个用户都可以使用 TeXLive。但是当我以普通用户身份登录并尝试编译文件时,我收到错误:
~$ xelatex ./code.tex
This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
restricted \write18 enabled.
kpathsea: Running mktexfmt xelatex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt: /usr/local/texlive/2022/texmf-dist/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt: /root/.texlive2022/texmf-config/web2c/fmtutil.cnf
/usr/local/texlive/2022/bin/x86_64-linux/mktexfmt: mkdir(/root/.texlive2022/)
failed for tree /root/.texlive2022/texmf-var/web2c:
Permission denied at /usr/local/texlive/2022/tlpkg/TeXLive/TLUtils.pm line 1178.
I can't find the format file `xelatex.fmt'!
由于某种原因,它尝试使用/root/.texlive2022
目录但失败了。如何修复此问题?