Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to have a sideways table at the end of my document, however I can't seem to get it to centre to the A4 page perfectly like intended.

Here's my preamble:

\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}

And here's the document itself:

\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}

Using the above it's outputting like so:

table not centred

As you can see the table isn't centred on the page vertically, when viewing horizontally it appears too far to the right of centre.

Is there a way of changing this?

share|improve this question
    
Your table is too long to fit on the page (add \usepackage[showframe]{geometry} to your preamble in order to visualise this). Either 1) locally reduce the font size, or 2) locally decrease the margins using \newgeometry, or 3) modify your table to make it fit on the page. –  Jubobs Mar 13 '13 at 22:17
add comment

1 Answer

up vote 3 down vote accepted

The value of \textheight is too small for your table to fit where LaTeX wants to place it; therefore, the table gets pushed down.

By locally decreasing the margins (for instance, by inserting \newgeometry{margin=1cm} after \clearpage and before your table), you obtain a vertically centered sideways table.

The original geometry can be restored after the table using \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}

enter image description here

share|improve this answer
    
\newgeometry is just what I was looking for thank you, also how would I go about resetting the margins to default on the subsequent pages? –  Ben Mar 13 '13 at 22:27
1  
With \restoregeometry. I'll add it to my solution. –  Jubobs Mar 13 '13 at 22:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.