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.
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.
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:
\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}
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.
verbatimtag 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