将侧向表水平和垂直居中

将侧向表水平和垂直居中

我试图在文档末尾放置一个侧向表格,但似乎无法像预期的那样完美地将其置于 A4 页面的中心。

以下是我的序言:

\documentclass[11pt,a4paper,twoside, twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[UKenglish]{babel}
\usepackage[UKenglish]{isodate}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lmodern}
\usepackage[bottom]{footmisc}
\usepackage{bm}
\usepackage{url}
\usepackage{paralist}
\usepackage{lipsum}
\usepackage{siunitx}
\usepackage{lettrine}
\usepackage{graphicx}

\usepackage{tabu}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X} % centered "X" column type
\usepackage{multirow}
\usepackage{array}
\newcolumntype{L}{>{\centering\arraybackslash}m{2.75cm}}

\usepackage{todonotes}

\usepackage{titling}
\setlength{\droptitle}{-2em} 

\title{\huge \textbf{Not relevant}}
\author{Not relevant}
\date{6$^{\text{th}}$ March 2013}

\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{endogenous.bib}

\usepackage{cleveref}
\usepackage[font=footnotesize,labelfont={bf,sf},justification=centering]{caption}
\usepackage{fancyhdr} 
\usepackage{microtype}

以下是文档本身:

\begin{document}

\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{\textsc{Test}}
\lfoot{}
\cfoot{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\clearpage
\thispagestyle{empty}

\begin{sidewaystable*}[t!]
\centering
\small
\begin{tabu}{Lccccccccccccccc}
\toprule
& \multicolumn{3}{c}{De6} & \multicolumn{3}{c}{19q2} & \multicolumn{3}{c}{1q13} & \multicolumn{3}{c}{6q26} & \multicolumn{3}{c}{12q12} \\
\midrule
\rowfont{\footnotesize}
& AA & Aa & aa & AA & Aa & aa & AA & Aa & aa & AA & Aa & aa & AA & Aa & aa \\
\rowfont{\tiny}
& ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) \\
\midrule 
\rowfont{\footnotesize}
{\small Observed number ($O$)} &    0&  4&  20& 1&  1&  11& 0&  1&  9&  1&  3&  5&  1&  0&  12 \\[2ex]
\rowfont{\footnotesize}
{\small Percentage} &   0.00\%& 16.67\% &83.33\%    &7.69\% &7.69\% &84.62\%    &0.00\% &10.00\%    &90.00\%    &11.11\%    &33.33\%    &55.56\%&   7.69\%& 0.00\%& 92.31\% \\[2ex]
{\small p frequency} & \multicolumn{3}{c}{0.0833} & \multicolumn{3}{c}{0.115} & \multicolumn{3}{c}{0.05} & \multicolumn{3}{c}{0.278} & \multicolumn{3}{c}{0.0769} \\
{\small q frequency} & \multicolumn{3}{c}{0.917} & \multicolumn{3}{c}{0.885} & \multicolumn{3}{c}{0.95} & \multicolumn{3}{c}{0.722} & \multicolumn{3}{c}{0.923} \\
\cmidrule{2-16}
& $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ \\
\cmidrule{2-16}
\rowfont{\footnotesize}
{\small Expected genotype frequency}& 0.006 &   0.152 & 0.840 & 0.013 & 0.204 & 0.782 & 0.003 & 0.095   & 0.903 & 0.077 & 0.401 & 0.522 & 0.006 & 0.142 &   0.852 \\ [2ex]
\rowfont{\footnotesize}
{\small Expected no. of genotype ($E$)} & 0.167 &   3.67 &  20.2 &  0.173 & 2.65 &  10.2 &  0.025 & 0.95 &  9.03 &  0.694 & 3.61 &  4.69 &  0.0769 &    1.85 &  11.08 \\[2ex]
\rowfont{\footnotesize}
{\large $\frac{(O-E)^2}{E}$}    & 0.167 & 0.03 &    0.001 & 3.95 &  1.03 &  0.067 & 0.025   & 0.003 &   $6.93 \times 10^{-5}$ & 0.134 & 0.103 & 0.02 & 11.07 & 1.85 &   0.077 \\
\cmidrule{2-16}
Total $\chi^{2}$ value  & \multicolumn{3}{c}{\textbf{0.198}} & \multicolumn{3}{c}{\textbf{5.05}} & \multicolumn{3}{c}{\textbf{0.03}} & \multicolumn{3}{c}{\textbf{0.26}} & \multicolumn{3}{c}{\textbf{13}} \\
\bottomrule
\end{tabu}
\caption{Hardy-Weinburg calculations for each insertion sequence}
\label{tab:hardyweinburg}
\end{sidewaystable*}

\clearpage
\end{document}

使用上述方法输出如下:

表格不居中

如您所见,表格并未在页面的垂直方向上居中,水平查看时,它显得离中心右侧太远了。

有办法改变这种情况吗?

答案1

的值\textheight太小,以至于表格无法适合 LaTeX 想要放置它的位置;因此,表格被推下去了。

