1

For my courses in informatics, I write a LaTeX document containing a number of examination questions each semester. For some reasons, I don't want to break this document into particular TeX files. Therefore, I created a command which performs some enumeration and formatting, each examination question is a \section using this command.

I am using \pagesel in order to create particular PDF files from this LaTeX file. This is ok, but a little inflexible - since the examination questions can have different length and therefore are occupying different numbers of pages in the PDF.

My question is: is there a chance to create PDF files based on the range given by the \section? The optimal solution would be to have a command which simply writes out the whole document, divided in separate PDF files, each representing one section. I made intensive research to find such a possibility, but all solutions I found are based on page number ranges (like \pagesel). Thanks for the help!

Romain Picot
  • 6,730
  • 4
  • 28
  • 58
  • If each section ('question') starts on a new page, it's possible to extract the page range for sections –  Jul 20 '15 at 09:36
  • Sorry it's unclear, you want to compile only one particular section? or a particular part of a given section? can you explain more? – touhami Jul 20 '15 at 11:45
  • @touhami -- The last paragraph explains both of your questions: No, all sections should be compiled and they should be complete, but each in a separate pdf. – Ruben Jul 20 '15 at 13:23
  • @Christian -- Yes, this would be possible. But I am not so good in TeX programming, so I hoped, that there is an existing solution. – Thomas Mechlinski Jul 20 '15 at 15:16
  • @touhami + Ruben -- Yes, Ruben is right. If I have 5 sections in my document, I want to get 5 PDF files at the end. – Thomas Mechlinski Jul 20 '15 at 15:17
  • you can do this using answers or filecontents packages, but you need to use environment rather then command: \begin{section}{pdffile1}...\end{section} this will create a pdffile1.tex and you can compile this file using write18 option – touhami Jul 20 '15 at 16:19
  • you can see http://tex.stackexchange.com/questions/31334/how-to-create-individual-chapter-pdfs or http://tex.stackexchange.com/questions/74243/automatically-create-two-pdf-output-files-from-one-tex-file – touhami Jul 20 '15 at 16:22
  • @ThomasMechlinski if you still looking for answer, please add a minimal example of your code I'll try – touhami Jul 20 '15 at 22:34
  • @touhami -- thanks for the good ideas! I tried pdfsam and it could be one approach - though I prefer a command line solution. I will have a look on the other approaches as well. – Thomas Mechlinski Jul 21 '15 at 13:02

0 Answers0