I use pdflatex on linux.

I would like to put a transparent colored box on top of an included PDF. The goal is to highlight some line of the PDF. The green box has to be transparent: I mean the white of the pdf becomes green and the black remains black. Without background (see Test2 in the example) everything is fine. But the colored box cover the PDF completely. I putted texts in my example, but at the end I need empty box with a given size highlighting a single line.

\usepackage{xr-hyper} % multi-document ref
% 1pt = 035146 mm
    \put(200,300){\pgfsetfillopacity{0.5}\colorbox{green}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{Test1 Test1 Test1 Test1 Test1 Test1 Test1 Test1 Test1 Test1 }}}%
    \put(200,350){Test2 Test2 Test2 Test2 Test2 Test2 Test2 Test2 Test2 }

The result for now is: pic

EDIT After removing the transparent package:

enter image description here

  • I don't understand. What is the problem with your example? – Ulrike Fischer Jan 22 at 8:43
  • @UlrikeFischer The problem is that the green rectangle has completelly covered the PDF Text: "Chapter II: ...." To be correct it should be transparent (green but transparent) – PeptideChain Jan 22 at 8:44
  • I don't have your pdf, but with example-image-a4 (and slightly changed coordinates) it works fine. How are you compiling? What texsystem do you have? – Ulrike Fischer Jan 22 at 8:46
  • @UlrikeFischer I use pdflatex (no special option) with TexLive on Fedora. What is example-image-a4? – PeptideChain Jan 22 at 8:49
  • You are loading the transparent package. Try to remove it. Older version of the package were incompatible with tikz opacitiy. – Ulrike Fischer Jan 22 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.