\documentclass{report}[12pt, oneside, a4paper]
\usepackage{geometry} \geometry{verbose, tmargin=2.5cm, rmargin=2.5cm, bmargin=2.5cm, lmargin=3.5cm, headsep=0cm}
\usepackage{array,booktabs}% http://ctan.org/pkg/{array,booktabs}
\usepackage{longtable}
\newcommand{\beginsupplement}{%
\setcounter{table}{0}
\renewcommand{\thetable}{S\arabic{table}}%
\setcounter{figure}{0}
\renewcommand{\thefigure}{S\arabic{figure}}%}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\LARGE}{\thechapter.}{1em}{}
\usepackage{bibentry}
\usepackage{textcomp,marvosym}
\usepackage[aboveskip=1pt,labelfont=bf,labelsep=period,justification=raggedright,singlelinecheck=off]{caption}
\usepackage{parskip}
\usepackage[round]{natbib}
\usepackage{graphicx}
\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{epstopdf}
\usepackage{afterpage}
\begin{document}
\chapter{Materials and Methods}
\begin{longtable}{>{\centering\bfseries}m{3cm} >{\centering\arraybackslash}m{3.5in} >{\centering\arraybackslash}m{1in}}
\renewcommand{\arraystretch}{1.5}% Spread rows out...
\caption[M-IV Competence Media Component Solutions]{M-IV Competence Media Component Solutions \label{M-IV}} \\
\toprule
Solution Name & \textbf{Component} & \\
\midrule
\endhead
\caption[]{-- Continued from overleaf}\\
\toprule
Solution Name & \textbf{Composition} & \\
\midrule
\endhead
\bottomrule
\endfoot
\bottomrule
\endlastfoot
Solution 21 & L-Aspartic acid & 4 g \\
& L-Glutamic acid & 0.2 g \\
& Furmaric acid & 1.0 g \\
& NaCl & 4.7 g \\
& K\textsubscript{2}HPO\textsubscript{4} & 0.87 g\\
& KH\textsubscript{2}PO\textsubscript{4} & 0.67 g\\
& Tween-80 & 0.2 ml\\
& Distilled water & 850 ml \\
\parbox[\textwidth]{20cm}{\hspace*{2cm} \textnormal{Adjust pH to 7.4 using 4 N NaOH, and then make to 1 L using Distilled water}} \\
& Sterilise by autoclaving & \\
Solution 22 & L-Cystine* & 0.04 g \\
& L-Tyrosine* & 0.1 g \\
& L-Citruline & 0.06 g \\
& L-Phenylalanine & 0.2 g \\
& L-Serine & 0.3 g \\
& L-Alanine & 0.2 g \\
& Sterilise by filtration & \\
Solution 23 & CaCl\textsubscript{2} & 0.1 M \\
& Sterilise by autoclaving & \\
& & \\
Solution 24 & MgSO\textsubscript{4} & 0.1 M \\
& Sterilise by autoclave & \\
& & \\
Solution 40 & vitamin-free casamino acids & 5\% (w/v) \\
& Make to 100 ml with Distilled water & \\
& Sterilise by autoclave & \\
\end{longtable}
\end{document}
基本上,我尝试插入“使用 4 N NaOH 将 pH 值调整为 7.4,然后使用蒸馏水调整为 1 L”作为文本,该文本横跨表格的所有三行,但是,下面的一行非常接近文本的底部,我想知道如何正确设置它的间距/是否有其他方法可以插入文本。我是 LaTeX 的新手,所以我仍在努力掌握一切。提前致谢!
答案1
尝试:
\documentclass{report}[12pt, oneside, a4paper]
\usepackage{geometry}
\geometry{verbose,
tmargin=2.5cm, rmargin=2.5cm, bmargin=2.5cm, lmargin=3.5cm, headsep=0cm}
\usepackage{array,booktabs,makecell,longtable}
\renewcommand\theadfont{\bfseries\sffamily}
\usepackage{siunitx}
\usepackage[utf8]{inputenc}
\usepackage{textcomp,marvosym}
\usepackage[aboveskip=1pt,labelfont=bf,
labelsep=period,
justification=raggedright,
singlelinecheck=off]{caption}
\begin{document}
\chapter{Materials and Methods}
\begin{longtable}{l
l
S[table-format=4.3,table-space-text-post={******}]
}
%\renewcommand{\arraystretch}{1.5}% Spread rows out...
%\caption{M-IV Competence Media Component Solutions} \\
% \label{M-IV}
\toprule
\thead{Solution Name}
& \thead{Composition} & ? \\
\midrule
\endhead
\caption[]{-- Continued from overleaf} \\
\toprule
\thead{Solution Name}
& \thead{Composition} & ? \\
\midrule
\endhead
\bottomrule
\endfoot
\bottomrule
\endlastfoot
Solution 21 & L-Aspartic acid & 4 g \\
& L-Glutamic acid & 0.2 g \\
& Furmaric acid & 1.0 g \\
& NaCl & 4.7 g \\
& K\textsubscript{2}HPO\textsubscript{4}
& 0.87 g \\
& KH\textsubscript{2}PO\textsubscript{4}
& 0.67 g \\
& Tween-80 & 0.2 ml \\
& Distilled water & 850 ml \\
\multicolumn{3}{l}{%\makecell[l]{
Adjust pH to 7.4 using 4 N NaOH,%\\
and then make to 1 L using Distilled water} \\
& Sterilise by autoclaving & \\
Solution 22 & L-Cystine* & 0.04 g \\
& L-Tyrosine* & 0.1 g \\
& L-Citruline & 0.06 g \\
& L-Phenylalanine & 0.2 g \\
& L-Serine & 0.3 g \\
& L-Alanine & 0.2 g \\
& Sterilise by filtration & \\
Solution 23 & CaCl\textsubscript{2} & 0.1 M \\
& Sterilise by autoclaving & \\
\addlinespace
Solution 24 & MgSO\textsubscript{4} & 0.1 M \\
& Sterilise by autoclave & \\
\addlinespace
Solution 40 & vitamin-free casamino acids
& 5\,\% (w/v) \\
& Make to 100 ml with Distilled water
& \\
& Sterilise by autoclave & \\
\end{longtable}
\end{document}
如您所见,我省略了序言中与此表无关的所有包,但是我添加了两个新包:makecell
我从中使用宏thead
使列标题更美观,并准备使用makecell
,这可以将长句放在两行表格中间(如果您愿意的话)。使用S
提供的列类型,sinuntx
我重新格式化了最后一列的外观。我还将前两列的列类型更改为l
。这样,测试可能会使表格看起来更好。
经过此更改后,表格的宽度比测试宽度窄,但这是其自然宽度。如果您坚持使用更宽的表格,则可以用l
足够宽度的p
列替换一列。表格的高度小于文本宽度,因此它可以作为普通表格包含在文本中,而不是长表格(如果这是完整的表格)。
得到的表格为: