2

I want to add my photo in moderncv environment! Itemize positioning and other floats are missed up! I tried to use \textpos package but didn't work! Here is the code

\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{adjustbox}
\usepackage[absolute,overlay]{textpos}

\begin{wrapfigure}{r}{0.3\textwidth}
    \vspace*{-2.3cm}
    \hspace*{-2cm}
    \centering
    \adjustbox{cframe=color1}{\includegraphics[scale=0.07]{photo}}
\end{wrapfigure}

and with \textpos

\begin{textblock}{7}(7,7)
    \begin{figure}
        \includegraphics[scale=0.7]{photo}
    \end{figure}
\end{textblock}

I get these errors: Environment \begin{figure} is undefined and textblock ended with \end{figure}

  • 1
    Simply use \includegraphics without wrap figure or figure environments. If it is a photo, moderncv provides a macro. No need of this exercise. – user11232 Feb 22 '14 at 11:48
  • I want to add it in a specific place next to a section I added as Personal Information – Odin Feb 22 '14 at 11:50
  • with \includegraphics I can't fix it in absolute position like this – Odin Feb 22 '14 at 11:56
  • I tried that before but for a reason the photo is all white! Maybe I have to cleanup the packages I am using :D Anyway thanks! – Odin Feb 22 '14 at 11:59
  • \begin{textblock}{7}(4,7) \includegraphics[scale=0.7]{photo} \end{textblock} works for me. – user11232 Feb 22 '14 at 12:00
1

you can't use wrapfigure in this context as it demands too much for it to be properly placed. On the other hand, if you want to overlay the photo, you can use textpos package but don't put your photo inside a figure environment as it is a float. This is how it should be done:

\documentclass{article}
\usepackage{graphicx}
\usepackage[absolute,overlay]{textpos}
\begin{document}
  \begin{textblock}{7}(7,7)                   %% adjust position
        \includegraphics[scale=0.7]{photo}
\end{textblock}
\end{document}

enter image description here

Another option will be to use tikz with remember picture, andoverlay` options:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
  \begin{tikzpicture}[remember picture,overlay]
        \node at ($(current page.north) +(0,-6in)$){\includegraphics[scale=0.7]{photo}};
\end{tikzpicture}
\end{document}

Here you can use page location hooks so that job becomes easy.

  • Actually textpos did the job as I said ;) I used it first time correctly without \begin{figure} but I had a package ripping off my floats! I changed myself in the cls files and used different stuff before! Thanks – Odin Feb 22 '14 at 17:47
0

You're suffering from two entirely reasonable misapprehensions.

The first thing to point out is that the {figure} environment in fact has very little to do with graphics: \includegraphics may go anywhere, and a {figure} may contain just text. What {figure} does is (a) to provide the floating of a figure (of whatever type) away from the point of the file where it's described, and (b) to support a \caption which lets you associate text and a figure number (and LoF entry) with the content, and (c) nothing else.

Secondly, the {wrapfigure} environment is for the very specific case where you want text to wrap around a figure: the figure appears in the run of text, and the text fits in around it. That's also largely independent of what – text or graphics – is contained in the environment.

Or, put another way, the focus on 'figure' has meant that you've made this problem a little harder for yourself than it need be. If you think of the \includegraphics as a big character, and work out how to place that where you want it (and @harish-kumar has a fine illustration of how to do that with {textblock}), you'll get to the goal faster.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.