2

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!

2

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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