# [texhax] Passing Command Line Arguments to a Latex document

Reinhard Kotucha reinhard.kotucha at web.de
Thu Jul 12 02:56:55 CEST 2007

Oleg Katsitadze writes:

> On Wed, Jul 11, 2007 at 12:57:41AM +0200, Reinhard Kotucha wrote:

> > \def\process#1 {\message{^^J#1}\par}
> > \everypar{\setbox0\lastbox\process}
>
> This is interesting, but I don't see how this solves the OP's problem.
> AFAICS, this code makes subsequent words go to the console/log,
> instead of being typeset.  I can't imagine how this can be applied to
> passing arguments.

pdfpages is a nice thing, but it is sometimes annoying that you have
to write a .tex file whenever you need it.

It is often more convenient to be able to pass the arguments to
\includepdf on the command line.

The following script allows you to pass command-line arguments to TeX.

You can say:

pdflatex pdfselect '[pages={3,5}]{my_pdf_file}'

_____ pdfselect.tex ____________________
\documentclass{minimal}
\usepackage{pdfpages}
\pagestyle{empty}
\DeclareGraphicsRule{.PDF}{pdf}{.PDF}{}
\DeclareGraphicsExtensions{.pdf,.PDF}
\def\doit#1 {\begin{document}%
\includepdf#1
\end{document}}
\everypar{\setbox0\lastbox\doit}
________________________________________

Regards,
Reinhard

--
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------