TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Replace \input{fileX} by the content of fileX automatically

I'm developping a framework for managing LaTeX project's dependencies but I can't figure out if there is a simple way of getting a preprocessed LaTeX file.

For instance, if my main.tex looks like :

\input{\specialpath extracommands}

I want to have:

% Content of ../foo/extracommands.tex
% end
    % Content of introduction.tex
    \lipsum[1-4] % Or even the developpement of the command
    % end

In other words, is there an equivalent of the gcc flag -E for LaTeX (or an utility capable of doing that)?

share|improve this question

migrated from stackoverflow.com Dec 4 '11 at 2:17

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Werner, Joseph Wright Dec 4 '11 at 8:14

This question was marked as an exact duplicate of an existing question.

This is going to be difficult on a LaTeX-only level, since \include{} will most likely translate directly into a TeX primitive like \input. It might be easier to get the raw TeX out, but I'm not even sure if and how that could be done. – Kerrek SB Dec 3 '11 at 20:53
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – Werner Dec 4 '11 at 2:26
I think @Werner is right. Also, if it seems useful, I can easily code a pure (La)TeX program to do that (i.e., no need for a C or perl compiler). – Bruno Le Floch Dec 4 '11 at 4:11
@BrunoLeFloch: Of course, only TeX can parse TeX. I haven't tested, but I am sure that all those scripts will fail on \catcode\`@=1 @input{file} – Aditya Dec 4 '11 at 5:52
@Maxime: how deep do you want the expansion to go? Once you go real deep, things get very messy. Do you want more than just inlining the \input statements? E.g., what about the \usepackage, or \documentclass? – Bruno Le Floch Dec 4 '11 at 7:40

I think you want to use \listfiles.

share|improve this answer

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