5

As the picture shown, the left top picture shows that I have installed Tex Live successfully, but when I input the code 'latex', it shows that I have not installed the latex program and recommends me use the code (the Chinese characters on the picture means that) 'sudo apt install texlive-latex-base', which is shown in the right bottom picture! I wonder why. I installed Tex Live but there is no latex program in my computer

I installed Tex Live according to link

I am beginner of latex, and I'm sorry for ask trival a so simple question.enter image description here

gernot
  • 49,614
Zhang
  • 63
  • 1
    In the top left corner terminal, two lines before the end of the install, it is said "Most importantly, add to your PATH for current and future session". It means, that binaries are well installed, but your system doesn't know where to look for them, and thus 'thinks' you have not installed it (and recommend you a way to do it). – ebosi Oct 17 '16 at 08:25
  • the message at the top line of the right hand box is telling you to set your PATH (in .profile or similar startup file) to include the 2016 bin directory, have you done that? – David Carlisle Oct 17 '16 at 08:26
  • 1
    Did you do what the last line of the installation output say, namely Most importantly, add /usr/local/texlive/2016/bin/x86_64-linux to your PATH for current and future sessions? – gernot Oct 17 '16 at 08:27
  • Please post the results of echo $PATH after you have done what gemot asked (remember, it might be a good idea to log out and in again) – daleif Oct 17 '16 at 10:56
  • Thank you, after doing that, the PATH is okay, and latex can compile .tex code. thank you! – Zhang Oct 17 '16 at 14:17
  • See also http://tex.stackexchange.com/q/26624/5763 – Martin Schröder Oct 19 '16 at 11:46

1 Answers1

8

Add the lines

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

to $HOME/.profile. As a user of bash I also have the line

source ~/.profile

in $HOME/.bashrc.

In order for the change to affect not only newly started shells, but also programs managed by the GUI, you have to start a new session.


Problems with evince and a local TeXLive installation under Ubuntu

(This addresses an issue raised in the comments below the answer.)

The document viewer Evince may exhibit two problems when trying to view dvi files in this arrangement.

Evince fails to display dvi files. When starting it from the command line, you see messages like

kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+100/600 --dpi 700 cmss12
mktexpk: Permission denied

Evince is supervised by apparmor, a kernel module for preventing applications from doing mischief, and is forbidden to use TeXLive in \usr\local. You can either switch off supervision completely by

sudo aa-disable /usr/bin/evince

(aa-disable comes with the apparmor-utils package), or you modify the apparmor rules. Add the following lines to /etc/apparmor.d/abstractions/evince:

