Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?
share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
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 Jan 8 '13 at 13:33
    
@slhck wrapfig is written that way. It doesn't like sections or lists following it immediately. –  Harish Kumar Jan 8 '13 at 13:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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