13

I am currently editing a relatively long document in arabic with the package arabtex, everything is going quite fine but the compilation takes several minutes. As I need to edit only small parts at once, I need to recompile only modified parts. I can accept pagebreaks between these parts.

I already tried input, include and subfiles packages, but they all seem to recompile the whole document even if nothing changed.

I would like to precise that I need, at any time, the whole document to be complete as

  1. my contributions are only comments that can be inserted anywhere in the document
  2. the editing is intended to be a collaborative with other persons on several platforms. So I cannot consider the includeonly solution.

I considered using several separate documents and merging the pdfs in a single one, but the compilation process becomes a bit more tedious and not easy to use.

Is there an elegant way to do so ?

karlkoeller
  • 124,410
  • 1
    Welcome to TeX.sx! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – masu Dec 08 '13 at 11:34
  • WinEdt has a tool to compile just a selected part of your text, but you are probably not interested in it... – karlkoeller Dec 08 '13 at 12:11
  • Maybe using standalone? Each part is a standalone document, and they can be combined... – Dror Dec 08 '13 at 15:13
  • @karlkoeller thank you for the suggestion, even if this is not exactly what I need, being able to precompile some parts may save a lot of time. – Aquadarius Dec 08 '13 at 17:06
  • @Dror Good suggestion, however, it seems to not work for an unknown reason (the standalone pdf is empty...). – Aquadarius Dec 08 '13 at 17:32
  • Maybe try, at least for the "Work-in-progress" phase, to use the pdfpages packages? Create the separate PDF normally and join them using the \includepdf provided by the package. – Dror Dec 10 '13 at 07:57
  • I'd call this a (late) duplicate of https://tex.stackexchange.com/q/142417/54046 . Note that creating and merging separate PDFs does not always work, as described in https://tex.stackexchange.com/a/375792/54046 . – Robert Pollak Oct 13 '23 at 07:50

1 Answers1

2

Here is a MWE which employs the standalone package. The main file main.tex is the following:

\documentclass{article}
\usepackage{standalone}
\begin{document}

\input{file1}

\pagebreak

\input{file2}

\end{document}

In turn, file1.tex is:

\documentclass{standalone}

\begin{document}
Hello world!
\end{document}

and file2.tex is:

\documentclass{standalone}

\begin{document}
Foo bar
\end{document}

Both fil1.tex and file2.tex can be compiled as standalone documents, and the main file can be compiled as well.

I'm not sure whether this will solve the problem of the OP, but it might be a starting point.

Dror
  • 22,613
  • 1
    aiui, dror's code doesn't meet the requirement; the op seems to want the analogue of code-library binding when linking an executable; this is something that tex simply doesn't do ... ime (which doesn't include context, though i would only be slightly amazed to learn that context has solved the problem, too). – wasteofspace Dec 09 '13 at 11:07
  • @wasteofspace that's exaclty what I need. May be you're right and it is completely out of the scope of latex, because now I understand from the latex philosophy that each compilation pass can modify the output document even if the source is not modified. – Aquadarius Dec 09 '13 at 19:55
  • @Dror I will try this at home, but is there a way to check if the document has been recompiled or not ? – Aquadarius Dec 09 '13 at 19:59
  • No when I think about it again, I believe @wasteofspace is right. This won't do what you want - whenever you compile the main document it will recompile everything as far as I can tell. – Dror Dec 10 '13 at 07:54