我试图让它看起来更专业,或者至少从所有垂直线来看更好。LaTeX 中的表格,因为它们往往非常丑陋且大多数时候难以维护。几乎所有关于表格的示例/操作方法都会产生令人尴尬的结果,
这里有没有人能帮我给我的桌子加点东西
% Initialising the document type with some formatting information
\documentclass[pdftex,12pt,a4paper]{article}
% Allow urls to be split at end of line
\PassOptionsToPackage{hyphens}{url}
% Allow tables to be read in from CSV and use centered width formatted columns
\usepackage{csvsimple,booktabs}
\usepackage{siunitx}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{tabularx,ragged2e}
% Allow tables and figures to be referenced by name
% https:,,tex.stackexchange.com,questions,397031,conflict-with-hyperref-and-titlesec
\usepackage{xr-hyper}
\usepackage[hidelinks]{hyperref}
% Allow long things to be split
\usepackage{seqsplit}
% Remove the indentation when starting new paragraphs, but still add a blank line.
\usepackage[parfill]{parskip}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
% Allow multiple line comments.
\usepackage{verbatim}
% Package for dealing with graphics - for figures.
\usepackage{graphicx}
% Allows a space to be included after inserting formatted text.
\usepackage{xspace}
% add line numbers
\usepackage{lineno}
\linenumbers
%% Allow more control over chapters and sections etc.
%\usepackage{titlesec}
%
%% Allow the paragraph tag to mark extra section depth
%\setcounter{secnumdepth}{4}
%\titleformat{\paragraph}
%{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
%\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
% Allow single pages to be changed to landscape, including in PDF preview.
\usepackage{lscape}
% Allow figures to be rotated and included in landscape.
\usepackage{rotating}
\usepackage{adjustbox}
% Allow wrapping for landscape pages
\usepackage{afterpage}
% Allow columns to span multiple rows.
\usepackage{multirow}
\usepackage{array}
% More formatting options for lists
\usepackage{enumitem}
% Allow different colouring for individual cells in tables.
\usepackage[table]{xcolor}
% Allow more complex formatting of tables.
\usepackage{tabularx}
% Special centred and auto-widthed table
\newcolumntype{Y}{>{\centering\arraybackslash}X}
% Allow page spanning tables
\usepackage{longtable}
% Allow tables to be forced into position with [H]. - don't remember what this meant
% plaintiff should force caption to top
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
% Parnotes package organises footnotes in tables
\usepackage[roman]{parnotes}
\makeatletter
\def\parnoteclear{%
\gdef\PN@text{}%
\parnotereset
}
% To allow ticks in tables (by typing \tick)
\usepackage{pifont}
\newcommand{\tick}{\ding{52}}
% Package to allow some maths stuff (±)
\usepackage{textcomp}
% Set the margin widths
\usepackage[top=2.45cm,bottom=2.45cm,left=3.17cm,right=3.17cm,twoside]{geometry}
% Allow figures and tables to be named in different ways.
\usepackage{chngcntr}
% Count tables individually within each section.
%\counterwithin{table}{section}
%\counterwithin{figure}{section}
% Allow Harvard formatting for references - reference with \citep{key,key2,etc.}. Or \citept{key} to reference as Name et al. (2012)
% Remember that you have to run Macros -> Applescript -> Bibliography (?r) to make references appear
% The style file for this is referred to in the section at the bottom.
\usepackage{natbib}
\setlength{\bibsep}{0.0pt}
\bibpunct{(}{)}{;}{a}{,}{,}
% First line adds the reference section to the Contents page, second line renames it from 'Bibliography' to 'References'
\usepackage[nottoc,notlof,notlot]{tocbibind}
\settocbibname{References}
% This package allows a list of abbreviations to be created (make sure it is added to the contents - "intoc").
\usepackage{nomencl}
\makenomenclature
% double quotation
\usepackage{csquotes}
% Format the document with double line spacing. - should this be 1.655 or 2
%\linespread{1.7}
% Allow the gap around captions to be increased to aid legibility on tables
\usepackage{caption}
\captionsetup[figure]{font=scriptsize,labelfont=scriptsize}
% Below is probably preferable - turns off double line spacing for figure legends and within tables (makes all tables much smaller)
\usepackage{setspace}
%\doublespacing
\onehalfspacing
% Allow text to be placed at the bottom of a page
\newenvironment{bottompar}{\par\vspace*{\fill}}{\clearpage}
% Allow double spacing in tables - usually reverted to single by setspace
\usepackage{etoolbox}
\AtBeginEnvironment{tabularx}{\doublespacing}
\newcommand*{\TitleFont}{%
\usefont{\encodingdefault}{\rmdefault}{b}{n}%
\fontsize{12}{20}%
\selectfont}
\begin{document}
\begin{landscape}
\begin{table}[]
\centering
\caption{Summary of transposable elements }
\label{tab:Table1}
\begin{adjustbox}{width=1.8\textwidth}
\begin{tabular}{|cc|ccc|ccc|ccc|ccc|}
\hline
Class & Order & \multicolumn{3}{c}{rom } & \multicolumn{3}{c}{act} & \multicolumn{3}{c}{erus} & \multicolumn{3}{c}{\cos} \\
& & Numbers & Length (bp) & \% & Numbers & Length (bp) & \% & Numbers & Length (bp) & \% & Numbers & Length (bp) & \% \\
\hline
\hline
\begin{tabular}[c]{@{}c@{}}Class I\\ \end{tabular} & & & & & & & & & & & & & \\
\hline
&SINEs: & 255687 & 30551159 & 1.52 & 257887 & 31080491 & 1.56 & 261248 & 31533761 & 1.57 & 258371 & 30783770 &1.42 \\
&Alu/B1 & 0 & 0 & 0.00 & 0 & 0 & 0.00 & 0 & 0 & 0.00 & 0 &0 & 0.00 \\
&MIRs & 247894 & 30250569 & 1.51 & 249065 & 30760408 & 1.54 & 251376 & 31188301 & 1.55 & 248923 &30437726 &1.40 \\
&LINEs: & 498627 & 207732214 & 10.37 & 501561 & 211005106 & 10.59 &516019 &220321176 &10.97 & 543212 &226312996 &10.42 \\
&LINE1 & 338909 & 163725095 & 8.17 & 342054 & 166954821 & 8.38 &354388 &175466399 &8.73 &382755 &182566388 &8.40 \\
&LINE2 & 133681 & 37311794 & 1.86 & 133693 & 37430629 &1.88 &135350 &38013575 &1.89 &134657 &37312366 &1.72 \\
&L3/CR1 & 16230 &3946140 & 0.20 & 16295 & 3952685 &0.20 &16386 &3999393 &0.20 &16301 &3896521 &0.18 \\
&RTE & 8327 & 2349410 & 0.12 & 8280 & 2342043 & 0.12 &8320 &2362314 &0.12 &8391 &2315634 &0.11 \\
\hline
<R elements: & 2368202 & 360743057 & 18.00 &2138613 & 331038087 & 16.61 &2043931 &305371407 &15.20 &2399880 &376465663 &17.33 \\
\hline
&ERVL & 603471 & 94653879 & 4.72 & 535533 & 89635873 &4.50 &457960 &74681407 &3.72 &589003 &95266242 &4.39 \\
&ERVL-MaLRs & 936686 & 137736037 & 6.87 & 757066 & 122605363 &6.15 &683557 &105114613 &5.23 &927914 &138867517 &6.39 \\
&ERV\_classI & 401868 & 69495491 &3.47 & 476978 &72572164 &3.64 &458525 &72184510 &3.59 &442380 &80571827 & 3.71\\
&ERV\_classII & 179048 & 21382713 &1.07 & 143640 & 16451857 & 0.83 &146189 &18906035 &0.94 &198036 &22430344 &1.03 \\
\hline
\hline
\begin{tabular}[c]{@{}c@{}}Class II\\
\end{tabular} & & & & & & & & & & & & & \\
\hline
& DNA transposons: & 259000 &53746062 & 2.68 & 261351 & 54598424 & 2.74 &264855 &55556571 &2.77 & 265748 &54859043 &2.53 \\
\hline
& hAT-Charlie &153463 & 28637685 & 1.43 & 154577 & 29132748 & 1.46 &156022 & 29603550 &1.47 & 156955 &29239810 &1.35 \\
& TcMar-Tigger &36981 & 11185164 & 0.56 & 38120 & 11441081 &0.57 &39444 &11766559 & 0.59 & 38989 &11514055 &0.53 \\
\hline
&Rolling-circles & 659955 & 72981412 &3.64 & 803681 & 84486255 & 4.24 &889437 &94191508 & 4.69 & 738026 &79989304 &3.68 \\
\hline
&Unclassified. & 3128 & 509710 & 0.03 & 3147 & 512316 & 0.03 &3191 &518292 & 0.03 & 3167 &510872 &0.02 \\
\hline
Total & & 0 & 00000 & 000.25 & 0 &712929637 & 35.78 & X & 00000 & 300
\end{tabular}
\end{adjustbox}
\end{table}
\end{landscape}
\end{document}
答案1
这样怎么样?我删除了所有垂直线,用垂直间距替换了一些水平线,减少了字体大小和列间距。此外,包含数字内容的列使用 columntype S
,从 开始siunitx
,以提高数字的可读性。
\documentclass{article}
\usepackage{lscape}
\usepackage{adjustbox}
\usepackage{array, booktabs, caption, multirow}
\usepackage{siunitx}
\usepackage[table, svgnames]{xcolor}
\begin{document}
\begin{landscape}
\begin{table}[]
\centering\small
\setlength{\tabcolsep}{3pt}
\setlength{\extrarowheight}{2pt}
\caption{Summary of transposable elements }
\label{tab:Table1}
\begin{tabular}{@{}l@{\,}r*{4}{S[table-format=7.0]@{\enspace}S[table-format=9.0]@{\enspace}S[table-format=2.2,table-number-alignment=center]}@{}}
\toprule
\multirow{2.2}{*}{Class} & \multirow{2.2}{*}{Order\qquad}& \multicolumn{3}{c}{rom } & \multicolumn{3}{c}{act} & \multicolumn{3}{c}{erus} & \multicolumn{3}{c}{$ \cos $} \\
& & {Numbers} & {Length (bp)} & {\%} & {Numbers} & {Length (bp)} & \% & {Numbers} & {Length (bp)} & \% & {Numbers} & {Length (bp)} & \% \\
\midrule\midrule
\multicolumn{2}{@{}l}{\textbf{Class I}} \\
&SINEs: & 255687 & 30551159 & 1.52 & 257887 & 31080491 & 1.56 & 261248 & 31533761 & 1.57 & 258371 & 30783770 &1.42 \\
&Alu/B1 & 0 & 0 & 0.00 & 0 & 0 & 0.00 & 0 & 0 & 0.00 & 0 &0 & 0.00 \\
&MIRs & 247894 & 30250569 & 1.51 & 249065 & 30760408 & 1.54 & 251376 & 31188301 & 1.55 & 248923 &30437726 &1.40 \\
&LINEs: & 498627 & 207732214 & 10.37 & 501561 & 211005106 & 10.59 &516019 &220321176 &10.97 & 543212 &226312996 &10.42 \\
&LINE1 & 338909 & 163725095 & 8.17 & 342054 & 166954821 & 8.38 &354388 &175466399 &8.73 &382755 &182566388 &8.40 \\
&LINE2 & 133681 & 37311794 & 1.86 & 133693 & 37430629 &1.88 &135350 &38013575 &1.89 &134657 &37312366 &1.72 \\
&L3/CR1 & 16230 &3946140 & 0.20 & 16295 & 3952685 &0.20 &16386 &3999393 &0.20 &16301 &3896521 &0.18 \\
&RTE & 8327 & 2349410 & 0.12 & 8280 & 2342043 & 0.12 &8320 &2362314 &0.12 &8391 &2315634 &0.11 \\
\rowcolor{Gainsboro!40! Lavender}[4pt]& \llap{LTR elements:} & 2368202 & 360743057 & 18.00 &2138613 & 331038087 & 16.61 &2043931 &305371407 &15.20 &2399880 &376465663 &17.33 \\
&ERVL & 603471 & 94653879 & 4.72 & 535533 & 89635873 &4.50 &457960 &74681407 &3.72 &589003 &95266242 &4.39 \\
&\llap{ERVL-MaLRs} & 936686 & 137736037 & 6.87 & 757066 & 122605363 &6.15 &683557 &105114613 &5.23 &927914 &138867517 &6.39 \\
&\llap{ERV\_classI} & 401868 & 69495491 &3.47 & 476978 &72572164 &3.64 &458525 &72184510 &3.59 &442380 &80571827 & 3.71\\
&\llap{ERV\_classII} & 179048 & 21382713 &1.07 & 143640 & 16451857 & 0.83 &146189 &18906035 &0.94 &198036 &22430344 &1.03 \\
\addlinespace
\multicolumn{2}{@{}l}{ \textbf{Class II}}\\[0.3ex]
& \llap{DNA transposons:} & 259000 &53746062 & 2.68 & 261351 & 54598424 & 2.74 &264855 &55556571 &2.77 & 265748 &54859043 &2.53 \\
& \llap{hAT-Charlie} &153463 & 28637685 & 1.43 & 154577 & 29132748 & 1.46 &156022 & 29603550 &1.47 & 156955 &29239810 &1.35 \\
& \llap{TcMar-Tigger} &36981 & 11185164 & 0.56 & 38120 & 11441081 &0.57 &39444 &11766559 & 0.59 & 38989 &11514055 &0.53 \\
&\llap{Rolling-circles} & 659955 & 72981412 &3.64 & 803681 & 84486255 & 4.24 &889437 &94191508 & 4.69 & 738026 &79989304 &3.68 \\
& Unclassified. & 3128 & 509710 & 0.03 & 3147 & 512316 & 0.03 &3191 &518292 & 0.03 & 3167 &510872 &0.02 \\
\midrule
& \textbf{Total} &0 & 00000 & 000.25 & 0 &712929637 & 35.78 & X & 00000 & 300
\end{tabular}
\end{table}
\end{landscape}
\end{document}
答案2
一些变化:首先siunitx
是数字。接下来我删除了第一列,因为它不占用任何空间。
然后我减小了字体大小并让 TeX 计算列间距。
\documentclass{article}
\usepackage{rotating}
\usepackage{siunitx,booktabs}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Summary of transposable elements }
\label{tab:Table1}
\footnotesize
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
S[table-format=7.0]
S[table-format=9.0]
S[table-format=2.2]
S[table-format=7.0]
S[table-format=9.0]
S[table-format=2.2]
S[table-format=7.0]
S[table-format=9.0]
S[table-format=2.2]
S[table-format=7.0]
S[table-format=9.0]
S[table-format=2.2]
}
\toprule
Order &
\multicolumn{3}{c}{rom} &
\multicolumn{3}{c}{act} &
\multicolumn{3}{c}{erus} &
\multicolumn{3}{c}{cos} \\
\cmidrule{2-4} \cmidrule{5-7} \cmidrule{8-10} \cmidrule{11-13}
& {N} & {L (bp)} & {\%} & {N} & {L (bp)} & {\%} & {N} & {L (bp)} & {\%} & {N} & {L (bp)} & {\%} \\
\midrule
\multicolumn{10}{@{}l}{\itshape Class I} \\
SINEs: & 255687 & 30551159 & 1.52 & 257887 & 31080491 & 1.56 & 261248 & 31533761 & 1.57 & 258371 & 30783770 &1.42 \\
Alu/B1 & 0 & 0 & 0.00 & 0 & 0 & 0.00 & 0 & 0 & 0.00 & 0 &0 & 0.00 \\
MIRs & 247894 & 30250569 & 1.51 & 249065 & 30760408 & 1.54 & 251376 & 31188301 & 1.55 & 248923 &30437726 &1.40 \\
LINEs: & 498627 & 207732214 & 10.37 & 501561 & 211005106 & 10.59 &516019 &220321176 &10.97 & 543212 &226312996 &10.42 \\
LINE1 & 338909 & 163725095 & 8.17 & 342054 & 166954821 & 8.38 &354388 &175466399 &8.73 &382755 &182566388 &8.40 \\
LINE2 & 133681 & 37311794 & 1.86 & 133693 & 37430629 &1.88 &135350 &38013575 &1.89 &134657 &37312366 &1.72 \\
L3/CR1 & 16230 &3946140 & 0.20 & 16295 & 3952685 &0.20 &16386 &3999393 &0.20 &16301 &3896521 &0.18 \\
RTE & 8327 & 2349410 & 0.12 & 8280 & 2342043 & 0.12 &8320 &2362314 &0.12 &8391 &2315634 &0.11 \\
\midrule
LTR elements: & 2368202 & 360743057 & 18.00 &2138613 & 331038087 & 16.61 &2043931 &305371407 &15.20 &2399880 &376465663 &17.33 \\
\midrule
ERVL & 603471 & 94653879 & 4.72 & 535533 & 89635873 &4.50 &457960 &74681407 &3.72 &589003 &95266242 &4.39 \\
ERVL-MaLRs & 936686 & 137736037 & 6.87 & 757066 & 122605363 &6.15 &683557 &105114613 &5.23 &927914 &138867517 &6.39 \\
ERV\_classI & 401868 & 69495491 &3.47 & 476978 &72572164 &3.64 &458525 &72184510 &3.59 &442380 &80571827 & 3.71\\
ERV\_classII & 179048 & 21382713 &1.07 & 143640 & 16451857 & 0.83 &146189 &18906035 &0.94 &198036 &22430344 &1.03 \\
\midrule[\heavyrulewidth]
\multicolumn{10}{@{}l}{\itshape Class II} \\
DNA transposons: & 259000 &53746062 & 2.68 & 261351 & 54598424 & 2.74 &264855 &55556571 &2.77 & 265748 &54859043 &2.53 \\
\midrule
hAT-Charlie &153463 & 28637685 & 1.43 & 154577 & 29132748 & 1.46 &156022 & 29603550 &1.47 & 156955 &29239810 &1.35 \\
TcMar-Tigger &36981 & 11185164 & 0.56 & 38120 & 11441081 &0.57 &39444 &11766559 & 0.59 & 38989 &11514055 &0.53 \\
\midrule
Rolling-circles & 659955 & 72981412 &3.64 & 803681 & 84486255 & 4.24 &889437 &94191508 & 4.69 & 738026 &79989304 &3.68 \\
\midrule
Unclassified. & 3128 & 509710 & 0.03 & 3147 & 512316 & 0.03 &3191 &518292 & 0.03 & 3167 &510872 &0.02 \\
\midrule[\heavyrulewidth]
\multicolumn{10}{@{}l}{\itshape Total} \\
& 0 & 0 & 0.00
& 0 & 0 & 0.00
& 0 & 0 & 0.00
\end{tabular*}
\end{sidewaystable}
\end{document}