Are there any portable minimal latex/xelatex distributions? I know of MikTeX portable, but at 130MBs it is far from minimal. Alternatively, can I easily make my own distribution?

What I would like to have is:

  • Ability to compile a pre-defined type of XeTeX document
  • Just the required packages included
  • Size under 5MB, ideally under 2MB

Any ideas?

  • 2
    I may be wrong, but your size requirements sound very optimistic to me. Are you really that constrained by the space available to you? – Anthony Labarre Mar 16 '11 at 15:15
  • 1
    @Anthony Labarre: Most likely, no. I would prefer it to be as minimal as possible. I assumed that TeX is "small" because it was completed in 1989. And then I assumed that LaTeX "can't be much larger". – ipavlic Mar 16 '11 at 15:19
  • 2
    @Martin H: For my purposes, it is. If my requirements can be satisfied, great. If not, what's the next best option? I am perfectly satisfied with an answer 20MBs, 50MBs (or 130MBs) if that is really the smallest size possible. Don't get me wrong, I appreciate your effort. Still, imagine somebody wanted to convince you to use Word instead of LaTeX: "but do you really need excellent line-breaking and so-called-nice-looking documents without wysiwyg in today's fast paced world?" – ipavlic Mar 16 '11 at 15:54
  • 4
    I'm using beside my miktex a rather bare development lua(la)tex (with the binaries from w32tex.org). The bin-folder contains also the format files and is about 10 MB large. To this you must add the space for fonts (luatex and xetex still needs TeX-fonts e.g. for math), packages, tools like dvips (e.g. for pst-pdf), bibtex, makeindex/xindy, package manager, ... I would say 5 MB is impossible today. 20 MB is very optimistic. – Ulrike Fischer Mar 16 '11 at 15:59
  • 5
    There exists a script that builds a distribution based on a single document. See tex.stackexchange.com/questions/8249 – Taco Hoekwater Mar 16 '11 at 18:57

Summarising the various comments as an answer, the bottom line is that a target of 5 MB is unrealistic. For example, the Windows XeTeX binary on my system is 2.7 MB, while as Ulrike says

The MiKTeX package with XeTeX binaries has a size of 14MB.

(On my Unix system, the XeTeX binary is 17.8 MB). You need of course in addition to XeTeX the xdvipdfm system (I'm not sure exactly how that is packaged up on different systems.)

As an absolute minimum, you need in addition to the XeTeX binary some structure for finding files (kpsewhich or MiKTeX's equivalent), basic fonts (Computer Modern and Latin Modern), then a basic LaTeX (the base/required/tools, plus whatever you feel is 'minimal'). That is all going to add up.

Looking at the existing small distributions, BasicTeX (Mac-only) is 92 MB and MiKTeX basic is 157 MB. You could try to build something like one of these yourself, but the most obvious way to proceed is

Get either MiKTeX portable or TeX Live portable, install it and then remove the things you don't need (in MiKTeX you can use the package manager to remove packages).

(again from Ulrike's comment).

To get the size down, you should also look to remove all of the doc tree, as this tends to be quite big. Of course, you'll be left with no documentation, but it will be smaller.


As a 13 years long LaTeX user, I managed to have my own minimal distribution extracted from TeXlive, in the way Joseph Wright described in his answer, and installed it on my personal directory on a server at work (on windows platform) so that it runs in any computer I'm connected with.

It consists of pdflatex + bibtex8 + makeindex + scite + sumatrapdf and a few standard packages (base + tools + graphics + geometry + titlesec + pgf + hyperref and dependencies).

I also tweaked fonttext.cfg, fontmath.cfg and preload.cfg to have Latin Modern as default fonts so that I have no cm and ec fonts installed... All this stands in 30MB (~1300 files) so I can confirm that a standalone pdflatex system (without the editor, pdfviewer and extra package like pgf) stands in no more than 20MB. Surely xelatex and lualatex need more space because of bigger binaries.

  • Can you share your experience by explaining the steps? What parts are removed? @Bertrand Morel. – Edy Jo Jan 11 '14 at 2:42
  • I'm interested in the instructions as well, even though it seems like @BertrandMorel is no longer visiting TeX.SE. – Paul Kulchenko May 16 '15 at 5:40
  • @PaulKulchenko, did you have any progress on doing this? I'm also interested. I want a way to compile only a single document, many times, in many computers. – Sigur Nov 4 '16 at 15:02
  • 1
    @Sigur, no, but I looked at SILE instead as it allows for more compact package. – Paul Kulchenko Nov 4 '16 at 21:03
  • @PaulKulchenko, thanks, but I would like to use Tikz package. So... – Sigur Nov 4 '16 at 21:06

I have also been wondering why this TeXLive thing is taking up so much space and what all of these files and directories are all about and which ones the program actually uses on my behalf.

So I just copied pdflatex.exe out of there and added files until I could compile a simple article with some math and different fonts in it:


\title{How to Structure a LaTeX Document}

Your abstract goes here...

This section's content...

\subsection{Top Matter}
This subsection's content...

\subsubsection{Article Information}
This subsubsection's content...

\emph{hello} hello $x^2, \mathbb R, \mathcal C, \mathfrak F, \int_0^1 \sin(x) \mathrm d x$


Turns out you just need, in addition to pdflatex.exe:

  • some .dlls
  • the .sty files for packages you use and dependencies of the packages you use
  • Some U*.fd files to fix errors of the form LaTeX Font Warning: Font shape `U/*/m/n' undefined
  • texmf.cnf
  • <the documentclass>.cls
  • size10.clo (whatever this is)
  • .tfm (font metric) and .pfb files for all the fonts you use (or plan to use, or a few more)
  • pdftex.map which is a concatenation of all .map files for the fonts you use.

These files don't have to be in the standard latex folder structure. They can just be in the same folder as the pdflatex executable.

I have uploaded a ~10MB (unpacked) folder containing all files necessary to run pdflatex hello.tex in it and have it produce hello.pdf:

https://drive.google.com/open?id=0Bw8QfIyUuQqvTHk3RWxPSVE4M3c (it contains pdflatex.exe (from TeXLive2016), so Google Drive might tell you "contains executable code, download at your own risk")

If you try to compile something more complicated, you should be able to copy over the necessary files from your full TeXLive installation to make this minimum installation capable of compiling it too.

That said, if you are on-the-go or in a low-resource environment but have an internet connection, you might prefer to use things like

which might provide an API to compile some LaTeX for you.

  • This sounds super promising, and 10MB is mighty impressive. Too bad it's Windows only... =( – étale-cohomology Aug 9 '17 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.