0

I am trying to wrap text around a table within the wraptable environment.

My code looks like the following:

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
    \usepackage{amssymb}
    \usepackage{graphicx}
    \usepackage{wrapfig}
    \usepackage{booktabs}
    \usepackage{rotating}
    \usepackage{lipsum}
    \usepackage{lscape}


    \begin{document}
        \begin{wraptable}{l}{0.8\linewidth}

            \footnotesize
            \centering
            \caption[]{my caption \label{tab:summary}}
            \begin{sideways}
                \begin{tabular}{p{\dimexpr 0.2\linewidth-2\tabcolsep} 
                        p{\dimexpr 0.75\linewidth-2\tabcolsep} 
                        p{\dimexpr 0.05\linewidth-2\tabcolsep}}
                    \toprule
                    \textbf{Sample type}                          & \textbf{Definitions}                                                                                                                                                                                                                                                                                              & \textbf{n} \\ \midrule
                    Paired, pre and post treatment - deemed cured & VL treated for 4-5 weeks, with improvement in clinical symptoms and no evidence of relapse at any time 6 months after treatment. Samples were taken at or around the start of treatment and at 6 months.                                                                                                          & 25 pairs   \\
                    Unpaired, relapse                             & VL treated and subsequently relapsed to active disease. Sampled at the time of relapse diagnosis                                                                                                                                                                                                                  & 26         \\
                    Endemic healthy controls                      & Resident in VL endemic area, seronegative by DAT and rK39 ELISA, no history of VL, healthy                                                                                                                                                                                                                        & 15         \\
                    Assymptomatic progressors                     & Asymptomatic seropositive, on the basis of DAT (geq1:16,000) and/or rK39 ELISA (Optical density (OD) greater mean OD + 2 standard deviations of non-endemic healthy control samples), from VL endemic areas, without clinical signs or symptoms or history of VL, developed VL 6 days to 6 months after sampling. & 4          \\
                    Asymptomatic non-progressors                  & Asymptomatic seropositive as above but did not develop VL during follow-up of at least 3 years.                                                                                                                                                                                                                   & 4          \\ \bottomrule
                \end{tabular}%
            \end{sideways}
        \end{wraptable}
        \lipsum[1]
    \end{document}

I does not look too bad, though I wanted to have the table stretching over the whole height of the page as well as the caption rotated, like in the code shown below

\begin{landscape}
    \begin{table}[!htb]
        \centering
        \begin{tabular}{p{\dimexpr 0.2\linewidth-2\tabcolsep} 
                p{\dimexpr 0.75\linewidth-2\tabcolsep} 
                p{\dimexpr 0.05\linewidth-2\tabcolsep}}
            \toprule
            \textbf{Sample type}                          & \textbf{Definitions}                                                                                                                                                                                                                                                                                              & \textbf{n} \\ \midrule
            Paired, pre and post treatment - deemed cured & VL treated for 4-5 weeks, with improvement in clinical symptoms and no evidence of relapse at any time 6 months after treatment. Samples were taken at or around the start of treatment and at 6 months.                                                                                                          & 25 pairs   \\
            Unpaired, relapse                             & VL treated and subsequently relapsed to active disease. Sampled at the time of relapse diagnosis                                                                                                                                                                                                                  & 26         \\
            Endemic healthy controls                      & Resident in VL endemic area, seronegative by DAT and rK39 ELISA, no history of VL, healthy                                                                                                                                                                                                                        & 15         \\
            Assymptomatic progressors                     & Asymptomatic seropositive, on the basis of DAT (geq1:16,000) and/or rK39 ELISA (Optical density (OD) greater mean OD + 2 standard deviations of non-endemic healthy control samples), from VL endemic areas, without clinical signs or symptoms or history of VL, developed VL 6 days to 6 months after sampling. & 4          \\
            Asymptomatic non-progressors                  & Asymptomatic seropositive as above but did not develop VL during follow-up of at least 3 years.                                                                                                                                                                                                                   & 4          \\ \bottomrule
        \end{tabular}%
        \caption[]{.}
        \label{tab_sera}
    \end{table}
\end{landscape}

With this code, however, I cannot wrap any text around the table.

1

It should be noted that \intextsep also affects normal floats, so you might want to make the change temporary.

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
    \usepackage{amssymb}
    \usepackage{graphicx}
    \usepackage{wrapfig}
    \usepackage{booktabs}
    %\usepackage{rotating}
    \usepackage{lipsum}
    %\usepackage{lscape}
    \usepackage{caption}

    \newsavebox{\tempbox}


    \begin{document}

    % first measure the height of the tabular
    \savebox{\tempbox}{\begin{minipage}{\dimexpr \textheight}
      \footnotesize
      \captionof{table}[]{my caption}\label{tab:summary}
      \begin{tabular}{p{\dimexpr 0.2\linewidth-2\tabcolsep} 
                        p{\dimexpr 0.75\linewidth-2\tabcolsep} 
                        p{\dimexpr 0.05\linewidth-2\tabcolsep}}
                    \toprule
                    \textbf{Sample type}                          & \textbf{Definitions}                                                                                                                                                                                                                                                                                              & \textbf{n} \\ \midrule
                    Paired, pre and post treatment - deemed cured & VL treated for 4-5 weeks, with improvement in clinical symptoms and no evidence of relapse at any time 6 months after treatment. Samples were taken at or around the start of treatment and at 6 months.                                                                                                          & 25 pairs   \\
                    Unpaired, relapse                             & VL treated and subsequently relapsed to active disease. Sampled at the time of relapse diagnosis                                                                                                                                                                                                                  & 26         \\
                    Endemic healthy controls                      & Resident in VL endemic area, seronegative by DAT and rK39 ELISA, no history of VL, healthy                                                                                                                                                                                                                        & 15         \\
                    Assymptomatic progressors                     & Asymptomatic seropositive, on the basis of DAT (geq1:16,000) and/or rK39 ELISA (Optical density (OD) greater mean OD + 2 standard deviations of non-endemic healthy control samples), from VL endemic areas, without clinical signs or symptoms or history of VL, developed VL 6 days to 6 months after sampling. & 4          \\
                    Asymptomatic non-progressors                  & Asymptomatic seropositive as above but did not develop VL during follow-up of at least 3 years.                                                                                                                                                                                                                   & 4          \\ \bottomrule
  \end{tabular}
\end{minipage}}%
    \intextsep=0pt
        \begin{wraptable}{l}{\dimexpr \ht\tempbox+\dp\tempbox}
           \rotatebox{90}{\usebox\tempbox}
        \end{wraptable}%
        \lipsum[1-3]
    \end{document}

full page

  • Thanks very much for the reply. Indeed it works well for this MWE. However, I noticed that if I put anything above the table, it will shift the table to the bottom of the page and upset the formatting. Ideally it would be best to fix the table on the left hand side of the page and leave the rest of the page for inputting text. Is it possible to do that by, for instance, dividing the page in two? – BCArg Apr 25 '18 at 7:56
  • You can start wraptext in the middle of a paragraph, but it has to be at the word where the line (page) is split. You could use flowfram, but it can't handle changes in column width in the middle of paragraphs at all. – John Kormylo Apr 25 '18 at 13:09

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.