Say that I have a .tex file that I want to send to another person who should be able to compile it. On my working machine the compilation requires many many custom packages (not included in CTAN) that are installed into my TeX Live tree and some fonts.

Is there a way to create some kind of sandbox environment so that I can compile the file as if I had a clean TeX Live installation to check the "missing package" and "missing font" warnings? This way I could prepare a directory to send to other people with everything they need to compile my .tex file.

Please assume that I don't have another machine to use for testing purposes.

  • Can we assume your local additions are in TEXMFHOME?
    – Joseph Wright
    Mar 8, 2016 at 10:15
  • Yes, they are there
    – d-cmst
    Mar 8, 2016 at 10:16
  • 2
    I think bundledoc ctan.org/tex-archive/support/bundledoc can do this for you
    – touhami
    Mar 8, 2016 at 10:24
  • I didn't kbow bundledoc, currently testing it, thanks
    – d-cmst
    Mar 8, 2016 at 10:29
  • BTW, is installing a VM for testing a possible?
    – Joseph Wright
    Mar 8, 2016 at 13:52

3 Answers 3


The environmental variable TEXMFHOME is used to tell your TeX system where the 'personal' tree is. For TeX Live, this variable is not usually set and is derived from texmf.cnf, which will lead to it pointing to %USERPROFILE%\texmf on Windows, ~/texmf on Linux and ~/Library/texmf on a Mac. (For MiKTeX there is no 'out of the box' setting so it has to be created by hand.) However, once TEXMFHOME is set to some non-empty value it determines where is checked. So setting


as appropriate for your operating system will stop searching of the personal tree. Do that before running TeX (say at the command line or in a script) and you'll cut off any local additions.

Even more 'definite' is to set TEXINPUTS=., which restricts all searching to just the current directory. That can be used if you have a 'truly' isolated set up, though perhaps is overkill for most people. (We use that for testing the LaTeX kernel, where all TeX files really do have to be from the current location.) More on TEXINPUTs is available in Definition of the TEXINPUTS variable. Also see http://tug.org/texlive/doc/texlive-en/texlive-en.html for the full docs on how searching works.


On Linux I would use Docker to create an isolated environment and to try compiling the project there. It does have some learning curve (for example you need to use a volume to make your tex files visible within the container) but it is "transparent" to use if wrapped with suitable shell scripts.

I found one good example at github.com/blang/latex-docker.

If you need a more "exotic" environment to compile your project you could extend the Dockerfile, check that your project works within the container and then send relevant scripts to the recipient. They could run compilation in an identical container without polluting their own OS with extra packages.


You mentioned that your LaTeX environment and developement is restricted to one machine. In the long term, a virtual machine would be a solution to test with another environment if portability represents an issue for you. (Perhaps, a pre-built VM would be an option for you if you do not have the time to install it from scratch - the link is only an example of pre-built VMs - have not done a research for other VMs - An Oracle VM was used by me for another purpose.) In the meantime, maybe you try online a service. Have you tried an online compiler? See another thread.

I have checked once portability between different LaTeX enviroments hosted on different (real) machines - Windows Server 2008, Gentoo and Mac OS. There was an issue with MikTeX due to MikTeX specific commands, which were not interpreted on my Gentoo-based machine. When working mostly with a Linux-based OS and sharing your LaTeX code with other Linux users, you will not have (too many) issues - except you have installed something, which is rather unknown to CTAN - as mentioned by yourself.

If you are not sure concerning the custom packages, which were applied, then a virtual machine will be the best for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .