tags:

views:

137

answers:

2

My work has over 24 pages in Latex. I need only the abstract and introduction in pdf. How can you compile only the first two pages?

+3  A: 

I'd just make a new file with only the abstract and introduction and compile that.

Actually, if this is not just a one-time thing, I'd use three files:

absintro.tex:

\begin{abstract}
  ...
\end{abstract}
...introduction...

onlyabsintro.tex:

...
\begin{document}
    \include{absintro.tex}
\end{document}

fullreport.tex:

...
\begin{document}
   \include{absintro.tex}
   ...other stuff...
\end{document}

(Obviously the filenames can be whatever you want, this just shows the structure) You can compile onlyabsintro.tex to get only the abstract and introduction, or fullreport.tex to get the whole thing.

David Zaslavsky
Good advice here. There is also much to be said for using a makefile (or similar build support mechanism) to manage all this for you.
dmckee
+5  A: 

In addition to David's good advice, you could simple compile the whole thing, then extract the pages you want from the finished product. This might be the easiest approach for a one time task.

If you compile to PDF, consider using pdftk, which would let you use a command like:

pdftk A=one.pdf cat A1-2 output intro.pdf
dmckee
This could be a better answer if it gave a quick demonstration of how to extract the first couple of pages from the finished product.
Rob Kennedy
'K. Mind you, there are other tools the OP might prefer...
dmckee
I now understand the benefit of this answer. I have 777 pages in my current document. This solution rocks if you have more than 24 pages.
Masi