I try to make my resume in latex. Today I tried the whole day to place a picture beside my name and address, but I don't get it working.
This is the latex code I have so far:
\documentclass{article}
\usepackage{titlesec}
\usepackage{titling}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\titleformat{\section}[frame]
{\huge}
{\thesection}
{0em}
{\filcenter}[\titlerule]
\titleformat{\subsection}[runin]
{\Large \bfseries}
{\hspace{-5mm}}
{0em}
{}
\titlespacing{\subsection}
{0em}{0em}{4em}
\renewcommand{\maketitle}
{
\begin{center}
{\huge \bfseries
\theauthor\\}
\vspace{0.25em}
Anystreet 1
\\
0000 Any
\\
(00) 00 000 00 00 $\vert$ [email protected]
\end{center}
}
\begin{document}
\author{hans muster}
\maketitle
\begin{figure}[h]
\includegraphics[scale=0.15, right]{muster.jpg}
\end{figure}
\end{document}
CodePudding user response:
The one purpose of floating environments like figure
is that latex will select a good place for it. If you need something at a specific position, don't use a float.
Instead you could for example use minipages to include the image in your title:
\documentclass{article}
\usepackage{titlesec}
\usepackage{titling}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\titleformat{\section}[frame]
{\huge}
{\thesection}
{0em}
{\filcenter}[\titlerule]
\titleformat{\subsection}[runin]
{\Large \bfseries}
{\hspace{-5mm}}
{0em}
{}
\titlespacing{\subsection}
{0em}{0em}{4em}
\renewcommand{\maketitle}{
\begin{minipage}{.2\textwidth}
\includegraphics[width=\linewidth]{example-image-duck}
\end{minipage}\hfill%
\begin{minipage}{.5\textwidth}
\centering
{\huge \bfseries
\theauthor\\}
\vspace{0.25em}
Anystreet 1
\\
0000 Any
\\
(00) 00 000 00 00 $\vert$ [email protected]
\end{minipage}\hfill%
\begin{minipage}{.2\textwidth}
\includegraphics[width=\linewidth]{example-image-duck}
\end{minipage}%
}
\begin{document}
\author{hans muster}
\maketitle
\end{document}