Take the 2-minute tour ×
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.

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 :

\documentclass{article}
...
\newcommand{\specialpath}[0]{../foo/}
\input{\specialpath extracommands}
...
\begin{document}
    \input{introduction}
    ...
\end{document}

I want to have:

\documentclass{article}
...
% Content of ../foo/extracommands.tex
\usepackage{minted}
\newcommand{\whatever}
% end
...
\begin{document}
    % Content of introduction.tex
    \section{Introduction}
    \lipsum[1-4] % Or even the developpement of the command
    % end
    ...
\end{document}

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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new 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
show 1 more comment

1 Answer 1

I think you want to use \listfiles.

share|improve this answer
add comment