1

How to add a watermark inside some image included with \includegraphics (or other ways, if \includegraphics doesn’t allow it)? I don’t talk about a document wide watermarks, or watermarks witch take the wool page, but just put a little image in the top right corner of some images.

As example, with the following MWE:

\documentclass[a4paper,12pt]{article}

\usepackage[english]{babel}
\usepackage{graphicx}

\begin{document}

\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{example-image-a}
  \caption{Main image}
\end{figure}
\end{document}

I try to put example-image-b in 1cm×1cm size in the top right corner.

Is it possible with \includegraphics or should I change the way to do it?

1

1 Answer 1

3

You can always print something over something else. The main problem is to get to the right top corner. One way is e.g.

\documentclass[a4paper,12pt]{article}

    \usepackage[english]{babel}
    \usepackage{graphicx}

    \begin{document}

    \begin{figure}
      \centering
      \raisebox{-\height}{\includegraphics[width=0.5\textwidth]{example-image-a}}%
      \hspace{-1cm}%
      \raisebox{-\height}{\includegraphics[width=1cm]{example-image-b}}
      \caption{Main image}
    \end{figure}
    \end{document}

enter image description here

4
  • 1
    Why not \raisebox{-\height}{\includegraphics[width=0.5\textwidth]{example-image-a}}% \raisebox{-\height}{\makebox[0pt][r]{\includegraphics[width=1cm]{example-image-b}}}?
    – user194703
    Apr 26, 2020 at 9:57
  • @Schrödinger'scat yes, would work to. But with the \hspace variant is imho easier to understand how move it out of the corner. Apr 26, 2020 at 10:13
  • 1
    Yes, sure, but if one wants to change the width one has to do it twice.
    – user194703
    Apr 26, 2020 at 10:15
  • @Schrödinger'scat yes, but I didn't try to write the most effective interface (in this case I would have written a command with xparse and expl3 and a number of keys ...) but something that can help to understand the main principe. Apr 26, 2020 at 10:41

You must log in to answer this question.

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