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? Mar 16, 2011 at 15:15
  • 2
    @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, 2011 at 15:19
  • 3
    @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, 2011 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. Mar 16, 2011 at 15:59
  • 6
    There exists a script that builds a distribution based on a single document. See tex.stackexchange.com/questions/8249 Mar 16, 2011 at 18:57

4 Answers 4


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, 2014 at 2:42
  • I'm interested in the instructions as well, even though it seems like @BertrandMorel is no longer visiting TeX.SE. May 16, 2015 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, 2016 at 15:02
  • 1
    @Sigur, no, but I looked at SILE instead as it allows for more compact package. Nov 4, 2016 at 21:03
  • 1
    @Sigur Have a look at my reply. Basically, you can start by putting your.tex and pdflatex.exe in the same folder and keep adding .dll, .fd, .sty, .cls, .pfb, .tfm, .clo, .map files from a working distribution until pdflatex.exe your.tex successfully produces your.pdf. No subfolders required.
    – masterxilo
    Mar 9, 2017 at 20:20

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.

  • 1
    This sounds super promising, and 10MB is mighty impressive. Too bad it's Windows only... =( Aug 9, 2017 at 11:46
  • I am sure the same technique works on unix systems
    – masterxilo
    Dec 10, 2021 at 8:25

Stripping Thierry Laronde's blazing fast TeX distribution, KerTeX, you can get a plain TeX distribution in under 2MB.

0) The tex executable is 1,229,008 bytes (after running strip on it). (I've modified the C sources a bit so your size may vary slightly.)

1) The plain.fmt file is 541,382 bytes.

Total: 1,770,390 bytes.

2) The rest is just fonts.

I'm using a custom DVI driver (forked from dvipng), and this is all I need to compile .tex source code and render .dvi code.

Type 1 fonts can add a few MBs (since there's so many of them...), but you can keep the total under 2MB. Each Type 1 font is 2 files: a .pfb file and a .tfm file. Each Type 1 font is about 35,000 bytes in total. For example, I'm using these Type 1 fonts: cmssbx10, cmssbx10, cmss10, cmssbx10, cmssi10, cmsl10, cmtt10, cmcsc10, cmmi10, cmsy10, cmbx10, eusm10, eusb10, eufm10, eufb10, cmr10, cmmi7, cmr7.

The KerTeX tex executable (which compiles .tex source code into .dvi), and my DVI driver (which renders .dvi code to the screen and to images) needs the plain.fmt file to work, and the .pfb and .tfm files for fonts. (Though I think tex only needs the TFM files?)

That's it.

(Actually KerTeX's tex executable also needs a KXPATH file in the fonts folder, for some reason, but it's only 6 bytes...)

(By the way, the KerTeX tex executable compiles small TeX files in about 2 milliseconds, so it's more than enough to compile and render .tex source in real time, since the DVI driver can be made pretty fast, too.)

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.