TransWikia.com

'texdoc' fails when some other texlive-* is installed by 'apt'

TeX - LaTeX Asked by iChunyu on January 6, 2021

I had installed TexLive from ‘texlive2020-20200406.iso’ correctly in Ubuntu 20.04, and I had used it to write reports for a while. Recently, I found some packages through terminal command apt search texlive and I installed some of them. From then on, the command texdoc can’t search document anymore. I’m sure the command worked well previously.

Example: The command texdoc beamer opened ‘beameruserguide.pdf’ before, but now it opens a beamer sample in another path.

It seems the packages installed through apt override the path of those installed from ‘iso` file.

apt list --installed | grep texlive gives list below:

texlive-base/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-binaries/focal,now 2019.20190605.51237-3build2 amd64 [installed,automatic]
texlive-font-utils/focal,focal,now 2019.202000218-1 all [installed,automatic]
texlive-fonts-extra-links/focal,focal,now 2019.202000218-1 all [installed,automatic]
texlive-fonts-extra/focal,focal,now 2019.202000218-1 all [installed]
texlive-fonts-recommended/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-lang-chinese/focal,focal,now 2019.20200218-1 all [installed]
texlive-lang-cjk/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-lang-japanese/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-lang-korean/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-lang-other/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-latex-base/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-latex-extra/focal,focal,now 2019.202000218-1 all [installed,automatic]
texlive-latex-recommended/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-pictures/focal,focal,now 2019.20200218-1 all [installed,automatic]
texlive-plain-generic/focal,focal,now 2019.202000218-1 all [installed,automatic]

I’m very thankful if you can help me solve this problem.


Addition: The path is set via editing ‘~/.bashrc’ as below (after installation from ‘.iso’)

export MANPATH=${MANPATH}:/usr/local/texlive/2020/texmf-dist/doc/man
export INFOPATH=${INFOPATH}:/usr/local/texlive/2020/texmf-dist/doc/info
export PATH=${PATH}:/usr/local/texlive/2020/bin/x86_64-linux

Addition: Command which texdoc and echo $PATH outputs:

# which texdoc
/usr/bin/texdoc

( I wrap lines for easier reading )

# echo $PATH
/home/xiaocy/.local/bin:
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games:
/snap/bin:
/usr/local/texlive/2020/bin/x86_64-linux:
/usr/local/texlive/2020/bin/x86_64-linux:
/usr/local/texlive/2020/bin/x86_64-linux

Conclusion

The problem is caused by the path override. Modify ~/.bashrc and ~/.profile as below can solve this problem.

export MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:${MANPATH}
export INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:${INFOPATH}
export PATH=/usr/local/texlive/2020/bin/x86_64-linux:${PATH}

I don’t know whether it’s allowed to give this conclusion myself. The conclusion is drawn with the help of @daleif (see comments). Thank you very much!

One Answer

This is a common mistake. First of all, OSes search the PATH from left to right. (Here the path is separated by colons). It then appends each path piece to a function call until the first one is found. Here you have two latex installation the apt one and a TL2020 via ISO. Since the apt installation adds texlive stuff in such a way it is found via /usr/bin/, we beed to make the TL2020 part of the path comes before /usr/bin/. The standard method is to make sure to prepend the TL2020 path.

Therefore use

export MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:${MANPATH}
export INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:${INFOPATH}
export PATH=/usr/local/texlive/2020/bin/x86_64-linux:${PATH}

not

export MANPATH=${MANPATH}:/usr/local/texlive/2020/texmf-dist/doc/man
export INFOPATH=${INFOPATH}:/usr/local/texlive/2020/texmf-dist/doc/info
export PATH=${PATH}:/usr/local/texlive/2020/bin/x86_64-linux

Additionally, make sure to also add this to .profile (you'll need to log out and in again for a .profile edit to have any effect). This is because any editor started via a menu or by double slicking a file never sees anything Bash related and thus never sees the change.

Correct answer by daleif on January 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP