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 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.

share|improve this question
    
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 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. –  Claudio Fiandrino Mar 21 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. :) –  zeroth Mar 21 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 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 at 10:51

2 Answers 2

up vote 8 down vote accepted

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=...]{...}
share|improve this answer

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.

share|improve this answer

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.