3

I have this short example derived from this XeTeX CV template, which uses margin notes to show years. You can use the Mandrill picture for pic.jpg, and you could also use the original template to reproduce the issue instead of this SSCE.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[10pt, a4paper]{article}
\usepackage{fontspec} 

% DOCUMENT LAYOUT
\usepackage{geometry} 
\geometry{a4paper, textwidth=5.5in, textheight=8.5in, marginparsep=7pt, marginparwidth=.6in}
\setlength\parindent{0in}

% FONTS
\usepackage{xunicode}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text} % converts LaTeX specials (``quotes'' --- dashes etc.) to unicode
\setromanfont [Ligatures={Common},Numbers={OldStyle}]{Adobe Caslon Pro}
\setmonofont[Scale=0.8]{Monaco} 
\setsansfont[Scale=0.9]{Optima Regular} 

% ---- MARGIN YEARS
\usepackage{marginnote}
\newcommand{\years}[1]{\marginnote{\scriptsize #1}}
\renewcommand*{\raggedleftmarginnote}{}
\setlength{\marginparsep}{7pt}
\reversemarginpar

\usepackage{wrapfig}

% DOCUMENT
\begin{document}

\begin{wrapfigure}[1]{r}{.2\linewidth}
  \centering
  \includegraphics[width=1\linewidth]{pic.jpg}
\end{wrapfigure}

\section*{Education}
\noindent
\years{2011} Mandrill College\\

\end{document}

Ideally, it should show the following:

But as soon as I include the wrapfigure, this becomes:

The margin note simply disappears. There are no warnings displayed. Now, I've already observed that the placement of the figure relative to where the margin notes should be displayed doesn't matter. In my real CV I'd place the figure top right and the sections with Education etc. would be much further down the page.

So my questions

  • Why does this fail?
  • What do I have to change to have the years displayed again?
  • If I can't use wrapfig to insert a floating figure at the top right no matter what the text, what should I use instead?

1 Answer 1

3

Don't start a section right after the wrapfigure. Put some paragraph in between wrapfigure and section:

\begin{document}
%\lipsum[1]
\begin{wrapfigure}[6]{r}{.2\linewidth}
  \centering
  \includegraphics[width=1\linewidth]{example-image}
\end{wrapfigure}
\lipsum[2]                            %% put a paragraph here

\section*{Education}
\noindent
\years{2011} Mandrill College\\

\end{document}

enter image description here

2
  • Looks good. In my case there was more text before the section which I simply put into one big \paragraph{}. Do you have any idea why this happens, exactly?
    – slhck
    Commented Jan 8, 2013 at 13:33
  • @slhck wrapfig is written that way. It doesn't like sections or lists following it immediately.
    – user11232
    Commented Jan 8, 2013 at 13:34

You must log in to answer this question.

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