0

I am preparing a series of lectures using Beamer (both article mode and slides mode). My set of files looks something like this:

Lectures\
    article.tex
    slides.tex
    main.tex
    mainarticle.tex
    mainslides.tex
    Lecture1\
        main.tex
        article.tex
        slides.tex
    Lecture2\
        main.tex
        article.tex
        slides.tex

Both slides.tex and article.tex uses \input{main} in each of the stand alone lectures.

Now I would like to compile a "master" version of the lectures that simply includes all the standalone lectures. I am trying this in two ways:

  1. In Lecture/main.tex I have:

     \input{Lecture1/main.tex}
     \input{Lecture2/main.tex}
    
  2. In Lectures/mainarticle.tex I have:

     \includepdf[pages=-]{Lecture1/article.pdf}
     \includepdf[pages=-]{Lecture2/article.pdf}
    

    and in Lectures/mainslides.tex I have:

     \includepdf[pages=-]{Lecture1/slides.pdf}
     \includepdf[pages=-]{Lecture2/slides.pdf}
    

Each of these two options has a drawback:

  1. In some of the lectures I use InputVerbatim from the fancyvrb package to include some source code files. When I compile the "master" article or slides, the source code file can't be found because the relative path doesn't exist as it does when compiling the standalone lecture.
  2. The resulting mainslides.pdfhas blank (white) pages where there should be the content of each of the lectures.

I would prefer to do option 1, but can live with option 2. Is this even possible?

  • To overcome the two different paths problem, you could use\IfFileExists{}{}{}: check if it is in one location, if yes use it here, if not use it from the other path. – samcarter_is_at_topanswers.xyz Feb 13 '17 at 21:48
  • I knew that this was a solved problem, I just didn't know where to start looking. This solved my problem! @samcarter if you create an answer, I'll be happy to accept it. – jlconlin Feb 13 '17 at 22:13
  • 1
    done __________ – samcarter_is_at_topanswers.xyz Feb 13 '17 at 22:25
3

\IfFileExists can help with the two choices for the path. A simple example:

\IfFileExists{./filename.pdf} %if the file exist in the current directory 
    {\includegraphic{./filename}} % use this file
    {\includegraphic{./Lecture2/filename}} % if not use from subfolder
| improve this answer | |

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.