错误的包目录(/usr/share/ 而不是 /usr/local)

错误的包目录(/usr/share/ 而不是 /usr/local)

升级到 Ubuntu 19.10 并更新到 Texlive 2019 后,我遇到了错误,大概是因为latex(或者具体来说lualatex)没有选择我的/usr/local/,而是运行了/usr/share/。有什么建议可能出了什么问题以及如何解决这个问题?谢谢 :)

以此文件为例:

\documentclass{article}

\usepackage{hyperref}
\usepackage{xcolor}

\begin{document}

Plain text.

\href{https://tex.stackexchange.com/}{Link text}.

\textcolor{red}{Red text}

\end{document}

如果我lualatex在其上运行(在 emacs 中),我会收到以下有关未找到 lualatex 和 xcolor 的错误,但是不是超链接:

ERROR: module 'luaotfload-main' not found:

--- TeX said ---
    no field package.preload['luaotfload-main']
    [kpse lua searcher] file not found: 'luaotfload-main'
    [kpse C searcher] file not found: 'luaotfload-main'
Error in luaotfload: reverting to OT1
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
(/usr/share/texmf/tex/latex/lm/ot1lmr.fd)))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/share/texlive/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))

! LaTeX Error: File `xcolor.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
./test.tex:6: Emergency stop.

而 则hyperref.sty位于 和 之中/usr/local//usr/share/luaotfload-mainxcolor.sty存在于 之中 /usr/share/

/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.st

/usr/local/texlive/2018/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex
/usr/local/texlive/2018/texmf-dist/tex/luatex/luaotfload/luaotfload-main.lua
/usr/local/texlive/2019/texmf-dist/doc/luatex/luaotfload/luaotfload-main.tex
/usr/local/texlive/2019/texmf-dist/tex/luatex/luaotfload/luaotfload-main.lua

/usr/local/texlive/2018/texmf-dist/tex/latex/xcolor/xcolor.sty
/usr/local/texlive/2019/texmf-dist/tex/latex/xcolor/xcolor.sty

答案1

感谢@PaulGaborit 为我回答这个问题。

我需要在我的 ~/.profile 中添加以下内容:

PATH="/usr/local/texlive/2019/bin/x86_64-linux:$PATH"

然后我运行source ~/.profile,但为了让 emacs 获取更新的 PATH 变量,我必须重新启动计算机。

然后一切就正常了:)

另外:要为系统上的所有用户添加此路径,请参阅@PaulGaborit 的评论。

相关内容