2

I was wondering if I can force an image to be behind the text; without affecting the text. Or the other way around which is to place the text on top of the image.

Here are the examples of my trials:

\begin{figure}[h!]
    \begin{center}
    \resizebox{1\textwidth}{!}{\includegraphics{Figures/Chapter_3/browserWindow}}
    \end{center}
\end{figure}

I also tried \begin{figure}[htb], and \begin{figure}[H]. I tried following this suggestion but nothing happens so I use the regular way of creating a figure. notice that the middle of the figure is also transparent. Also as you can see from the size of the figure is not matching with the \textwidth. How to adjust this so that the lines of the window frame would match the \textwidth?

\begin{figure}[htb]
    \centering
    \includegraphics[width = 1\textwidth]{Figures/Chapter_3/browserWindow}
\end{figure}

Here is he demo and in case you want to work with the image here is a link.

enter image description here

UPDATE:

    \begin{tikzpicture}[remember picture, overlay]
    \node[opacity=1,inner sep=0pt] at (current page.center) {%
        \includegraphics[%
            width=0.82\paperwidth,%
            height=0.43\paperheight%
        ]{Figures/Chapter_3/browserWindow}%
    }; %--- Including the background picture
    \end{tikzpicture}

Is there a way to adjust the position so that it can at the beginning of the chapter?

enter image description here


FINAL SOLUTION:

Thanks to @Marian G's answer, I was able to adjust this as I wanted. I simply used this:

\includegraphics[%
    width=1.15\textwidth,
    height=0.83\textwidth,
    align=t,
    smash=br,
    vshift=1cm,     % adjust the vertical position
    hshift=-1.5cm     % adjust the horizontal position
]{Figures/Chapter_3/browserWindow}%

Some text in the paragraph.

\vskip 0.2in %I had to use some space because the images was overlapping.

\begin{figure}[htb]
    \centering
    \includegraphics[width=0.7\textwidth{Figures/Chapter_3/technology_icons}
    \caption{Technologies used : (a) HTML5, (b) CSS3, (c) JavaScript with external libraries} 
    \label{fig:htmlIcons}
\end{figure}

enter image description here

7
  • 2
    Related: tex.stackexchange.com/a/485284/156344
    – user156344
    Apr 22, 2019 at 16:31
  • If you wish to add a specific text on top of the image the following might be interesting: How to superimpose LaTeX on a picture? If this is more about a background like image, maybe the following might suit your needs: How to use background image in LaTeX?
    – leandriis
    Apr 22, 2019 at 16:32
  • Thanks @JouleV. Apr 22, 2019 at 16:32
  • @JouleV, this works fine. a tiny issue tho. I tried working with the \tikz[overlay, remember picture] \draw [darkpowderblue, thick] ([xshift=0.5cm,yshift=-0.5cm]current page.north west) rectangle ([xshift=-0.5cm,yshift=0.5cm]current page.south east); %---making a coloured box but nothing changes. Apr 22, 2019 at 17:09
  • 1
    So basically you just wanted to remove the white space at the top of your image. \includegraphics has a [clip=true, trim=...] option for that. Apr 22, 2019 at 21:50

1 Answer 1

4

The following approach doesn't use tikz macros and can be of your interest. As far as I understand your claim, I will present a solution based on the package graphbox that enables to add some keys to the usual \includegraphics-command.

Code

\documentclass{article}

\usepackage{graphbox}   % allows to add keys to \includegraphics
\usepackage{lipsum}     % only for testing purposes


\begin{document}

\section{My dummy title}
%-----------------------
\lipsum[1]


\section{Another title}
%-----------------------
\includegraphics
    [%
    width=\textwidth,
    align=t,
    smash=br,
%   hide,           % hides graphics (if required)
%   vshift=-1cm     % adjust the vertical position
    ]
    {example-image}%% add your graphics file
\lipsum[2-4]

\end{document}

Output enter image description here

1
  • This works great thanks a lot for your answer. I updated the final solution to my question Apr 22, 2019 at 20:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .