2

Hello I am using MikTex in TexStudios. I have this document:

\documentclass[paper=letter,fontsize=11pt]{scrartcl} % KOMA-article class

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm}     % Math packages
\usepackage{graphicx}                    % Enable pdflatex
\usepackage[svgnames]{xcolor}            % Colors by their 'svgnames'
\usepackage{geometry}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{float}
\usepackage{etaremune}
\usepackage{wrapfig}
\usepackage{layout}
\usepackage{multicol}
\usepackage{sectsty}        % Custom sectioning}{sectsty package)
\usepackage[export]{adjustbox}

\frenchspacing              % Better looking spacings after periods
\pagestyle{empty}           % No pagenumbers/headers/footers

%\addtolength{\voffset}{-40pt}
%\addtolength{\textheight}{20pt}

\setlength\topmargin{0pt}
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\setlength\oddsidemargin{0pt}
\setlength\textwidth{\paperwidth}
\addtolength\textwidth{-2in}
\setlength\textheight{\paperheight}
\addtolength\textheight{-2in}



\sectionfont{%                      % Change font of \section command
    \usefont{OT1}{phv}{b}{n}%       % bch-b-n: CharterBT-Bold font
    \sectionrule{0pt}{0pt}{-5pt}{3pt}}

%%% Macros
%%% ------------------------------------------------------------
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888}          % Box to align text
\newcommand{\sepspace}{\vspace*{1em}}       % Vertical space macro

\newcommand{\NewPart}[2]{\section*{\uppercase{#1} #2}}

%%% Begin Document
%%% ------------------------------------------------------------
\begin{document}
    \begin{wrapfigure}{r}{0.2\linewidth}
        \centering
        \includegraphics[height=2cm, keepaspectratio=true]{batman.jpg}
    \end{wrapfigure}    
    {\noindent\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}}\\
    Address line 1\\
    Address line 2\\
    \href{mailto:yoloj@gmail.com}{yolo@gmail.com}\\
    %\sepspace
    \NewPart{Overview}{}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat sapien neque, id elementum turpis tincidunt sed. Suspendisse potenti. Quisque malesuada odio sit amet blandit commodo. Sed sed dolor massa. Aliquam erat volutpat. Proin suscipit enim risus, id vehicula risus facilisis ac. Nullam et libero vitae mi viverra tincidunt vitae ac purus. Pellentesque ac justo et augue tincidunt maximus. Morbi velit metus, consectetur ac orci sit amet, gravida suscipit lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur est leo, rutrum eget laoreet at, imperdiet id velit. Phasellus dignissim mi sed lacus porttitor tempor et tempus justo. Aliquam at congue augue. Quisque sed velit ac neque tristique sagittis. 
    Relocation is NOT a problem.
    \NewPart{Skills}{}
    \begin{multicols}{3}
        \begin{itemize}
            \item 1
            \item 2
            \item 3
            \item 4
            \item 5
            \item 6
            \item 7
            \item 8
            \item 9
            \item 10
            \item 11
            \item 12
            \item 13
            \item 14
        \end{itemize}   
    \end{multicols}
\end{document}

I would like the picture to be on the top right side of the paper but within the text margins. The problem is that the wrapfigure offsets all the rules and the text behind it by a lot!

Expected result is: enter image description here

What I get is: enter image description here

  • 2
    Why are you even using wrapfigure for this? Does it extend into overview? If not just place it absolutely on the page or put bruce wayne in one minipage box and the inage in another. See also the adjustbox package. – daleif Jan 16 at 12:07
  • mmm I don't know what an overview is. So you are suggesting to use minipage? Will I have to do some amendments to my doc apart from adding the minipage? – Alakanu Jan 16 at 12:51
  • You have a section named "Overview" in your example..... – daleif Jan 16 at 13:07
  • ah sorry, the lower case and the grey highlight made me think it was a LaTex concept. It should not extend into overview, that's the problem. – Alakanu Jan 16 at 13:11
6

Don't use wrapfigure here as it is for running text, i.e. paragraphs, not for broken lines like this. You can fit in the image using adjustbox, which you load anyway. Just add a \hfill after the name to push the image to the right, then align the image using adjustbox keys vertically and/or horizontally and remove its official height and depth so that the image size is no longer taken into account for the line height etc.

Just replace the first lines with:

\begin{document}
    {\noindent\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}%
\hfill\adjustimage{height=2cm,valign=t,set height={0pt},set depth={0pt}}{example-image}%
}\\

I'm using \adjustimage here instead of \includegraphics, it however uses the same internals, but allows for better adjustbox integration. valign=t makes the vertical alignment according to the size of the name ("Bruce Wayne" here) and the set .. keys are for reducing its official size. If you need to have some white margin around use the margin key or maybe center=<some width, not to wide>, or left=... or right=.... See the adjustbox manual for a detailed description on these keys.

enter image description here I replaced you Batman sign with a standard example image, to make the document compileable for me.

5

wrapfig is not the right tool.

\documentclass[paper=letter,fontsize=11pt]{scrartcl} % KOMA-article class

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm}     % Math packages
\usepackage{graphicx}                    % Enable pdflatex
\usepackage[svgnames]{xcolor}            % Colors by their 'svgnames'
\usepackage{geometry}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{float}
\usepackage{etaremune}
\usepackage{layout}
\usepackage{multicol}
\usepackage{sectsty}        % Custom sectioning}{sectsty package)
\usepackage[export]{adjustbox}

\frenchspacing              % Better looking spacings after periods
\pagestyle{empty}           % No pagenumbers/headers/footers

%\addtolength{\voffset}{-40pt}
%\addtolength{\textheight}{20pt}

\setlength\topmargin{0pt}
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\setlength\oddsidemargin{0pt}
\setlength\textwidth{\paperwidth}
\addtolength\textwidth{-2in}
\setlength\textheight{\paperheight}
\addtolength\textheight{-2in}



\sectionfont{%                      % Change font of \section command
    \usefont{OT1}{phv}{b}{n}%       % bch-b-n: CharterBT-Bold font
    \sectionrule{0pt}{0pt}{-5pt}{3pt}}

%%% Macros
%%% ------------------------------------------------------------
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888}          % Box to align text
\newcommand{\sepspace}{\vspace*{1em}}       % Vertical space macro

\newcommand{\NewPart}[2]{\section*{\uppercase{#1} #2}}

%%% Begin Document
%%% ------------------------------------------------------------
\begin{document}

\noindent
\begin{minipage}{\textwidth}
  \raggedright
  {\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}\\}
  Address line 1\\
  Address line 2\\
  \href{mailto:yoloj@gmail.com}{yolo@gmail.com}
\end{minipage}%
\makebox[0pt][r]{\raisebox{-0.5\height}{\includegraphics[height=2cm]{example-image}}}

%\sepspace

\NewPart{Overview}{}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat sapien neque, id elementum turpis tincidunt sed. Suspendisse potenti. Quisque malesuada odio sit amet blandit commodo. Sed sed dolor massa. Aliquam erat volutpat. Proin suscipit enim risus, id vehicula risus facilisis ac. Nullam et libero vitae mi viverra tincidunt vitae ac purus. Pellentesque ac justo et augue tincidunt maximus. Morbi velit metus, consectetur ac orci sit amet, gravida suscipit lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur est leo, rutrum eget laoreet at, imperdiet id velit. Phasellus dignissim mi sed lacus porttitor tempor et tempus justo. Aliquam at congue augue. Quisque sed velit ac neque tristique sagittis. 
    Relocation is NOT a problem.
    \NewPart{Skills}{}
    \begin{multicols}{3}
        \begin{itemize}
            \item 1
            \item 2
            \item 3
            \item 4
            \item 5
            \item 6
            \item 7
            \item 8
            \item 9
            \item 10
            \item 11
            \item 12
            \item 13
            \item 14
        \end{itemize}   
    \end{multicols}
\end{document}

enter image description here

Some notes:

  • utf8x has been unmaintained for several years; use utf8
  • loading geometry and then doing all page setup by hand doesn't seem efficient
  • sectsty and scrartcl don't go along well

An edited version:

\documentclass[letterpaper,11pt]{article} % KOMA-article class

\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm}     % Math packages
\usepackage{graphicx}                    % Enable pdflatex
\usepackage[svgnames]{xcolor}            % Colors by their 'svgnames'
\usepackage{geometry}
\usepackage{float}
\usepackage{etaremune}
\usepackage{layout}
\usepackage{multicol}
\usepackage{sectsty}        % Custom sectioning}{sectsty package)
\usepackage[export]{adjustbox}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}

\frenchspacing              % Better looking spacings after periods
\pagestyle{empty}           % No pagenumbers/headers/footers

\geometry{margin=1in,headheight=0pt,headsep=0pt}

\sectionfont{%                      % Change font of \section command
    \usefont{OT1}{phv}{b}{n}%       % bch-b-n: CharterBT-Bold font
    \sectionrule{0pt}{0pt}{-5pt}{3pt}}

%%% Macros
%%% ------------------------------------------------------------
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888}          % Box to align text
\newcommand{\sepspace}{\vspace*{1em}}       % Vertical space macro

\newcommand{\NewPart}[2]{\section*{\uppercase{#1} #2}}

%%% Begin Document
%%% ------------------------------------------------------------
\begin{document}

\noindent
\begin{minipage}{\textwidth}
  \raggedright
  {\Huge\usefont{OT1}{phv}{b}{n}{Bruce Wayne}\\}
  Address line 1\\
  Address line 2\\
  \href{mailto:yoloj@gmail.com}{yolo@gmail.com}
\end{minipage}%
\makebox[0pt][r]{\includegraphics[height=2cm,valign=c]{example-image}}

%\sepspace

\NewPart{Overview}{}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat sapien neque, id elementum turpis tincidunt sed. Suspendisse potenti. Quisque malesuada odio sit amet blandit commodo. Sed sed dolor massa. Aliquam erat volutpat. Proin suscipit enim risus, id vehicula risus facilisis ac. Nullam et libero vitae mi viverra tincidunt vitae ac purus. Pellentesque ac justo et augue tincidunt maximus. Morbi velit metus, consectetur ac orci sit amet, gravida suscipit lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur est leo, rutrum eget laoreet at, imperdiet id velit. Phasellus dignissim mi sed lacus porttitor tempor et tempus justo. Aliquam at congue augue. Quisque sed velit ac neque tristique sagittis. 
    Relocation is NOT a problem.
    \NewPart{Skills}{}
    \begin{multicols}{3}
        \begin{itemize}
            \item 1
            \item 2
            \item 3
            \item 4
            \item 5
            \item 6
            \item 7
            \item 8
            \item 9
            \item 10
            \item 11
            \item 12
            \item 13
            \item 14
        \end{itemize}   
    \end{multicols}
\end{document}

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.