0

I search a way to (re)compile several different projects at once (all assumed to be compile individually without error). Here, I present the context and the problem.

The context:

I have a topic, e.g. "Sciences", and wrote several projects to it (articles, papers). They all share a same template directory containing the skeleton main file, a "Settings" folder, an "Article" folder, an "Images" folder and a "Vocabulary" folder, set as follow:

/my/path/Topic/TeX-Template/
        Settings/
              packages.sty
              settings.sty
              macros.sty
        /Images/
              image.ewm.eps
        Vocabulary/
              vocabulary.sty
        Articles/
        topic-main.tex
        topic-corpus.tex
  • vocabulary.sty is a collection of project specific macros, i.e. \newcommand{\technicaltermA}{technical term A}.
  • topic-main.tex contains the base of the document (\documentclass{...}, etc.)
  • topic-corpus.tex contains the skeleton of the project (organized by \intput{./file.tex} lines).
  • Articles directory is empty, it will contains the section's files of the project, and input-ed in the topic-corpus.tex

Then, there's a little script "topic.sh" included in my $PATH that says:

cp -a $TOPIC/*tex .
cp -a $TOPIC/Articles
ln -s $TOPIC/Settings 
ln -s $TOPIC/Images
ln -s $TOPIC/Vocabulary

Of course, I created a bash variable $TOPIC pointing to /my/path/Topic/Topic-Template

Once I created a NewProject folder in which I executed the script, I rename the "topic-" files to "newprojectname-".

I have then many projects in the Sciences folder, for example ScienceA, ScienceB and ScienceC. They all are correctly compiled.

Now the problem: I need to correct a term "technical term A" appearing in all projects, provided by a "\technicaltermA" macro from the vocabulary.sty. Therefore, I modify the macro.

how do I apply the correction to all projects at once, without having to go in each folder and compile manually? It would require the program to jump into each folder, and compile each project with its own -main.tex file.

(Edit: <dt> removed...)

  • Welcome! What is with all the <dt> etc.? Maybe I'm missing the concept.... As the answer you've got indicates, this really isn't TeX-specific. You don't have to use make to solve it, but any solution is likely to be along those lines i.e. depend on what's available on your system outside TeX Live or MikTeX or whatever you use. A make solution is worth doing if you expect to do this a lot. Or you can write a script yourself, if it is rarer and that's easier for you. Or, if it is a one-time thing, you can just use the facilities provided by your shell directly to loop through them. – cfr Apr 3 '16 at 2:22
1

This is not a tex question, but a general compilation question. Essentially, you have to write a makefile in each directory saying how each *-main.tex is compiled. Then you have to write a root makefile which executes make in each of the subdirectories, along the following lines:

.PHONY: all default clean realclean ...

default:
    @for i in `ls | egrep "(Sciences)|(Arts)|..."`; do { $(MAKE) default -C $$i; } done
...

Yes, this is tedious. But if you provide the right dependencies, make will take care of the rest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.