# TeXlive 2016
/usr/local/texlive/2016/bin/x86_64-linux/mktexpk Cx -> sanitized_helper,
/usr/local/texlive/2016/bin/x86_64-linux/mktextfm Cx -> sanitized_helper,
/usr/local/texlive/2016/bin/x86_64-linux/dvipdfm Cx -> sanitized_helper,
/usr/local/texlive/2016/bin/x86_64-linux/mkofm Cx -> sanitized_helper,
/usr/local/texlive/** r,

and the following lines to /etc/apparmor.d/abstractions/ubuntu-helpers:

# TeXlive 2016
/usr/local/texlive/2016/texmf{,-dist}/web2c/{,**/}* Pixr,
/usr/local/texlive/2016/bin/x86_64-linux/* Pixr,

Insert the lines near similar-looking rules for Ubuntu-TeX. For these changes to take effect without rebooting, issue the command

sudo service apparmor restart

Evince re-generates fonts each time a dvi file is viewed. When starting it from the command line, you see messages like

kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+100/600 --dpi 700 cmss12
mktexpk: /home/someuser/.texlive2016/texmf-var/fonts/pk/ljfour/public/cm/cmss12.700pk already exists.

This is caused by Evince not finding the new configuration file for TeXLive 2016. The problem can be solved by putting a link to it into the folder /usr/local/share/texmf/web2c:

sudo mkdir -p /usr/local/share/texmf/web2c
sudo ln -s /usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf /usr/local/share/texmf/web2c/texmf.cnf

Tested for

  • TeXLive 2016, Ubuntu 16.04, evince 3.18.2

  • TeXLive 2016, Ubuntu 16.10, evince 3.22

gernot
  • 49,614
  • Very thankful for your answer, but after doing as you said, the problem remains as before. I run the command 'latex test.tex' to compile a test code and it shows that: latex program has not been installed. – Zhang Oct 17 '16 at 10:36
  • 1
    @Zhang First, try the command /usr/local/texlive/2016/bin/x86_64-linux/latex, to make sure that latex indeed exists in the directory. Then issue echo $PATH on the command line; this gives a list of directories, among them there should be /usr/local/texlive/2016/bin/x86_64-linux. If this is the case, latex on the command line should work. – gernot Oct 17 '16 at 11:35
  • Thank you! 'path+latex' works while 'latex' does not, this kind of problem may be caused by the 'PATH variable'. But I added export PATH=/usr/local/texlive/2016/bin/x86_64-linux:$PATH export MANPATH=/usr/local/texlive/2016/texmf-dist/doc/man:$MANPATH export INFOPATH=/usr/local/texlive/2016/texmf-dist/doc/info:$INFOPATH these three line to the file $home/.profile – Zhang Oct 17 '16 at 12:09
  • also it does not work. Is it that the Path variable adding not successfully? – Zhang Oct 17 '16 at 12:11
  • Which shell do you use? Each shell has rules, which initialisation files are loaded depending whether it is used interactively or non-interactively, whether as login-shell or not. For bash, you also have to modify .bashrc, see above. What do you get when issuing echo $SHELL on the command line? – gernot Oct 17 '16 at 12:45
  • I use CLI shell. The second file has also been modified(adding 'source ~/.profile in the last line?'). Run "echo %PATH" it doesn't echo any path related texlive. Is there any other method to add PATH variable? – Zhang Oct 17 '16 at 13:04
  • What does echo $SHELL say? – gernot Oct 17 '16 at 13:17
  • /home/zhangli/bin:/home/zhangli/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin add three lines the end of file ~.profile , and – Zhang Oct 17 '16 at 13:26
  • @Zhang What is the output of echo $SHELL (not echo $PATH)? – gernot Oct 17 '16 at 13:34
  • and one line to ~.bashrc. the result is as above. But if I add three lines to ~.bashrc, the 'echo $PATH' results contains the texlive path, then 'pdflatex, xelatex' can compile .tex code and the .pdf document can be opened easily while 'latex' compile .tex code and the .dvi document can't be open by evince. Two questions: 1,the methods of the two differs? 2, add three lines to ~.bashrc can modify the variable path but the .dvi document can't be opened, this problem is related to the second method? Is the method wrong? – Zhang Oct 17 '16 at 13:35
  • Yeah, 'echo $SHELL' echoes '/bin/bash' – Zhang Oct 17 '16 at 13:37
  • @Zhang Have you logged out and started a new session? – gernot Oct 17 '16 at 13:41
  • yeah, I modify the file and close the terminal and start a new one, othewise the new path will not echo – Zhang Oct 17 '16 at 13:42
  • @Zhang Not just a new terminal, but quit the GUI session and login in again. Programs started from the GUI see the environment as it was when the GUI was started. – gernot Oct 17 '16 at 13:45
  • yeah, I reboot the computer and the path is OK! Thank you! But I would like to ask if you know what's the problem results in that the .dvi document can't be opened? – Zhang Oct 17 '16 at 13:56
  • @Zhang Open a terminal and start evince yourfile.dvi from there. Do you get error messages in the terminal window? evince may have problems to generate the fonts. – gernot Oct 17 '16 at 13:59
  • yean, the error massage is too much, how I show you the picture?/home/zhangli/图片/compile.png – Zhang Oct 17 '16 at 14:07
  • @Zhang Try to view the dvi file with xdvi (an old program included in texlive) and with okular (a modern document viewer included in Ubuntu that you might have to install first). Does this work? Regarding the error messages, maybe just show the first few lines. – gernot Oct 17 '16 at 14:13
  • xdvi works well, but there is no okular in my system. I'm downloading – Zhang Oct 17 '16 at 14:16
  • the error massage is :kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 cmmib10 mktexpk: 权限不够 kpathsea: Appending font creation commands to missfont.log. page: Warning: font cmmib10' at 600x600 not found, tryingcmr10' instead

    kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 cmr10 mktexpk: 权限不够 page: Warning: font `cmmib10' not found, trying metric files instead the Chinese character means that I don't have the power

    – Zhang Oct 17 '16 at 14:19
  • okular also can open .dvi, but when it is running some errors also occur. But these errors doesn't influence reading the document. – Zhang Oct 17 '16 at 14:33
  • Before, I use 'sudo apt-get install texlive-full' to install latex, and use 'latex' to compile .tex code, then evince .dvi works well – Zhang Oct 17 '16 at 14:36
  • @Zhang The problem is that evince uses app-armor, a mechanism strictly controlling what evince is allowed to do. In the new texlive installation, newly generated fonts are written below $HOME/.texlive2016, and it seems that evince is not allowed to do that. So you have either to allow evince to generate the fonts or change the path where the TeX tools put the fonts. – gernot Oct 17 '16 at 14:40
  • I want evince to generate the fonts, but how could I do that? – Zhang Oct 17 '16 at 14:46
  • @Zhang I will try to resolve this problem regarding evince. In the meantime, either use pdflatex or xelatex to generate pdf files and view them with evince (or any other pdf viewer, but evince is able to show pdf files), or use latex and use another dvi viewer like okular. – gernot Oct 17 '16 at 17:11
  • @Zhang I think I have solved your evince problem; see my extended answer. – gernot Oct 20 '16 at 18:52
  • @ Very thanks for your answer. I use the third solution to solve my evince problem, but there is no a file 'ubuntu-helper' under the path '/etc/apparmor.d/abstractions', if I should make a new file? A nother qusetion, how do I star a chat with somebody, the comment items are so many here. – Zhang Oct 21 '16 at 02:56
  • @Zhang I've created a new chatroom, http://chat.stackexchange.com/rooms/47158/texlive-installation-ubuntu Please join to continue the conversation there. – gernot Oct 21 '16 at 07:14
  • Sorry, I don't have enough reputation to talk, would like to continue here? – Zhang Oct 21 '16 at 08:38
  • @Zhang Which Ubuntu version and which evince version do you use? Which output do you get from the command sudo egrep -l 'texmf|mktexpk' /etc/apparmor.d/*{,/*} 2>/dev/null ? This is one command in one line. It lists the files in /etc/apparmor.d and its subdirectories that contain either texmf or mktexpk. – gernot Oct 21 '16 at 11:31
  • @MartinSchröder Chat would be a great idea (and Stackexchange probably would have suggested it already automatically) if there weren't a reputation limit for chatting. Sorry. – gernot Oct 21 '16 at 11:36
  • I'm sorry to reply you so late for my net problems. The ubuntu version I use is 16.04, and the evince version is 3.18.2. I use the following two commands sudo mkdir -p /usr/local/share/texmf/web2c and sudo ln -s /usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf /usr/local/share/texmf/web2c/texmf.cnf later to fix my problem, when it was done, I use evince to open .dvi files, it shows that the file texmf.cof does not have enough authority – Zhang Nov 03 '16 at 14:00
  • @Zhang Have you noticed the line /usr/local/texlive/** r, in the file /etc/apparmor.d/abstractions/evince (see above)? I added it in a later update, together with the mkdir and ln -s commands. – gernot Nov 03 '16 at 14:51
  • I'm sorry I have done all things you said, but the problem remains still. I added the six lines to the bottom of the file /etc/apparmor.d/abstractions/evince and added the three lines to the file /etc/apparmor.d/abstractions/ubuntu-helpers, but I don't know where to insert the two lines in the file. I tried to insert the bottom and 66th line, and I reboot the apparmor, and then I used commandsudo mkdir -p /...andsudo ln -s /..., all was done, but the problem remains still. Maybe the location I chose to insert the three line toubuntu-helpers` was wrong? – Zhang Nov 04 '16 at 03:06
  • @Zhang If you mean with "at the bottom" literally at the bottom, then this will be wrong for ubuntu-helpers, since it is terminated by }, and the lines have to be added before. Best insert the lines near the lines for Ubuntu texlive (search for texmf or texlive). Just to make sure: did you restart apparmor after these changes? – gernot Nov 04 '16 at 08:57
  • Thank you very much, the problem is solved, and main cause was that the } terminated the three lines in file ubuntu-helpers. Now evince can view dvi files without any problem. Thank you! – Zhang Nov 05 '16 at 03:51