Ubuntu 升级后,texdoc 不再起作用

Ubuntu 升级后,texdoc 不再起作用

自从我将 Ubuntu 系统升级到 18.04 后,texdoc就找不到任何东西了。

在我尝试使其工作的实验过程中,症状发生了变化:首先,它抱怨找不到某些 PDF 文件,而该文件确实不存在,但后来我安装(或重新安装,我不记得了)了包含丢失文件的包,现在texdoc对所有内容的回复都是“抱歉,未找到...的文档”:

§ texdoc algorithmicx
Sorry, no documentation found for algorithmicx.
If you are unsure about the name, try searching CTAN's TeX catalogue at
http://ctan.org/search.html#byDescription.
§ ls /usr/share/texlive/texmf-dist/doc/latex/algorithmicx/
algorithmicx.pdf  algorithmicx.tex.gz  README
§ apt list "texlive-science*"
Listing... Done
texlive-science/bionic,bionic,now 2017.20180305-2 all [installed]
texlive-science-doc/bionic,bionic,now 2017.20180305-2 all [installed]
§ texdoc -d algorithmicx
texdoc debug-version: /usr/share/texlive/texmf-dist/scripts/texdoc/texdoclib.tlu version 2.0171
texdoc debug-config: Setting 'debug_list=all' from command line option "-d".
texdoc debug-config: Setting 'viewer_pdf=(xdg-open %s) &' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 37.
texdoc debug-config: Setting 'viewer_ps=(xdg-open %s) &' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 38.
texdoc debug-config: Setting 'viewer_dvi=(xdg-open %s) &' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 39.
texdoc debug-config: Setting 'viewer_html=(xdg-open %s) &' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 40.
texdoc debug-config: Setting 'viewer_txt=(xdg-open %s) &' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 41.
texdoc debug-config: Setting 'zipext_list=gz, bz2, xz' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 70.
texdoc debug-config: Setting 'unzip_gz=gzip -d -c' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 71.
texdoc debug-config: Setting 'unzip_bz2=bzip2 -d -c' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 72.
texdoc debug-config: Setting 'unzip_xz=xz --decompress --stdout' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 73.
texdoc debug-config: Setting 'suffix_list=doc, -doc, _doc, .doc, /doc, manual, /manual, -manual, userguide, /user_guide, -guide, -user, -man, notes, -info, ref' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 98.
texdoc debug-config: Setting 'lastfile_switch=true' in file "/usr/share/texlive/texmf-dist/texdoc/texdoc.cnf" on line 502.
texdoc debug-config: Setting 'lang=en' from operating system locale.
texdoc debug-config: Setting 'badext_list=txt, ' from built-in defaults.
texdoc debug-config: Setting 'basename_list=readme, 00readme' from built-in defaults.
texdoc debug-config: Setting 'ext_list=pdf, htm, html, txt, ps, dvi, ' from built-in defaults.
texdoc debug-config: Setting 'mode=view' from built-in defaults.
texdoc debug-config: Setting 'max_lines=20' from built-in defaults.
texdoc debug-config: Setting 'verbosity_level=2' from built-in defaults.
texdoc debug-config: Setting 'machine_switch=false' from built-in defaults.
texdoc debug-config: Setting 'badbasename_list=readme, 00readme' from built-in defaults.
texdoc debug-config: Setting 'interact_switch=true' from built-in defaults.
texdoc debug-config: Setting 'rm_dir=rmdir' from built-in defaults.
texdoc debug-config: Setting 'rm_file=rm -f' from built-in defaults.
texdoc debug-files: Configuration files are:
texdoc debug-files: active  /usr/share/texlive/texmf-dist/texdoc/texdoc.cnf
texdoc debug-texdocs: texdocs[8] = /home/alexey/.texlive2017/texmf-config/doc (index_mandatory=false, recursion_allowed=true)
texdoc debug-texdocs: texdocs[7] = /home/alexey/.texlive2017/texmf-var/doc (index_mandatory=false, recursion_allowed=true)
texdoc debug-texdocs: texdocs[6] = /home/alexey/texmf/doc (index_mandatory=false, recursion_allowed=true)
texdoc debug-texdocs: texdocs[5] = /usr/local/share/texmf/doc (index_mandatory=true, recursion_allowed=true)
texdoc debug-texdocs: texdocs[4] = /etc/texmf/doc (index_mandatory=false, recursion_allowed=true)
texdoc debug-texdocs: texdocs[3] = /var/lib/texmf/doc (index_mandatory=true, recursion_allowed=true)
texdoc debug-texdocs: texdocs[2] = /usr/share/texmf/doc (index_mandatory=true, recursion_allowed=true)
texdoc debug-texdocs: texdocs[2] using index: /usr/share/texmf (shift=doc/)
texdoc debug-texdocs: texdocs[1] = /usr/share/texlive/texmf-dist/doc (index_mandatory=true, recursion_allowed=true)
texdoc debug-texdocs: texdocs[1] using index: /usr/share/texlive/texmf-dist (shift=doc/)
texdoc debug-tlpdb: Using shipped tlpdb data.
Sorry, no documentation found for algorithmicx.
If you are unsure about the name, try searching CTAN's TeX catalogue at
http://ctan.org/search.html#byDescription.

感觉好像需要重建某些数据库,但我没有找到任何说明。

我该如何修复texdoc

答案1

错误报告关于这个问题在 Ubuntu 的 bug tracker 中已经公开了近 2 年。报告的作者建议使用这个替代解决方案来更新文档数据库,我测试过这个解决方案,似乎有效:

# dpkg-reconfigure texlive-base

答案2

要查找文档文件,texdoc可以使用多种策略,具体取决于 TeX Live 安装的类型(vanilla 或 apt 包)等。对于非 vanilla 安装,kpse.find_file()使用 Lua 函数,它是 的接口kpathsea,它是用于在目录树中定位文件的 LaTeX 实用程序。

要检查问题是否由 引起kpathsea,您可以kpsewhich -format "TeX system documentation" algorithmicx.pdf在终端中尝试。如果没有结果,则数据库kpathsea已过期。sudo mktexlsr [path]在这种情况下,可以使用 进行更新sudo mktexlsr /usr/share/texlive/texmf-dist(另请参阅texdoc 不在 $TEXMFHOME 处搜索)。之后,kpsewhich应该能够找到该文件,并且也texdoc应该能够找到它。

apt请注意,如果调用文档包的话会更容易mktexlsr,但这在升级期间显然不会发生。

免责声明:我遇到了与 OP 相同的问题,并且上述解决方案对我有用 - 但是的搜索策略texdoc相当复杂,错误可能出在其他地方。

答案3

我安装了该texlive-latex-extra软件包,后来又安装了该texlive-latex-extra-doc软件包(使用 Ubuntu 18.04 的 apt 实用程序)。与 OP 类似,texdoc无法找到大多数已安装软件包的文档。我按照Marijn 的回答这招奏效了。具体来说,我发出了以下命令:

$ sudo mktexlsr /usr/share/doc/texlive-doc

这对于那些在 Ubuntu 18.04 上通过 apt 安装 TeX Live 的人来说应该有效。

相关内容