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.

I have written dozens of exercises as LyX documents in separate files. Each of them has its own unique number. For example: 1013, 2053 etc. I would like to create a booklet with all the exercises, arranged by their exercise number. Is there a good way to combine them without inserting files manually one after the other? and also is there a way to arrange their order ascending by exercise number?

Thanks in advance!

share|improve this question
add comment

1 Answer

It is not exactly clear what you want to achive. The following code includes all files <num>.pdf where <num> goes from start to end value, these values can be easily modified in the code. For details about how \loop...\repeat works, see Teach me how to use \loop...\repeat constructs, etc .

\documentclass{article}

\usepackage{pdfpages}

\begin{document}

\newcount\x
\x=3 % start value
\loop
\ifnum\x<10 % end value
\IfFileExists{\the\x.pdf}{\includepdf[pages=-]{\the\x.pdf}}{}
\advance\x1
\repeat

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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