Thursday 13 February 2020

Installing LaTeX

I wanted to use LaTeX today and since I'm using a new laptop and I don't have it installed. So here are my notes from how I went about installing LaTeX on Ubuntu 18.04 LTS.

My first stop was the LaTeX page on the Ubuntu Community Help Wiki. In summary the best way to get LaTex is as part of the TeX Live distribution, the alternative being teTeX which is now unsupported. The choice then is between whether to install TeX Live from Ubuntu package repositories or from the TeX Users Group. Install from repositories is simpler but the main reason is that repository packages can lag behind the latest version by quite some degree. This point I have found to be true for many software packages and increasingly I have found installing software manually to be preferable for this reason. It's worth noting that page was last updated in October 2013 so things might have changed since then.

I decided to check what the current latest version of Tex Live is and compare that from what is available from the Ubuntu repositories.

At the time of writing the latest TeX Live 2019 which was released in April 2019 [1]. From the Ubuntu repositories on the other hand it looks like the latest version is TeX Live 2017 [2]. Since the repository version is 2 years behind it is clear that installing manually will be the preferable option.

$ wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
$ tar -xzf install-tl-unx.tar.gz
$ cd install-tl-20200213/
I tried first using the graphical installer,
$ ./install-tl -gui
But this looked terrible:
So I abandoned that and tried the wizard approach:
$ ./install-tl -gui wizard

That failed on the first attempt with the following message:
Cannot load Tk, maybe something is missing and
maybe https://tug.org/texlive/distro.html#perltk can help.
Error message from loading Tk:
  Can't locate Tk.pm in @INC (you may need to install the Tk module) (@INC contains: ./tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./install-tl line 527.
But that just seemed to be a case of missing the perl-tk[3] package. So I installed that first:

$ sudo apt install perl-tk

Then tried again running the gui install script with the wizard option - et voila!



Since I am running the install without super user privileges the default installation path of /usr/local/texlive/2019 was not writable so I changed this to be relative to my home directory i.e. /home/daniel/opt/texlive/2019 . And since I live in the UK I set the default paper size to A4. I clicked install and off it went downloading things:


As advised I added made the following updates to the MANPATH; INFOPATH and PATH environment variables by adding these lines to my ~/.bashrc file:

# Path modifications for TeX Live
export MANPATH=$MANPATH:/home/daniel/opt/texlive/2019/texmf-dist/doc/man
export INFOPATH=$INFOPATH:/home/daniel/opt/texlive/2019/texmf-dist/doc/info
export PATH=$PATH:/home/daniel/opt/texlive/2019/bin/x86_64-linux

Then after opening a new shell I checked that LaTeX was functioning correctly:

$ latex --version
pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019)
kpathsea version 6.3.1
Copyright 2019 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.36; using libpng 1.6.36
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.01


I also checked that the Tex Live Manager was working correctly by running:

$ tlmgr -gui &

No comments:

Post a Comment

Installing LaTeX

I wanted to use LaTeX today and since I'm using a new laptop and I don't have it installed. So here are my notes from how I went abo...