Mencoba LaTeX di Ubuntu (2)

LaTeX yang saya coba dengan cara ini hanya menyediakan pilihan PdfLaTeX. Bila ingin mencoba XeLaTeX (atau yang lain), coba cara ini. Berikut ini kutipannya.

These instructions have been updated for Ubuntu 14.04 and TeX Live 2014, they will probably work on most Ubuntu/Debian distributions.


Installing “vanilla” TeX Live is not as hard as you think. Things you will need:

  • An internet connection.
  • About 4 GiB of free space (2 GiB if not installing documentation).
  • Root (sudo) powers.

Also: the instructions are meant for the terminal. If you’re uncomfortable with that you can probably still install the texlive-full package from the Software center.

TeX Live Installer

First the official installer needs to be downloaded with the following commands:

tar -xzf install-tl-unx.tar.gz
cd install-tl-20140618

Note that the install-tl-20140618 folder may be named differently. You can probably type install-tl and then press tab to autocomplete the folder name.

Now the installation can begin, run:

sudo ./install-tl

If you prefer a “cut-and-paste” sequence of commands for downloading the installation script, opening the archive, changing to the directory into which unarchiving took place, and then starting installation, try this:

cd ~/Downloads
mv -f install-tl-unx.tar.gz /tmp
tar -xzf install-tl-unx.tar.gz
cd `tar -tzf install-tl-unx.tar.gz | sed -e 'N;s/^\(.*\).*\n\1.*$/\1\n\1/;D'`
sudo ./install-tl

(The above is supposed to be robust and idempotent, i.e., it should work even if you apply it a second time, and even if the first application went wrong.)

The command line instruction sudo ./install-tl starts the installation prrocess. You can change all kind of options here, most of the time the default options are correct. In some cases changing the options can, of course, be helpful. Not installing the doc and source trees will save you a lot (1.8 GiB, 50%) of disk space. This comes with the downside of having to look up documentation online, instead of locally.

If you want to reduce disk space further you can also change the installation scheme or collections, but this will result in not having certain packages installed by default. You can, however, install them later through the TeX live manager.

Press i to start installation. Installation is likely to take a long time, say between an hour and three hours (even on relatively fast connections). As usual, your mileage may vary, but if fewer components are selected in your settings, the process is hastened, and this components can be easily installed later.

If, for some reason, the installation is interrupted it can probably be resumed by running the installer again. This will prompt you to continue the installation. If you want to start the installation from the beginning it’s probably wise to remove the installed elements:

sudo rm -rf /usr/local/texlive/2014

Finalising the installation

If the installation completes successfully you will want to make sure your operating system can find it. This can be done by creating a symbolic link:

sudo ln -s /usr/local/texlive/2014/bin/* /opt/texbin

(Note: there should only be one subdirectory in /usr/local/texlive/2014/bin.)

Now you’ll have to add /opt/texbin to your $PATH variable. This can be done by editing /etc/environment:

gksudo gedit /etc/environment

You’ll see something like:


You can change this to:


Now you’ll need to logout and login again for the changes to take effect. Now start Terminal again and run:

which tex

This should show the following:


Fake packages

Now TeX Live works, but it’s also necessary to make Ubuntu think you’ve installed TeX Live. This can be done with the equivs package:

sudo apt-get install equivs --no-install-recommends
mkdir -p /tmp/tl-equivs && cd /tmp/tl-equivs
equivs-control texlive-local

First you’ll have to edit texlive-local.

gedit texlive-local

A good example for TeX Live 2014 can be found here. It may be a good idea to start your edit from this example.

cp -f debian-equivs-2014-ex.txt texlive-local
gedit texlive-local

Now you can build the package and install it:

equivs-build texlive-local
sudo dpkg -i texlive-local_2014-1_all.deb

After this installing texworks through the package maintainer won’t install TeX Live again. You can check that this is indeed the case:

sudo apt-get remove texworks
sudo apt-get install texworks

Now you can install other TeX related packages if you so wish:

sudo apt-get install qtikz kile


If you want to install all OpenType and TrueType fonts so you can use them in other programs as well, you’ll have to add the TeX Live fonts to the system configuration:

sudo cp $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
gksudo gedit /etc/fonts/conf.d/09-texlive.conf

Remove the line containing type1 and save. Now run:

sudo fc-cache -fsv


You can now update TeX Live though the TeX Live Manager by running:

sudo /opt/texbin/tlmgr --gui

It might complain about missing ‘Tk’, this can be solved by installing perl-tk:

sudo apt-get install perl-tk --no-install-recommends


You can also create a launcher for Unity:

mkdir -p ~/.local/share/applications
gedit ~/.local/share/applications/tlmgr.desktop

Paste the following:

[Desktop Entry]
Name=TeX Live Manager
Comment=Manage TeX Live packages
GenericName=Package Manager
Exec=gksu -d -S -D "TeX Live Manager" '/opt/texbin/tlmgr -gui'

Or you can create the same file launcher file by copying and pasting what follows into your command line prompt:

mkdir -p ~/.local/share/applications
/bin/rm ~/.local/share/applications/tlmgr.desktop
cat > ~/.local/share/applications/tlmgr.desktop << EOF
[Desktop Entry]
Name=TeX Live Manager
Comment=Manage TeX Live packages
GenericName=Package Manager
Exec=gksu -d -S -D "TeX Live Manager" '/opt/texbin/tlmgr -gui'

Once again you’ll need to logout and login again for the changes to take effect.

Upgrading to the next TeX Live

To upgrade you need to download and run the installer again. Afterwards you need to replace the symbolic link:

sudo ln -sf /usr/local/texlive/2014/bin/* /opt/texbin

It might also be a good idea to run the font section again. You can remove the old distribution by running:

sudo rm -rf /usr/local/texlive/2013

Uninstalling TeX Live

To remove TeX Live completely you need to undo everything you’ve done:

  • Remove the /opt/texbin symbolic link.
  • Remove /opt/texbin from the system path.
  • Remove /etc/fonts/conf.d/09-texlive.conf and update font cache.
  • Remove /usr/local/texlive.
  • Remove the package created with equivs (sudo apt-get purge texlive-local).

References and sources


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s