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 am using the overpic package to edit a pre-created pdf by writing notes in between the lines using \put(){$$} for each line.

Im having difficulty however using the soul package and \hl to highlight the existing writing of pdf as it highlights it in the foreground.

Is there a way to highlight the existing writing on the pdf in the background and maintain the original writing thus highlighting it?

\documentclass[11pt,a4paper]{article}
\usepackage{overpic}
\usepackage{eso-pic}
\usepackage{soul}
\begin{document}
\begin{figure}
\vspace*{-28ex}
\hspace*{-30ex}
\begin{overpic}[width=9in,page=14]{file.pdf/jpg %%}
\put(20,29){}%using the number 10,20 puts writing over the highlight below%%i need the number to be the same so where would I incorporate my vspace and hspace and textwidth for the sHIPOUT%
\AddToShipoutPictureBG*{
\put(30,115){\hl{\qquad\qquad\qquad% using \qquad to make a space for what is supposed       to be highlighted%}}}
\end{overpic}
\end{figure}
\clearpage
\begin{figure}
\vspace*{-28ex}
\hspace*{-30ex}
\begin{overpic}[width=9in,page=15]{file.pdf/jpg %%}
\end{overspace}
\end{figure}
\end{document}

mY question is how do I get the Background to line up the same as any other \put within the overpic? Ive tried vspace and hspace separately on the shipout but doesnt seem to work, also how do i get it to go on just one page?

share|improve this question
    
The $ are not needed. You're reversing the order of the \end commands. –  egreg Sep 8 '11 at 17:38
    
@egreg ok ill take the $ signs away –  john Sep 8 '11 at 17:48
    
Most of all you should write \end{overpic}\end{figure}, not the other way around. –  egreg Sep 8 '11 at 17:49
    
ahh thanks, done :) –  john Sep 8 '11 at 18:10
add comment

1 Answer

As a general comment, you need to specify your code in the order that you want things to appear in the output PDF. That is, if you want something printed on the background, that should be first, followed by what goes on top of it, etc. The output for the PDF is produced in layers, hence the suggested order of usage. So, in your case, I would presume the following should do the trick:

  1. Write your code containing the highlighting as well as the formulas; and then
  2. Superimpose the external PDF page on top of your formatting.

[2] above should not influence [1], since there is blank spaces where you want to insert equations, and the highlight should be visible since it is larger than the overlaying text.

As an easy option (in my opinion), the eso-pic package allows you to specify whether you want to print something in the background (\AddToShipoutPictureBG*), or in the foreground (\AddToShipoutPictureFG*). This way you could add the overlay/already-existing PDF using the latter, rather than the former. Or, since you tagged the question , I'm guessing that's what you're using to include the pages (via \includepdf).

If eso-pic is not your thing, then you'll have play around with positioning the \includepdf command so that the included PDF page fits overtop of your \pic(<x>,<y>){$...$} commands. This may be tricky.

As a final though, since you are placing the highlights on a line-by-line basis, you're probably not interested in line-breaking the highlights (which is something that soul's \hl{...} does offer). So, you could also just use a coloured box as your "highlighting". Here's how to use coloured boxes (using xcolor):

\documentclass{article}
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
Here is some text \colorbox{yellow}{\phantom{here is some text}}.%
\end{document}​

You choose the highlighting colour (yellow in this case), and use \phantom{...} to remove the text but get the right spacing. Of course, in your example, you will place this text using \pic.

If your already-created PDF is an image (and therefore whitespace is not transparent), this will not work regardless of what you do, since you won't be able to get in "behind" the text and "in front" of the whitespace.

share|improve this answer
    
thanks, no im not wanting to include pdf pages. I dont think you understand the question. I basically trying to put a yellow bar in the background. I also dont want to use include pdf because Ive already got used to overpic. can i not just use eso-pic aswell then add \addtoshipoutFG*{\put(){\hl{}}} –  john Sep 8 '11 at 17:50
    
OK i have managed to do it, i I able to answer a question then ask another one inside it,, –  john Sep 8 '11 at 17:59
    
@john: You need to use \AddToShipoutBG*{\put(<x>,<y>){...}} to insert the highlighting in the background. Using \...FG* will put something in the foreground, overwriting the text behind it. Have you tried it with \...BG*? –  Werner Sep 8 '11 at 18:01
    
yeah, actually it worked with \AddToPicture{} and the eso-pic package nicely, no idea why. Its just , because I also embedded a \put(){} for that line it doesnt quite line up as it would if I hadnt put add to picture if you see what I mean,,i have to play with those number which is a bit inpractical. anyway around this? '', –  john Sep 8 '11 at 18:05
    
actualy it turns out that i havent solved it at all, as it highlights everypage :( see original question –  john Sep 8 '11 at 18:12
show 11 more comments

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.