1

enter image description here

I have some issues placing a figure where i want. I want the picture to be inline with my name. Any way in can place the figure in line with the text, on the left side. I have tried floating it, {wrapfigure], doesnt work.

3
  • 3
    Could you post the real code, not an image? There is a first visible error: making your image a float by using a figure environment. – Bernard Mar 25 '17 at 11:17
  • … and welcome to TeX SX! – Bernard Mar 25 '17 at 11:27
  • Thank you! I solved the issue but thanks – Steffen Hansen Mar 27 '17 at 14:21
5

Putting the image into a figure environment means that it is allowed to float around; it will be placed wherever TeX thinks it fits. But you want to have it in a fixed place.

enter image description here

\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
\hspace*{\fill}{\Huge\bfseries\sffamily Example Image}\hfill
\makebox[0cm][r]{\includegraphics[height=2cm]{example-image}}%
\bigskip

\section*{Personal Data}
\end{document}

Putting the image into \makebox[0cm][r]{...} removes its width, so it does not influence the centering of the headline. Moreover, r places it flush with the right border.

To center the headline vertically with the image, you can lower the image w.r.t. to the baseline using \raisebox.

\makebox[0cm][r]{\raisebox{-4ex}{\includegraphics[height=2cm]{example-image}}}%

enter image description here

1
  • Thank you so much, this is exactly what i was looking for! – Steffen Hansen Mar 27 '17 at 14:20
2

In the code snippet I can see in the image you posted I would do what you are asking like this:

\documentclass[]{scrartcl}

\usepackage{graphicx}
\usepackage[showframe]{geometry}

\begin{document}
\par{\hspace*{2cm}\hfill{\Huge Steffen Honsen}\hfill\includegraphics[width=2cm]{example-image}

\end{document}

The hspace has to be the width of the image to center your name correct in this example.

results

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.