3

I was able to use the coding provided by Justibus: Several caption problems in longtable and tabulary.

What my question is - now that i've been able to make my table wrap columns and break over multiple pages whilst maintaining tabulary. I now find that the first column (in my case of three colunns) is being compressed to far in it's appearance.

How can i set a minimum limit of compression to the columns?

My understanding of coding is beginning and so have been unable to find a clear explanation on in other posts of how to put a minimum column width limit with tabulary.

Any help with this would be appreciated and if the list in the final cell could be itemized it would be excellent.

MWE:

\documentclass{scrartcl}

\usepackage[hypcap=true]{caption}
    \captionsetup{labelfont=bf, justification=justified, singlelinecheck=false, format=plain}

\usepackage{tabulary, booktabs, longtable, ltcaption}
\usepackage[referable]{threeparttablex}

%% define a new envrionment which marries longtable with tabulary
\makeatletter
\def\ltabulary{%
\def\endfirsthead{\\}%
\def\endhead{\\}%
\def\endfoot{\\}%
\def\endlastfoot{\\}%
\def\tabulary{%
  \def\TY@final{%
\def\endfirsthead{\LT@end@hd@ft\LT@firsthead}%
\def\endhead{\LT@end@hd@ft\LT@head}%
\def\endfoot{\LT@end@hd@ft\LT@foot}%
\def\endlastfoot{\LT@end@hd@ft\LT@lastfoot}%
\longtable}%
  \let\endTY@final\endlongtable
  \TY@tabular}%
\dimen@\columnwidth
\advance\dimen@-\LTleft
\advance\dimen@-\LTright
\tabulary\dimen@}
\def\endltabulary{\endtabulary}
\makeatother
% from https://tex.stackexchange.com/questions/78075/multi-page-with-tabulary (see there for usage)

\begin{document}
%   \setlength\LTleft{0pt}
%   \setlength\LTright{0pt}
%   \captionof{table}{Example of long table over multiple pages}
    \begin{ltabulary}{LLL}
        \caption{Common Medications}\\
        \toprule
        \textbf{Drug Name}                  &\textbf{Dosing Schedule}        & \textbf{Indications/Comments}  \\
        \midrule
        \endfirsthead
        \caption[]{(continued)}\\
        \toprule
        \textbf{Drug Name}                  &\textbf{Dosing Schedule}        & \textbf{Indications/Comments}  \\
        \midrule
        \endhead
        \endfoot
        \bottomrule
        \insertTableNotes

        \begin{TableNotes}\footnotesize
        \note This is a long explanation going over multiple lines. This is a long explanation going over multiple lines. This is a long explanation going over multiple lines. This is a long explanation going over multiple lines. This is a long explanation going over multiple lines.
    \end{TableNotes}

        \endlastfoot
       % \textbf{Drug Name}                  &\textbf{Dosing Schedule}        & \textbf{Indications/Comments}  \\
        %\hline
        Betamethasone Valerate (Celestone) & 12 mg IM q24h x 2 doses & Enhancement of Foetal Pulmonary maturity for PTL\\
        \\
        Methylergonavine maleate (Ergotamine)   &0.25 mg IM q5min up to 1.25 mg or IV bolus 0.125 mg    &Treatment of uterine atony\\
        \\
        Rh IgG (Rhogam)     &300$\mu$g IM x 1 dose  &Given to Rh negative women \newline Routinely at 28 wks GA \newline Within 72 h of birth of Rh +ve foetus positive \newline Positive Kleihauer-Betke test \newline With any invasive procedure in pregnancy \newline Ectopic pregnancy \newline Antepartum haemorrhage \newline Miscarriage or TA (dose: 50 $\mu$g IM only) \\



    \end{ltabulary}

\end{document}
  • you can use \setlength\tymin{...} to set a minimum compression, or simply use a fixed with p column for the first column. – David Carlisle Oct 28 '14 at 13:28
  • your example code produces ! Package caption Error: \caption outside float. – David Carlisle Oct 28 '14 at 13:31
3

If you add some hyphenation points and restrict each column to .2\textwidth you get

enter image description here

