5

Answering this question, I observe, that wraptable work correctly if for some dummy text I use two successive paragraphs, for example \lipsum[11-12], from the lipsum package. If I use just one, than used paragraph text overlap wrapped table.

However, it works correctly with use of some other typed text, as is shown in the first example in the following (no so short) MWE:

\documentclass{article}
\usepackage[singlelinecheck=false,
            font=small,
            labelfont=bf,
            skip=1ex]{caption}
\usepackage[table]{xcolor}
\newcommand\mcw[1]{\multicolumn{1}{c}{\textcolor{white}{\textbf{#1}}}}
\usepackage{array}
\usepackage{siunitx}

\usepackage{wrapfig}
\usepackage{lipsum}

\begin{document}

    \begin{wraptable}[8]{R}{0.45\textwidth}
    %\vspace*{-\baselineskip}
\caption{Performance Overview}
\label{tab:Performance Overview -  in percent}
\begin{tabular}{>{\itshape}c *{2}{S<{\,\%}} }
    \hline
    \rowcolor{black}
\mcw{n}
    &   \mcw{Test (A)}
        &   \mcw{Test (B)}              \\
    \hline
1   &   99,38   &   98,55   \cr
2   &   99,03   &   98,73   \cr
3   &   93,80   &   98,86   \cr
    \hline
\textbf{Total}
    &   98,16   &   98,76   \cr
    \hline
\end{tabular}
    \end{wraptable}
Some text followed by display equation:
\begin{equation}
a^2 + b^2 = c^2
\end{equation}

Why in this case works as expected but when for text are use \verb+\lipsum[1]+ or \verb+\lipsum*[1]+ their text overlap wrapped table?

    \begin{wraptable}[7]{R}{0.45\textwidth}
    \vspace*{-\baselineskip}
\caption{Performance Overview}
\label{tab:Performance Overview -  in percent}
\begin{tabular}{>{\itshape}c *{2}{S<{\,\%}} }
    \hline
    \rowcolor{black}
\mcw{n}
    &   \mcw{Test (A)}
        &   \mcw{Test (B)}              \\
    \hline
1   &   99,38   &   98,55   \cr
2   &   99,03   &   98,73   \cr
3   &   93,80   &   98,86   \cr
    \hline
\textbf{Total}
    &   98,16   &   98,76   \cr
    \hline
\end{tabular}
    \end{wraptable}
\lipsum[1]
\end{document}

enter image description here

What special is in dummy text from the lipsum package, that demonstration of wrapfig or wraptable fail when is used just one paragraph from lipsum package?

  • @UlrikeFischer, thank you for the link and explanation on github. I wonder, when this issue of the lipsum package will be resolved. Meanwhile I can live with use of using two consecutive paragraphs in such a cases or with suggestion for use of a \LipsumPar provided by Schrödinger's cat i his answer. – Zarko Nov 14 at 9:38
6

According to the manual you need to use \LipsumPar here, not \lipsum.

The difference between \LipsumPar{8} and \lipsum[8] is that the first directly accesses the internal macro that stores the corresponding paragraph, while the latter runs the loop that selects the Lorem ipsum... paragraphs.

Of course, this applies also to \LipsumPar{1} vs. \lipsum[1].

\documentclass{article}
\usepackage[singlelinecheck=false,
            font=small,
            labelfont=bf,
            skip=1ex]{caption}
\usepackage[table]{xcolor}
\newcommand\mcw[1]{\multicolumn{1}{c}{\textcolor{white}{\textbf{#1}}}}
\usepackage{array}
\usepackage{siunitx}

\usepackage{wrapfig}
\usepackage{lipsum}

\begin{document}

    \begin{wraptable}[8]{R}{0.45\textwidth}
    %\vspace*{-\baselineskip}
\caption{Performance Overview}
\label{tab:Performance Overview -  in percent}
\begin{tabular}{>{\itshape}c *{2}{S<{\,\%}} }
    \hline
    \rowcolor{black}
\mcw{n}
    &   \mcw{Test (A)}
        &   \mcw{Test (B)}              \\
    \hline
1   &   99,38   &   98,55   \cr
2   &   99,03   &   98,73   \cr
3   &   93,80   &   98,86   \cr
    \hline
\textbf{Total}
    &   98,16   &   98,76   \cr
    \hline
\end{tabular}
    \end{wraptable}
Some text followed by display equation:
\begin{equation}
a^2 + b^2 = c^2
\end{equation}

Why in this case works as expected but when for text are use \verb+\lipsum[1]+ or \verb+\lipsum*[1]+ their text overlap wrapped table?

    \begin{wraptable}[7]{R}{0.45\textwidth}
    \vspace*{-\baselineskip}
\caption{Performance Overview}
\label{tab:Performance Overview -  in percent}
\begin{tabular}{>{\itshape}c *{2}{S<{\,\%}} }
    \hline
    \rowcolor{black}
\mcw{n}
    &   \mcw{Test (A)}
        &   \mcw{Test (B)}              \\
    \hline
1   &   99,38   &   98,55   \cr
2   &   99,03   &   98,73   \cr
3   &   93,80   &   98,86   \cr
    \hline
\textbf{Total}
    &   98,16   &   98,76   \cr
    \hline
\end{tabular}
    \end{wraptable}
\LipsumPar{1}
\end{document}

enter image description here

  • Thank you very much for pointing me to \LipsumPar. I didn't know about its existence. – Zarko Nov 14 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.