BUNDLEDOC(1)
okay so bestie, welcome to the bundledoc(1) manual page ๐ this one lives in the User Commands corner of the manual, and honestly? it's giving "I will literally zip up your entire LaTeX life for you." no cap. let's get into it.
โจ NAME โจ
bundledoc โ bundle all the files needed by a LaTeX document ๐
๐ธ SYNOPSIS ๐ธ
bundledoc [--version] [--help] [--[no]verbose] [--texfile=file.tex]
[--directory=directory] [--[no]localonly] [--exclude=string]
[--include=filespec] [--manifest=file] [--listdeps=[yes|no|only|rel]...]
[--[no]keepdirs] [--config=file.cfg] file.dep
๐ฆ DESCRIPTION ๐ฆ
bundledoc is a post-processor for the snapshot package, and what it does is gather up all the classes, packages, and files you need to actually build a given LaTeX document, and shove them all into one place. ๐
Here's the flow, bestie: it reads the .dep file that snapshot produces, hunts down every single file mentioned in there, and packages them into one single archive file (like a .tar.gz, you know the vibe). Perfect for moving stuff between systems, sending to a colleague, etc. etc. iconic.
As the simplest example possible โ and I mean simplest, don't come for me โ consider a LaTeX file called, say, hello.tex:
\RequirePackage{snapshot} % Needed by bundledoc
\documentclass[11pt]{article}
\begin{document}
Hello, world!
\end{document}
The \RequirePackage{snapshot} line is what makes a hello.dep file get produced. Then when bundledoc is handed "hello.dep" as an argument, it goes and locates the dependent files โ snapshot.sty, article.cls, and size11.clo โ and bundles them all into a single archive file, along with hello.tex and a MANIFEST file (we get into that in "OPTIONS", below). ๐ซถ
๐ OPTIONS ๐
In the following descriptions, somefile refers to the name of your main LaTeX document (no extension).
bundledoc requires the name of the dependency file produced by snapshot, normally somefile.dep. (For convenience, the file can be specified without its .dep extension.) The following options may also be given:
--versionโ outputs thebundledocscript's version number. This one overrides all of the remaining options, so it's the main character and everything else is background noise, fr fr.--helpโ gives you a brief usage message. This also overrides all of the remaining options. it's the "okay let me just explain myself real quick" of flags.--[no]verboseโ (default:"noverbose") โ normallybundledocdoesn't output anything except error messages (silent queen ๐). With--verbose, it outputs copious status messages. copious. like, so many.--texfile=main .tex fileโ (default:somefile.tex) โ here's the tea:snapshot's dependency file does not list the main LaTeX file (the one that gets passed tolatex). so forbundledocto find and bundle that file, it just assumes the file has the same name as the snapshot dependency file but with a.texextension. if that's not the case for you, use--texfileto specify the correct filename. ๐--directory=archive directoryโ (default:somefile) โ whenbundledoccreates an archive (e.g., a.taror.zipfile) holding the document's files, it drops them all into a directory so it doesn't clutter up your current directory like a messy room ๐. If the given dependency file is calledsomefile.dep, then by default the resulting archive stores all the dependent files in asomefiledirectory. Wanna change the directory name? that's what--directoryis for, babe.--[no]localonlyโ (default:"nolocalonly") โbundledocnormally archives all the files named in the.depfile, but--localonlytells it to exclude every file sitting in a directory other than the.texfile's directory or one of its subdirectories. local files only, we're keeping it close-knit. ๐--exclude=stringโ (default: none) โ--localonlyis the big blunt "files outside the.textree are OUT" move, and--excludeis the finer-grained version. This option can be specified repeatedly on the command line, and it makesbundledocomit from the archive every file whose name contains string. bye bestie โ๏ธ--include=filespecโ (default: none) โ this one, which can also be specified repeatedly on the command line, tellsbundledocto include in the archive all the files matching filespec โ even if they're not referenced in the.depfile at all. "you're coming with us, whether the.depfile knows you or not." โจ--manifest=manifest fileโ (default:MANIFEST) โ besides the dependent files,bundledocalso throws one extra file into the archive, called by defaultMANIFEST.MANIFESTis a text file listing the original filenames of all the dependencies. Wanna rename it fromMANIFESTto something else? use--manifest. And as a special case:--manifest=""tellsbundledocto not include a manifest file at all. no manifest, no problem. ๐--listdeps=[yes|no|only|rel]...]โ (default:"no") โ--listdepsaccepts one or more ofyes,no,only, orrelas a comma-separated list. As long asnodoes not appear in this list,bundledocoutputs all of the main LaTeX file's dependencies. If the list containsrel, thenbundledocoutputs the list of dependencies with relative pathnames. And if the list containsonly, thenbundledocexits after displaying the list โ without producing an archive. just the receipts, no bundle. ๐--[no]keepdirsโ (default:"nokeepdirs") โ normally the archive file thatbundledocproduces contains a single directory โ plus subdirectories, if the document refers explicitly to them โ and all the dependent files lie in there. If--keepdirsis specified, all the dependent files are stored with their original pathnames. For example, ifsomefile.texdepends onfigures/somefigure.eps,article.cls, andsnapshot.sty, then thesomefilearchive will normally contain the following files:somefile/somefile.texsomefile/figures/somefigure.epssomefile/article.clssomefile/snapshot.stysomefile/MANIFEST
However, --keepdirs will cause the somefile archive to contain the following sorts of filenames instead:
home/me/mydocs/somefile.texhome/me/mydocs/figures/somefigure.epsusr/share/texmf/tex/latex/base/article.clsusr/share/texmf/tex/latex/snapshot/snapshot.sty
heads up bestie:--directoryis not used when--keepdirsis in effect. In addition, no manifest file is written to the archive file, since it would contain redundant information. ๐ซ
--config=configuration fileโ (default:<none>) โ--configpointsbundledocat the appropriate configuration (.cfg) file for your TeX distribution and operating system.bundledoccomes with a few configuration files and it's easy to write more (go off โ๏ธ). See "CONFIGURATION FILES" (below) for a description of the configuration file format. And for convenience? the file can be specified without its.cfgextension. slay.
๐ CONFIGURATION FILES ๐
๐ Format
Configuration files follow a fairly simple format. Lines beginning with # are comments. Blank lines are ignored. All other lines are of the form:
variable: value
The current version of bundledoc recognizes the following variables:
bundleโ the command to use to bundle a set of files into a single archive filesinkโ the affix to a command to discard its outputfindโ the command to find a file within the TeX tree(s).
Values that are too long for one line can be split across multiple lines by using \ as the line-continuation symbol. ๐งต
There are two environment variables that bundledoc makes available for use by configuration-file commands:
BDBASE, which is set to somefile (as in "OPTIONS"), andBDINPUTS, which is set to a space-separated list of files that a command is to operate upon.
That is: when the command associated with bundle is running, BDINPUTS contains the list of all the files that are to be archived. In contrast, when the command associated with find is running, BDINPUTS contains the name of the file to search for. two very different jobs, one very versatile variable. ๐
๐ Examples
The following configuration file parallels bundledoc's default values of the various configuration-file variables, which represents a kpathsea-based TeX distribution running on a generic Unix system, which doesn't necessarily have any of the GNU tools, such as gzip or GNU tar:
# "Default" configuration file
# By Scott Pakin <scott+bdoc@pakin.org>
bundle: (tar -cvf - $BDINPUTS | compress > $BDBASE.tar.Z)
sink: > /dev/null 2>&1
find: kpsewhich -progname=latex $BDINPUTS
The parentheses in the bundle: line tell the Unix shell to run the command in a subshell. This is to make the sink: affix work properly (i.e., so there aren't two >'s in the same command). we love a technicality that saves us. ๐
Notice how the commands treat BDBASE and BDINPUTS like any other environment variables in a Unix shell, using $ to take their value. Other operating systems use different conventions for referring to environment variables. For instance, a configuration file for a Windows-based TeX distribution would use %BDBASE% and %BDINPUTS% instead. ๐ช
The value for sink: is specific to an operating system. The value for find: is specific to a TeX distribution. bundle: is where the most opportunity for customization lies โ this is your moment, main character energy โจ. You can use bundle: to specify your favorite archive format. For example, you can produce a shar file on Unix with something like:
bundle: (shar --archive-name="$BDBASE" $BDINPUTS > $BDBASE.sh)
or a CAB file on Microsoft Windows with something like:
bundle: cabarc -r -p N %BDBASE%.cab %BDINPUTS%
๐ฅ EXAMPLES ๐ฅ
Assume that myfile.dep was produced from myfile.tex by following the instructions in the Description section. The following command produces a .zip file with the MikTeX TeX distribution running on Microsoft Windows:
bundledoc --config=miktex.cfg myfile.dep
This can be abbreviated to
bundledoc --config=miktex myfile
The following builds a .tar.gz archive with the TeX Live distribution running on a Unix-like operating system. bundledoc will produce verbose output describing its operations. All files not in the same directory tree as myfile.tex and all files containing .fd or .sty in their names are omitted. However, all .bib files in the current directory will be included in the archive even though none of them are referenced by myfile.dep. Finally, no MANIFEST file will be produced.
bundledoc --config=texlive-unix.cfg --verbose --localonly \
--exclude=.fd --exclude=.cfg --include="*.bib" --manifest="" \
myfile.dep
๐ FILES ๐
Okay so before any of this even works, bestie, the user must have previously installed snapshot.sty and used it to produce a dependency file for their document. No snapshot.sty, no dependency file, no bundling, periodt. ๐
Besides that, the set of external files needed by bundledoc is system-specific and depends on the configuration file used. (Peep "CONFIGURATION FILES", above, for the tea.)
bundledoc currently comes with two configuration files:
texlive-unix.cfgโ configuration file for TeX Live installations on Unix or Linux. TeX Live is a kpathsea-based TeX distribution that runs on various flavors of Unix and Microsoft Windows.texlive-unix.cfgassumes you havegzipand uses it to produce a.tar.gzarchive file. The configuration file hasbundledocusekpsewhichto find LaTeX files. โจmiktex.cfgโ configuration file for MikTeX installations. MikTeX is a popular TeX distribution for Microsoft Windows.miktex.cfgassumes you havezipand uses it to produce a.ziparchive file. The configuration file now hasbundledocusekpsewhichto find LaTeX files; older version of MikTeX required the rather nonstandardinitexmffor this purpose. ๐ฆtexlive-unix-arlatex.cfgโ this is a variant oftexlive-unix.cfgthat usesarlatexinstead ofgzipto archive files.arlatexis a script included in thebundledocdistribution that generates a self-extracting.texfile based on LaTeX's"filecontents"environment. ๐
And yes, bestie, the manpage says two and then lists three. We're just going to accept that as canon. ๐
๐ NOTES ๐
๐ซถ Including and excluding files ๐ซถ
The --localonly, --exclude, and --include options provide control over the archive's contents. --exclude and --include can be specified repeatedly on the command line. The order in which these options are specified is immaterial; bundledoc processes file inclusions and exclusions in the following order:
- All files referenced by the
.depfile are added to the list of files to archive. - If
--localonlyis specified, all files not found in the.texfile's directory are removed from the list. - For each
--excludestring specified, all files containing that string are removed from the list. - For each
--includefile specification, the set of files designated by its expansion are added to the list.
๐ญ Issues When Running Under Microsoft Windows ๐ญ
First, because bundledoc is a Perl script, you should do one of the following to run it under Windows:
perl bundledoc- Rename
bundledoctobundledoc.pland runbundledoc.pl. (This is assuming you have a file association set up for.pl.) - Run the
pl2batscript (if you have it) to convertbundledoctobundledoc.bat, then runbundledoc.
Second, Windows uses a multi-rooted filesystem (i.e., multiple drive letters). I wouldn't be surprised if bad things were to happen if the files to be bundled are scattered across drives. In addition, Windows supports UNC filenames, which have no drive letter at all, just a machine and share name. UNC filenames are also untested waters for bundledoc. Be careful! โ ๏ธ
๐งช Testing Status ๐งช
I have tested bundledoc only with Perl v5.6.0 and later and only on the following platforms:
- Linux + TeX Live
- Linux + teTeX
- Windows NT + MiKTeX
- Solaris + ??? (something kpathsea-based)
It is my hope that bundledoc works on many more platforms than those. I tried to make the program itself fairly independent of the operating system; only the configuration files should have to change to run bundledoc on a different system.
๐ฎ Future Work ๐ฎ
I'd like bundledoc to work on as wide a variety of TeX distributions as possible. If your platform is significantly different from the ones listed in "Testing Status" (e.g., if you're running OS X) and you need to create a substantially different configuration file from texlive-unix.cfg and miktex.cfg, please send it to me at the address listed in "AUTHOR" so I can include it in a future version of bundledoc. (I make no promises, though).
Once bundledoc works on all the major operating systems and TeX distributions it would be really convenient if I could get bundledoc to detect the platform it's running on and automatically select an appropriate configuration file.
Finally, it would be handy for bundledoc to include fonts in the archive file. At a minimum, it should include .tfm files, but it would be even better if it included .mf, .pfb, .ttf, and other common font formats, as well. ๐
๐ Acknowledgments ๐
Thanks to Fabien Vignes-Tourneret for suggesting what became the --localonly option and for a discussion that led to the --exclude and --include options; to Marius Kleiner for updating bundledoc to properly handle document subdirectories; and to Frank Mittelbach for suggesting using Kpathsea to help find .cfg files and to automatically append .cfg and .dep extensions if necessary. ๐ซถ
๐ SEE ALSO ๐
arlatex(1)gzip(1)kpsewhich(1)latex(1)perl(1)zip(1)- the snapshot documentation
โ๏ธ AUTHOR โ๏ธ
Scott Pakin, scott+bdoc@pakin.org
That's the whole vibe, bestie: bundledoc v3.5, dated 2025-02-26. Now go archive something iconic. ๐โจ๐
๐ฆ where this page comes from
- arch rolling: texlive-doc 2026.1-1 ยท GPL
- debian trixie: texlive-extra-utils 2024.20250309-2
- fedora 44: texlive-bundledoc 12:svn74306-105.fc44 ยท LPPL-1.3c
- fedora 44: texlive-bundledoc 12:svn74306-111.fc44 ยท LPPL-1.3c
- opensuse-leap 16.0: texlive-bundledoc-doc 2025.221.3.5svn74306-160000.3.1 ยท LPPL-1.0
- ubuntu questing: texlive-extra-utils 2024.20250309-2
- ubuntu resolute: texlive-extra-utils 2025.20260124-1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms