I have a PDF with a math excercise and space to write the solution. I know a bit math-related Tex like $ \sqrt2 = 2^{1/2} $.

My goal is to print the result so I have excercise and solution on one page.

  • As far as I understand the verbatim tag is just a mistake. This is about combining TeX with an already existing PDF. Lester writes he want to insert TeX into PDF, but rather the solution will be the other way around.
    – pst
    Mar 21 '14 at 10:41
  • 2
    I still have difficulties in understanding the exact question, but I voted for reopening to give to the OP the possibility to clarify. Mar 21 '14 at 10:46
  • 1
    The statement "I know a bit math-related Tex.." seems now completely unrelated to the question in mind. I immediately thought it had something to do with the question. @Lester, please enlighten us. :)
    – nickpapior
    Mar 21 '14 at 10:48
  • My interpretation: "I got this math exam. I know a bit math-relatex TeX, so I thought I would use TeX to fill in the answers."
    – pst
    Mar 21 '14 at 10:49
  • 1
    That is I think the answer is something like this (supposing the exam is just one page for simplicity). (Maybe it's a breach of etiquette to answer before the question is approved, but this seems to be the easiest way to explain.) \documentclass{article} \usepackage{pdfpages} \usepackage{tikz} \begin{document} \includepdf[pagecommand={\thispagestyle{empty} \begin{tikzpicture}[remember picture, overlay] \node at (3, -11) { $\sqrt2 = 2^{1/2}$}; \end{tikzpicture}}]{exercise.pdf} \end{document}
    – pst
    Mar 21 '14 at 10:51

Don't insert TeX into the the PDF, but insert the PDF into your TeX, and you can use pdfpages for that. Here is an example of how that text you wrote can be put somewhere on the page of a one-page exercise.pdf:


  \begin{tikzpicture}[remember picture, overlay]
    \node at (3, -11) { $\sqrt2 = 2^{1/2}$ };

If the exam is several pages you can use several \includepdf, adding page numbers to them, like:

\includepdf[pages=1, pagecommand=...]{...}

You might want to check out the "Exam" document class. You can use it to write an assignment or exam in LaTeX and include space for the the solutions (but not include the solutions themselves). Then you can change one statement and print another copy that includes solutions.

The only other way I can think of to do what you seem to want is to do a lot of trimming and inserting pdf's of the solutions. This would be very inefficient.

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.