3

Ok so here is a question for all of you latex experts. Every time I use the \wrapfigure{} environment I get the following:

Notice how there is line skip right after a period. and it separates the text. (Notice how in this 1st image there is a line skip right after a period which separates the text.)

But what I really want is this:

enter image description here

Maybe is not possible to achieve this with a simple \wrapfigure{} but if someone knows how to do it I would really appreciate the help. Thank you hand happy Latexing!

1
  • 2
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Skillmon
    Commented Feb 26, 2018 at 18:51

2 Answers 2

5

It's easy using the plain TeX macro package insbox. However, it does not accept floats, so you have to put the graphic in a \parbox of the relevant width,, and use \captionof{figure}{...}.

The syntax is the following for insertion on the right side \InsertBoxR{no of unshortened lines}{object to be inserted}[optional integer]. The optional argument is the number of supplementary short lines, in case TeX doesn't calculate the exact number of short lines.

\documentclass[12pt, latin]{article}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{caption}
\input{insbox.tex}
\usepackage{lipsum}

\begin{document}

\InsertBoxR{3}{\parbox{0.35\linewidth}{\includegraphics[width=\linewidth]{traccia-table}%
\captionof{figure}{Traccia table}}}[6]

\lipsum[8-9]

\end{document} 

enter image description here

6
  • I'm very fast. Good point +1.
    – Sebastiano
    Commented Feb 26, 2018 at 20:52
  • The legs of the table helped me… ;o)
    – Bernard
    Commented Feb 26, 2018 at 20:53
  • Are there any drawbacks (except no automatic floating) of insbox compared to wrapfig?
    – Skillmon
    Commented Feb 26, 2018 at 20:55
  • @Skillmon: I don't know really. I began to use it in places where wrapfig can't work, such as lists. It doesn't work with lists ‘as is’, but we can add some commands to bypass the problems.
    – Bernard
    Commented Feb 26, 2018 at 20:59
  • @Bernard are you willing to show me how here?
    – Skillmon
    Commented Feb 27, 2018 at 7:49
1

This does look good. I typed the text and looked for a natural line break. There I put the wrapfigure environment. I admit this is a poor solution, but it works. This is also the solution mentioned in the package documentation (page 2 -- as the last bullet point in the first bullet list on that page):

It is convenient to begin the environment between paragraphs, but if you want placement in the middle of a paragraph, you must put the environment between two words where there is a natural line break.

\documentclass[]{article}

\usepackage{wrapfig,blindtext}

\begin{document}
This is my awesome paragraph with a \texttt{wrapfigure} environment. Let's see
how we can do this real quick. I'm adding some more manual text just to fill
some lines and then let the \texttt{wrapfigure} environment start. This way it
gets% a line break did occur here
\begin{wrapfigure}{r}{0pt}
  \rule{2cm}{2cm}
  \caption{figure}
\end{wrapfigure}
closer to what you want. And here goes some more \blindtext.
\end{document}

enter image description here

1
  • Thank you. I ended up using your idea without noticing. Maybe there would be another package to help with this in the future. Thanks again for replying so quickly. Greetings from Manchester. :) Commented Feb 26, 2018 at 21:38

You must log in to answer this question.

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