0

I would like to have in some table a cell that contains text and graphics wrapped around. The table itself will need several pages. However, tabularx aligns the content of the two columns nicely whereas LTXtable doesn't. If I'm not mistaken, tabularx cannot split the table onto more than one page. I am using TeXLive under Ubuntu (if that matters). I tried several other packages as well but either the content was aligned (no pagebreak possible) or pagebreak was possible (but the content not in one line). Other packages like wrapfig didn't help either.

Is a "compromise" possible?

\documentclass[paper=a4,draft=false,fontsize=14pt,DIV=calc]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{nag}
\usepackage{ltxtable}

\setlength{\parindent}{0pt}
\input{insbox}
\begin{document}

\LTXtable{\textwidth}{mwe_insbox_table.tex}

\begin{tabularx}{\linewidth}{lX}
    left column & {\InsertBoxR{0}{\begin{minipage}[t]{0.4\linewidth}\centering \rule{5cm}{5cm}\end{minipage}} Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. }
\end{tabularx}

\end{document}

The file mwe_insbox_table.tex contains:

\begin{longtable}{@{}lX@{}}
left column & {\InsertBoxR{0}{\begin{minipage}[t]{0.4\linewidth}\centering \rule{5cm}{5cm}\end{minipage}} Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. }
\end{longtable}
7
  • 1
    ltablex? it has features tabularx and longtable. welcome to tex.se!
    – Zarko
    Jan 14, 2018 at 19:40
  • ltablexdoesn't agree with the insbox - one of my earlier experiments.
    – MichaelZ
    Jan 14, 2018 at 19:45
  • and what is insbox?
    – Zarko
    Jan 14, 2018 at 19:49
  • @Zarko: It's a plainTeX macro package which can insert object in a paragraph (left or right). It often works when wrapfig doesn't.
    – Bernard
    Jan 14, 2018 at 19:54
  • @Zarko take a look at ctan.
    – Skillmon
    Jan 14, 2018 at 19:58

1 Answer 1

5

It works with \ltablex if you add the directive \keepXColumns and a negative vertical spacing at the beginning of the X cell. I also simplified your code: no minipage environment to type, with \@minipagetrue on entering the X column:

\documentclass[paper=a4,draft=false,fontsize=14pt,DIV=calc]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{nag}
\usepackage{ltablex, makecell}
\usepackage[svgnames]{xcolor}
\setlength{\parindent}{0pt}
\input{insbox}
    \makeatletter
    \newcommand*{\compress}{\@minipagetrue}
    \makeatother

\begin{document}

\keepXColumns
\begin{tabularx}{\linewidth}{l>{\compress\arraybackslash}X}
   left column &
   \vspace*{-\baselineskip} \InsertBoxR{0}{{\color{Tomato}\rule{5cm}{5cm}}} Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text. Some silly text.
\end{tabularx}

\end{document}

enter image description here

4
  • @Beranrd, catastrophe. i make extremely silly error. please help me recover your answer!
    – Zarko
    Jan 14, 2018 at 21:24
  • @Zarko: There was some mistyping in my code? I can see no difference.
    – Bernard
    Jan 14, 2018 at 21:33
  • no, i intend to delete my answer, but by mistake i do this with yours. sorry. then in panic i didn't remember how to repair my mistake. excelent answer (+1)
    – Zarko
    Jan 14, 2018 at 21:37
  • Keep cool, my friend;o) It was not that important, and anyway, I have a copy on my computer.
    – Bernard
    Jan 14, 2018 at 21:45

You must log in to answer this question.

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