0

I'm trying to make a table around which text in both columns will wrap. I've looked around and wraptable from wrapfig has been suggested, but it seems to just make things worse.

\documentclass[twocolumn]{article}

\usepackage{blindtext} %for lorem ipsum
\usepackage{wrapfig}

\begin{document}
\blindtext[1]

\begin{wraptable}{l}{10cm}
    \begin{tabular}{lp{8cm}}
    X & Y \\ 
    \hline \\[-2mm]
    AAAA & \Blindtext[1][1]  \\
    CCCC & x
    \end{tabular}
\end{wraptable}

\blindtext[3]

\end{document}

enter image description here

3
  • 2
    twocoulmn is somewhat rigid. Are you after wide tables spanning both the columns? If so, you may use table*. If you want wrapping then this answer may be somewhat useful -- tex.stackexchange.com/a/70169/11232
    – user11232
    Commented Jan 17, 2013 at 2:21
  • @HarishKumar I'd be happy with either a table spanning both columns at the bottom or top of the page if necessary) or partially spanning both columns. It should be on the same page that it is called. Commented Jan 17, 2013 at 2:31
  • But table* can't be put in the first page. On other pages, it should be possible
    – user11232
    Commented Jan 17, 2013 at 2:43

2 Answers 2

3

twocoulmn is somewhat rigid. If you want wide tables spanning both the columns, you may use table*. But it can't be put in the first page of the document. In other pages you can place them on top or bottom. If needed, you may use placeins package and its FloatBarrier to restrict the placement. There is also float package with similar functionality ([H] instead of [htb]. Or you may issue a \clearpage by yourself.

\documentclass[twocolumn]{article}

\usepackage{lipsum} %for lorem ipsum
\usepackage{placeins} % provides \FloatBarrier 

\begin{document}

\lipsum[1-20]

\begin{table*}[t]
\centering
   \begin{tabular}{lp{8cm}}
    X & Y \\ 
    \hline \\[-2mm]
    AAAA & \lipsum[1]  \\
    CCCC & x
    \end{tabular}
\end{table*}
%\FloatBarrier To force the table here if needed.
\lipsum

\end{document}
1

An answer that gets closer to what you are looking to achieve is similar to a provided solution for text wrapping around a figure instead of a table. You have to use the instructions multiple-span.txt file (provided in the wrapfig documentation) to achieve this. Because the documentation refers to this as a "by hand" solution, I have to spell-out the lorem ipsum. Here's the solution:

\documentclass[twocolumn]{article}

\usepackage{wrapfig}

\begin{document}

%These paragraphs are from https://www.lipsum.com/
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed porttitor ullamcorper nulla sit amet sodales. Donec ut luctus libero, sit amet scelerisque odio. Integer et lacus et odio condimentum pellentesque et a leo. Integer at sollicitudin enim. Donec tempor nunc et mattis euismod. Vivamus at aliquet nisl, at porttitor orci. In hac habitasse platea dictumst. Ut et varius nibh. Ut nec dui non tortor bibendum euismod. Vivamus malesuada in nulla et rhoncus. Ut semper ultricies metus eget suscipit. Interdum et malesuada fames ac ante ipsum primis in faucibus. Cras hendrerit porta sem ut sodales.

\vspace{14\baselineskip}

Duis euismod turpis quam, non mattis eros dignissim ut. Suspendisse vitae condimentum dolor. Donec ullamcorper venenatis felis, at blandit magna rhoncus vel. Quisque velit ante, auctor mollis nisl eu, aliquet scelerisque risus. Fusce tristique eu est et porta. Vestibulum tincidunt aliquam sem accumsan sodales. Integer sem eros, interdum non faucibus a, viverra quis nibh. Vivamus nec sagittis turpis. Duis convallis augue et libero dignissim, at viverra ligula blandit.

Aliquam eu ante efficitur, sodales ipsum consectetur, iaculis diam. Morbi ut tincidunt justo. Vivamus in leo at arcu posuere volutpat. Phasellus malesuada est dolor, sed congue nibh ullamcorper in. Ut ante augue, volutpat ut felis sed, ornare ullamcorper diam. Fusce sit amet dictum mauris, ac ultricies dolor. Nam interdum tempus neque eget rhoncus. Sed vehicula pellentesque enim. Interdum et malesuada fames ac ante ipsum primis in faucibus. In hac habitasse platea dictumst. Cras vestibulum urna at mauris scelerisque, non efficitur neque faucibus. Duis lacus tortor, varius semper sem a, placerat laoreet orci. Duis semper erat id enim tristique, sed egestas mauris ultrices.

Aenean sed sapien at urna euismod eleifend at eu massa. Cras id mollis magna. Ut finibus, velit non feugiat tempor, risus dui finibus nulla, pretium molestie quam justo luctus elit. In sollicitudin, quam pretium pulvinar vehicula, metus eros condimentum nulla, ac condimentum ante urna id quam. Proin felis sem, faucibus vel mi at, cursus pretium lorem. Etiam id auctor metus. Phasellus euismod egestas felis eget
\begin{wraptable}[14]{l}[\dimexpr\columnwidth+\columnsep]{10cm}
    \begin{tabular}{lp{8cm}}
    X & Y \\ 
    \hline \\[-2mm]
    AAAA & Aliquam et nisl orci. Proin nibh lorem, mollis rutrum rhoncus ut, pellentesque nec augue. Duis ultricies nulla commodo, feugiat lorem eget, pellentesque nisi. Nullam non nisi urna. Duis gravida est fermentum turpis accumsan, vel vestibulum lorem semper. Sed id lectus nec dolor efficitur molestie. Donec aliquam lorem quam, dapibus venenatis mi lacinia in. Sed vitae semper magna. Nunc interdum in justo in accumsan. \\
    CCCC & x
    \end{tabular}
\end{wraptable}
malesuada. Nunc ut justo nec dui tempus viverra. Donec eget neque tortor. Duis magna justo, iaculis ut sollicitudin ac, lacinia sed justo. Sed varius metus quis cursus bibendum. Cras placerat finibus tempus. Vestibulum ut efficitur sem. 

Mauris malesuada tellus vel lacus ullamcorper auctor. Sed eu erat eget mi laoreet condimentum accumsan nec nibh. Suspendisse condimentum auctor ligula sed semper. Nullam vel purus libero. Quisque sodales, sapien ultricies auctor finibus, sapien est pharetra dolor, et pellentesque nunc ipsum quis erat. Aliquam egestas lobortis justo, in tempus ante congue at. Aenean lacinia arcu quis fermentum aliquet. Ut vehicula est et ipsum viverra, in porta arcu varius. Morbi sit amet ipsum dolor. Sed ut neque ut ligula semper cursus finibus ac ante. Aliquam malesuada mi eget dui condimentum ornare. Morbi et justo pulvinar, gravida libero non, viverra ligula. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse molestie gravida elementum.

Proin dictum enim quis ornare facilisis. Fusce ullamcorper risus at turpis interdum, cursus ullamcorper ipsum convallis. Sed placerat risus at ultricies venenatis. Duis sed urna nec dui molestie finibus. Duis iaculis nulla luctus, fermentum nibh eget, aliquam mi. Etiam ut mi tincidunt, sodales mi hendrerit, suscipit eros. Nam quis mi ante. Nam fringilla lacinia odio eget sodales.

\end{document}

screenshot of typeset solution

You must log in to answer this question.

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