10

I've been trying to use the wrapfigure and wraptable from the wrapfig package, but to no avail.

This works for text.

\begin{wrapfigure}{l}{40mm}
    \begin{center}          
        Some random text
    \end{center}
\end{wrapfigure}

This should be to the left of the table. \blindtext

But once I add a table (see code below), it fails.

\begin{wrapfigure}{l}{40mm}
    \begin{center}
        \begin{table}
            \begin{tabular}{l | c}
            A & Cell 1 \\ \hline
            B & Cell 2 \\ \hline
            \end{tabular}
        \end{table} \\
        Some random text
    \end{center}
\end{wrapfigure}

This should be to the left of the table. \blindtext

What am I doing wrong?

Thanks.

0

1 Answer 1

20

The table environment is for normal floating tables. You do not need to put a tabular inside a table environment. You should use the wraptable environment instead.

\begin{wraptable}{l}{40mm}
    \begin{tabular}{l | c}
      A & Cell 1 \\ \hline
      B & Cell 2 \\ \hline
    \end{tabular}
   Some random text
\end{wraptable}

This should be to the left of the table. \blindtext
3
  • Thanks. Final question... can you recommend a document/site that would contain this and other similar information? Jan 11, 2012 at 23:04
  • 1
    @haroldcampbell It always helps to read the package documentation: doing texdoc wrapfig from the Command Line/Terminal would reveal the existence of the wraptable environment.
    – Joseph Wright
    Jan 12, 2012 at 6:50
  • Years later, this polite RTFM still makes me smile. Nov 27, 2023 at 10:34

You must log in to answer this question.

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