Is it possible to install only the required LaTeX tool "pdflatex" in Ubuntu?

On Ubuntu 12.04:

sudo apt-get install texlive-latex-base

Seems to have got the job done in 175MB.


Almost every distro have its own package manager. Maintainers of any distro have their own point of view onto package building: its dependencies and its contents. So, for example, in Archlinux TeXLive is split onto many small packages. In Debian and Ubuntu, I think, it must be alike.

The smallest working set of LaTeX have volume about 300 megabytes. For example, my installation of TeXLive is near 0.5GB. The only optimal way is to install texlive-core and after that - some packages you need (you will know that they aren't installed in your system by latex error messages).

For example, package texlive-bin contains all binary files, but no style files; texlive-core contains main style files and some auxiliary utils. For using bibtex with different bibliography styles, you will need texlive-bibtex-extra. texlive-langcyrillic contains support of Cyrillic languages. For using different styles to include images into your file you will need texlive-pictures. Et cetera.


Because I rarely needed to use LaTeX, I used to use EC2 for compiling my documents. I liked that I could throw everything away when I was done, but the setup was time consuming. I found a better way.

Docker is a great tool for this because you don't have to make any changes to your main system. Here is a way to use a Docker image I created.

docker run -i richardbronosky/latex-compiler < document.tex > document.pdf

If you need supplementary files you can pipe in an uncompressed tar and it will be detected.

tar cf - *.tex *.sty | docker run -i richardbronosky/latex-compiler > document.pdf

If multiple documents to be created, it returns a tar file that you can expand.

tar cf - *.tex *.sty | docker run -i richardbronosky/latex-compiler --tar | tar x

If you need more (or less) LaTeX packages, you can clone the repo and modify the Dockerfile. Its current state is:

FROM ubuntu

MAINTAINER Bruno Bronosky <[email protected]>

RUN apt-get update

RUN apt-get install -y texlive-latex-recommended

ADD latexcat /usr/local/bin/latexcat
RUN chmod a+x /usr/local/bin/latexcat

ENTRYPOINT ["/usr/local/bin/latexcat"]