1

I would like to achieve a result such as the one in the link: https://drive.google.com/file/d/1kI7bX69BMKjOMyaFnwjoqBgdWJ9M-AK4/view

enter image description here

I thought of doing some kind of gradient to the image, but the text still (logically) does not go over the image. And I have a background already, so I could not just use it as a background with gradient...

Any tips?

2 Answers2

2

This may (or may not) serve the purpose of overlapping images with text along either the top or bottom (not sides). However, because it uses opacity and the page is typeset in order of occurrence, the appearance of overlapped top will slightly differ from overlapped bottom. In particular, text overlapping the bottom of the image, because it is placed on top, will be fully dark. Text overlapping the top, because it is under the image, will be a little washed out with opacity.

The macro I provide is

\overlap{<top overlap>}{<bottom overlap>}{<content>}

The MWE:

\documentclass{article}
\usepackage{graphicx,lipsum,tikz}
\newcommand\overlap[3]{%
  \setbox0=\hbox{\raisebox{-\dimexpr#2}{#3}}%
  \dp0=0pt\relax
  \ht0=\dimexpr\ht0-#1\relax
  \begin{tikzpicture}
  \node[opacity=.4]{\copy0};
  \end{tikzpicture}
}
\begin{document}
\lipsum[1]

\centerline{% \overlap{0pt}{20pt}{\includegraphics[height=60pt]{example-image}}% }

\lipsum[2]

\centerline{% \overlap{20pt}{0pt}{\includegraphics[height=60pt]{example-image}}% }

\lipsum[3] \end{document}

enter image description here

1

Use tikz with option remember picture, overlay. Note that you have to put the picture at begin of current page.

\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{tikzpagenodes}

\begin{document} \tikz[remember picture,overlay]{ \fill[red!30] (current page text area.north west) rectangle ++(\textwidth, -6cm); } \lipsum[1] \end{document}

enter image description here

ZhiyuanLck
  • 4,516
  • So that means that if I only wanted the last paragraph to overlap with an image at the bottom, it would not be possible? Or could I do some other adjustments? I think I will experiment with this too once at home. – Arturiki Jul 15 '20 at 11:35
  • Yeah, I think it is a difficult thing. – ZhiyuanLck Jul 15 '20 at 12:03
  • Such a pity. I especially was looking for a bottom image blending. – Arturiki Jul 15 '20 at 12:17
  • But not impossible. The origin will be at the tikzpicture location in the source (equivalent to \hbox{}) so if you know how how big the paragraph is, you can position an image using relative coordinates. – John Kormylo Jul 15 '20 at 12:20
  • I will try today some things out, see if it works! – Arturiki Jul 15 '20 at 12:34