4

For example, in my main.tex I use

\input{/home/certain-directory/chapter-1.tex}

and

\input{/home/another-directory/chapter-2.tex}

I also have some figures included by their absolute paths in my /home/results-directory.

Question:

Are there any tools available for copying the source with figures to another directory (with sub-directories to hold the figures)?

Such that we can compile on another PC without manually editing the absolute paths.

Matsmath
  • 936
Hongying
  • 569

1 Answers1

0

I'm trying to write a script to perform this.

As being lack of knowledge of command line tools like xargs, find, grep, and sed, I stopped at the following (just to extract the figure names)

$ sed -n 's/.*\\includegraphics\[.*\]{\(.*\)}/\1/p'  main.tex > temp_figures
 fig/laurana_view30_50.png

At present I would edit temp_figures in Vim to vertically add cp on each line, and complete the missing extensions of figure names using c-x c-f

And rather than copy all the files with the same directory structure (with cp --parents, sadly which is not directly avaialable on Mac OSX), I would probably use the new filenames like:

sed -n 's/.*\\includegraphics\[.*\]{\(.*\)}/\1/p' main.tex | sed 's/\//_/p'

fig_laurana_view30_50.png

Hope this helps, and hopefully I would have time later to grab the necessary knowledge to find a better solution.

Hongying
  • 569
  • This doesn't answer your question since these commands are editing the absolute paths! – cfr Aug 14 '16 at 01:29