If you use .25\textwidth it doesn't need to hyphenate in this case, so you can choose:-)

(The \caption usage still needs fixing)

\documentclass{scrartcl}

\usepackage[hypcap=true]{caption}
    \captionsetup{labelfont=bf, justification=justified, singlelinecheck=false, format=plain}

\usepackage{tabulary, booktabs, longtable, ltcaption}
\usepackage[referable]{threeparttablex}

%% define a new envrionment which marries longtable with tabulary
\makeatletter
\def\ltabulary{%
\def\endfirsthead{\\}%
\def\endhead{\\}%
\def\endfoot{\\}%
\def\endlastfoot{\\}%
\def\tabulary{%
  \def\TY@final{%
\def\endfirsthead{\LT@end@hd@ft\LT@firsthead}%
\def\endhead{\LT@end@hd@ft\LT@head}%
\def\endfoot{\LT@end@hd@ft\LT@foot}%
\def\endlastfoot{\LT@end@hd@ft\LT@lastfoot}%
\longtable}%
  \let\endTY@final\endlongtable
  \TY@tabular}%
\dimen@\columnwidth
\advance\dimen@-\LTleft
\advance\dimen@-\LTright
\tabulary\dimen@}
\def\endltabulary{\endtabulary}
\makeatother
% from http://tex.stackexchange.com/questions/78075/multi-page-with-tabulary (see there for usage)

\begin{document}
\setlength\tymin{.2\textwidth}
%   \setlength\LTleft{0pt}
%   \setlength\LTright{0pt}
%   \captionof{table}{Example of long table over multiple pages
\makeatletter
    \begin{ltabulary}{LLL}
        \caption{Common Medications}\\
        \toprule
        \textbf{Drug Name}                  &\textbf{Dosing Schedule}        & \textbf{Indications/Comments}  \\
        \midrule
        \endfirsthead
        \caption[]{(continued)}\\
        \toprule
        \textbf{Drug Name}                  &\textbf{Dosing Schedule}        & \textbf{Indications/Comments}  \\
        \midrule
        \endhead
        \endfoot
        \bottomrule
        \insertTableNotes

        \begin{TableNotes}\footnotesize
        \note This is a long explanation going over multiple lines. This is a long explanation going over multiple lines. This is a long explanation going over multiple lines. This is a long explanation going over multiple lines. This is a long explanation going over multiple lines.
    \end{TableNotes}

        \endlastfoot
       % \textbf{Drug Name}                  &\textbf{Dosing Schedule}        & \textbf{Indications/Comments}  \\
        %\hline
        Beta\-metha\-sone Valerate (Celestone) & 12 mg IM q24h x 2 doses & Enhancement of Foetal Pulmonary maturity for PTL\\
        \\
        Methyl\-ergon\-avine maleate (Ergotamine)   &0.25 mg IM q5min up to 1.25 mg or IV bolus 0.125 mg    &Treatment of uterine atony\\
        \\
        Rh IgG (Rhogam)     &300$\mu$g IM x 1 dose  &Given to Rh negative women \newline Routinely at 28 wks GA \newline Within 72 h of birth of Rh +ve foetus positive \newline Positive Kleihauer-Betke test \newline With any invasive procedure in pregnancy \newline Ectopic pregnancy \newline Antepartum haemorrhage \newline Miscarriage or TA (dose: 50 $\mu$g IM only) \\



    \end{ltabulary}

\end{document}
| improve this answer | |
  • In this format what would be the easiest way to include the bulleting/numbering of items in the list? – Mitchell Oct 28 '14 at 14:01
  • @Mitchell which list? you mean you want a bullet in each row of the table? you could have a new first c column with \textbullet in each cell? – David Carlisle Oct 28 '14 at 14:06
  • Just in the cell: R3,C3; where it has a bunch of new lines. – Mitchell Oct 28 '14 at 23:45
  • @Mitchell lists don't work in tabulary (sorry) there is a fix here then you will be able to use \begin{itemize} for a bullet list as normal. tex.stackexchange.com/questions/204881/… – David Carlisle Oct 28 '14 at 23:50

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.