通过局部减少边距(例如,在表格\newgeometry{margin=1cm}之后和之前插入),您可以获得垂直居中的横向表格。\clearpage

表格使用后可以恢复原始几何形状\restoregeometry

\documentclass[11pt,a4paper,twoside, twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[UKenglish]{babel}
\usepackage[UKenglish]{isodate}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lmodern}
\usepackage[bottom]{footmisc}
\usepackage{bm}
\usepackage{url}
\usepackage{paralist}
\usepackage{lipsum}
\usepackage{siunitx}
\usepackage{lettrine}
\usepackage{graphicx}
\usepackage[showframe]{geometry}

\usepackage{tabu}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X} % centered "X" column type
\usepackage{multirow}
\usepackage{array}
\newcolumntype{L}{>{\centering\arraybackslash}m{2.75cm}}

\usepackage{todonotes}

\usepackage{titling}
\setlength{\droptitle}{-2em} 

\title{\huge \textbf{Not relevant}}
\author{Not relevant}
\date{6$^{\text{th}}$ March 2013}

\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{endogenous.bib}

\usepackage{cleveref}
\usepackage[font=footnotesize,labelfont={bf,sf},justification=centering]{caption}
\usepackage{fancyhdr} 
\usepackage{microtype}

\begin{document}

\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{\textsc{Test}}
\lfoot{}
\cfoot{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\clearpage
\newgeometry{margin=1cm}
\thispagestyle{empty}

\begin{sidewaystable*}[t!]
\centering
\small
\begin{tabu}{Lccccccccccccccc}
\toprule
& \multicolumn{3}{c}{De6} & \multicolumn{3}{c}{19q2} & \multicolumn{3}{c}{1q13} & \multicolumn{3}{c}{6q26} & \multicolumn{3}{c}{12q12} \\
\midrule
\rowfont{\footnotesize}
& AA & Aa & aa & AA & Aa & aa & AA & Aa & aa & AA & Aa & aa & AA & Aa & aa \\
\rowfont{\tiny}
& ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) & ($+$/$-$) & ($+$/$-$) & ($-$/$-$) \\
\midrule 
\rowfont{\footnotesize}
{\small Observed number ($O$)} &    0&  4&  20& 1&  1&  11& 0&  1&  9&  1&  3&  5&  1&  0&  12 \\[2ex]
\rowfont{\footnotesize}
{\small Percentage} &   0.00\%& 16.67\% &83.33\%    &7.69\% &7.69\% &84.62\%    &0.00\% &10.00\%    &90.00\%    &11.11\%    &33.33\%    &55.56\%&   7.69\%& 0.00\%& 92.31\% \\[2ex]
{\small p frequency} & \multicolumn{3}{c}{0.0833} & \multicolumn{3}{c}{0.115} & \multicolumn{3}{c}{0.05} & \multicolumn{3}{c}{0.278} & \multicolumn{3}{c}{0.0769} \\
{\small q frequency} & \multicolumn{3}{c}{0.917} & \multicolumn{3}{c}{0.885} & \multicolumn{3}{c}{0.95} & \multicolumn{3}{c}{0.722} & \multicolumn{3}{c}{0.923} \\
\cmidrule{2-16}
& $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ & $p^2$ & $2pq$ & $q^2$ \\
\cmidrule{2-16}
\rowfont{\footnotesize}
{\small Expected genotype frequency}& 0.006 &   0.152 & 0.840 & 0.013 & 0.204 & 0.782 & 0.003 & 0.095   & 0.903 & 0.077 & 0.401 & 0.522 & 0.006 & 0.142 &   0.852 \\ [2ex]
\rowfont{\footnotesize}
{\small Expected no. of genotype ($E$)} & 0.167 &   3.67 &  20.2 &  0.173 & 2.65 &  10.2 &  0.025 & 0.95 &  9.03 &  0.694 & 3.61 &  4.69 &  0.0769 &    1.85 &  11.08 \\[2ex]
\rowfont{\footnotesize}
{\large $\frac{(O-E)^2}{E}$}    & 0.167 & 0.03 &    0.001 & 3.95 &  1.03 &  0.067 & 0.025   & 0.003 &   $6.93 \times 10^{-5}$ & 0.134 & 0.103 & 0.02 & 11.07 & 1.85 &   0.077 \\
\cmidrule{2-16}
Total $\chi^{2}$ value  & \multicolumn{3}{c}{\textbf{0.198}} & \multicolumn{3}{c}{\textbf{5.05}} & \multicolumn{3}{c}{\textbf{0.03}} & \multicolumn{3}{c}{\textbf{0.26}} & \multicolumn{3}{c}{\textbf{13}} \\
\bottomrule
\end{tabu}
\caption{Hardy-Weinburg calculations for each insertion sequence}
\label{tab:hardyweinburg}
\end{sidewaystable*}

\clearpage
\restoregeometry
\end{document}

在此处输入图片描述

相关内容