Document Classesproblem with wrapfig and margins

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
zoho
Posts: 6
Joined: Fri Jun 29, 2007 9:22 pm

problem with wrapfig and margins

Post by zoho »

Hello,

I am writing a document which attempts to describe to a person who to perform certain tasks. As such I was using the list environment {description}. Later it was decided that a rating system should be implemented and place in the upper right corner of the "task" and have the text wrap around it. When I found the package wrapfig I thought all problems would be solved :)

Unfortunately wrapfig does not work with list environments but since I liked the format of that environment (first line unindented with the following lines indented), I thought I would just replicate it by using \leftskip and a negative parindent. And it works! Almost.

The problem is that wrapfig puts the "ratings" box into the right margin. Boo. Does anyone know how to force wrapfig to stay out of the margins?

Below is a tex code to explain what I mean:

Code: Select all

\documentclass[letterpaper,twoside,10pt]{report}
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage{geometry}
\usepackage[verbose]{wrapfig}
\usepackage{tabls}

\geometry{left=2cm,top=2cm,right=2cm,bottom=3cm,bindingoffset=1cm}
\setlength{\parskip}{3mm}
\setlength{\parindent}{0mm}
\setlength\tablinesep{5pt}
\setlength\arraylinesep{0pt}
\setlength\extrarulesep{3pt}

\begin{document}

\chapter{Sample Event}
{\parindent=-9mm
\addtolength\leftskip{9mm}
\begin{wraptable}{r}{0.30\textwidth}
	\vspace*{-25pt}
		\begin{tabular*}{0.30\textwidth}{@{\extracolsep{\fill}}|ll|}
			\hline			
			\textbf{1:} & test\\
			\textbf{2:} & test\\
			\textbf{3:} & test\\
			\textbf{4:} & test\\
			\textbf{5:} & test\\
			\hline		
		\end{tabular*}
	\vspace*{-25pt}
\end{wraptable}

\indent\hspace{-9mm}\textbf{Who:} some people.

\textbf{When:} At the break of dawn. Every tuesday of the second month in the winter. 

\textbf{What:} Go to the Kings Square (intersection of Queen and Regent), make a cardboard shelter which can be complemented with a plastic sheet.

\textbf{Where:} Kings Square (intersection of Queen and Regent)

\textbf{Why:} to live in a cardboard box for a day. see what is like. draw attention in the community.
\par}

This is a sentence to show where the righthand side margin is and to illustrate the point that the ``ratings'' box is in the margin.
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

problem with wrapfig and margins

Post by countbela666 »

Hi,

you could overcome this problem by using the second optional argument of the wrap*-environments which specifies a margin overhang:

Code: Select all

...
\begin{wraptable}{r}[-9mm]{0.30\textwidth}
...
Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
zoho
Posts: 6
Joined: Fri Jun 29, 2007 9:22 pm

Re: problem with wrapfig and margins

Post by zoho »

Thank you!
Although i do feel a little sheepish that the solution was just to use an optional argument ... :oops:
Post Reply