0

Suppose you have a latex file (say test.tex) which a lot of includes (\includegraphics, \include, \includepdf, bibliography files, \includestandalone etc.) sometimes with relative, sometimes with absolute path's sometimes with graphics path set or with graphics environment variable etc. Included tex files may also include other files as well.

Is there a script say bundle tex.tex which creates a tar or zip file which contains a directory containing test.tex and all includes. This may be flattend i.e. all includes on the same hirarchy level and the includepathes adapted to just filename such that it compiles if it hand it over to someone else. It may be partially flattened (for example with a subdirectory of pictures) or organized in some other sensible way with adapted paths in the sources such that it compiles after unzipping without changing anything.

For example unzip testbundle.tar will result in a directory testbundle wich contains test.tex and all includes such that for example pdflatex test.tex works on a other machine without further intervention.

student
  • 29,003
  • 1
    something like https://ctan.org/tex-archive/support/bundledoc?lang=en ? – samcarter_is_at_topanswers.xyz Jan 11 '19 at 13:27
  • 1
    see also https://tex.stackexchange.com/a/42053/36296 – samcarter_is_at_topanswers.xyz Jan 11 '19 at 13:29
  • @samcarter Thanks, thats very close to what I want. I just tested bundledoc and realized that it doesn't seem to change absolute paths to relative ones. There should also be an option to only include files which are not in the standard texlive tree. – student Jan 11 '19 at 13:38
  • Can you test if you can use the --exclude option to exclude the location of your tex instalation, something like --exclude=/usr/local/texlive/* (this probably won't work, but maybe worth a try) – samcarter_is_at_topanswers.xyz Jan 11 '19 at 13:48
  • Thanks, without star it works, i.e. bundledoc --exclude=/usr/local/texlive/ test.tex, also it works bundledoc --exclude=texlive test.tex – student Jan 11 '19 at 13:56
  • OK, then the only remaining problem is to replace the absolute with relative paths? – samcarter_is_at_topanswers.xyz Jan 11 '19 at 14:03
  • I am not sure, I tried bundledoc the first time after your comment. I think I have to test it in more complex situations... – student Jan 11 '19 at 14:09
  • 2
    Although I knew a final PDF can embed all source files / components it was not till testing here I can see the potentials of the \embedfile example So simply save 1 PDF with all the components to rebuild (this would avoid all those cases of "how do I rebuild / update my corrupted tex from just this pdf.") –  Jan 11 '19 at 14:17

0 Answers0