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.

Compiling the code below yields a misalignment of the text when the box is drawn.

\documentclass[fleqn,11pt]{book}
\usepackage{cutwin}
\begin{document}
\renewcommand\windowpagestuff{\flushright\rule{2cm}{2cm}}%
\opencutright%
text text text text text text text text text text text text text text text text text   text text text text text text text text text text text text
\begin{cutout}{1}{0.79\linewidth}{0pt}{5}%
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{cutout}
\end{document}

enter image description here

Would you know nice tricks to avoid this behavior?

share|improve this question
    
You can also use wrapfigure. –  Harish Kumar Feb 17 '13 at 12:22

1 Answer 1

up vote 3 down vote accepted

It seems to be a small issue with the environment itself.

First of all you have to setup the environment as a single paragraph.(see documentation)

Next I redefined the environment itself by using the great package regexpatch:

\documentclass[fleqn,11pt]{book}

\usepackage{cutwin,kantlipsum,mwe}
\usepackage{regexpatch}
\opencutright
\renewcommand\windowpagestuff{\centering\includegraphics[width=2cm]{example-image-b}}%

\makeatletter
\xpretocmd{\cutout}{\leavevmode\hrule \@height\z@ \@width\linewidth\relax}
\makeatother

\begin{document}
\kant[3]

\begin{cutout}{2}{0.7\linewidth}{0pt}{5}%
\kant[1]
\end{cutout}
\end{document}

enter image description here

share|improve this answer
    
Should the package be corrected? Also, in your example, we can still notice a slight misalignment introduced by cutwin. Thanks –  pluton Feb 17 '13 at 15:49
    
@pluton: Indeed. I didn't notice this misalignment. In my opinion I would change some internals and especially the implementation of the environment itself. I prefer an environment based on list. –  Marco Daniel Feb 17 '13 at 16:03
    
which one? because I am trying to use a cutwin like environment in your mdframed environment and the only one working so far is cutwin –  pluton Feb 17 '13 at 16:15
    
@pluton: I like the possibility by parshape: tex.stackexchange.com/questions/23402/mdframed-and-wrapfig/… –  Marco Daniel Feb 17 '13 at 16:18
    
yes, this is probably the best. I could adapt to my case. –  pluton Feb 17 '13 at 18:09

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.