Flap is a simple utility that flattens LaTeX projects. It takes a well organised LaTeX project — one you so carefully crafted — and merged it into a vulgar single LaTeX file in a flat directory.
Why? Some publishers require such a flat structure when you submit the sources of your manuscripts, and I got tired to flatten the sources by hand.
Another one? There already a couple of tools that merge latex project such as latexpand, flatex or flatten. As far as I know, they only merge TeX files, without moving graphics around. I learned recently about texdirflatten, which seems to be an alternative, but I haven’t tried it.
FLaP requires Python 3 (3.2, 3.3 and 3.4 are tested). The easiest way to install FLaP is to use pip using pip install flap
.
Alternatively, you may download the sources distribution and use python setup.py install
Use FLaP in the command line:
$> python3 -m flap project/main.tex output/directory
See also the online documentation.
If you get the change to give it a try, please report any bugs, issues or feature request using the issue tracker. Should you need any further information, feel free to email me
Here is a list of features, which are not yet supported:
-
Support for backward relative links in directives, for instance
\input{../img/foo}
. -
Support for star-form of directives, such as
\includegraphics*{foo}
-
Adjust copyright and credits in flap.init.py
-
Support for includegraphics with full path
-
Support for spaces in graphics files
-
Clean support for .tex
-
Support for relative paths (e.g. main.tex includes tex/file1.tex includes tex/file2.tex)