我能够使用 Justibus 提供的编码:longtable 和 tabulary 中的几个标题问题。
我的问题是 - 现在我已经能够使表格换行并分页,同时保持表格格式。现在我发现第一列(在我的例子中是三列)在外观上被压缩得太远了。
如何设置列的最小压缩限度?
我对编码的理解才刚刚开始,因此无法在其他帖子中找到关于如何使用表格设置最小列宽限制的清晰解释。
任何帮助都将不胜感激,如果最后一个单元格中的列表能够逐项列出,那就太好了。
梅威瑟:
\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}
答案1
如果你添加一些连字符点并限制每.2\textwidth
列
如果您使用.25\textwidth
它,在这种情况下不需要连字符,所以您可以选择:-)
(\caption
用法仍需修复)
\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}