1

I have difficulties aligning my tables.

First thing is that Latex puts a distance between 2 tables alone on a page. I want the normal distance between them and the rest of the page just empty. Not both equally distributed on a page.

Second I have a lonely sidewaystable and it is centered. I want it to start at the top of the page and as before the rest of the page empty. So a vertical alignment for a landscape page. I managed that for normal tables with that \makeatletter...

\RequirePackage{rotating}
\documentclass[12pt, a4paper, listof=totoc, footlines=2, ngerman,english]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[T1]{fontenc}
\setlength{\parindent}{0em}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{gensymb}
\usepackage{mwe}
\usepackage{xpatch}

\makeatletter% Set distance from top of page to first float
\setlength\@fptop{0\p@}
\makeatother

\begin{document}

\begin{table}
    \centering
    \caption{Something}
    \label{tab:14}
    \begin{tabular}{ccccccc}
        \toprule
        \textbf{No.} &\textbf{AAAAAA} & \textbf{BBBBBB}& \textbf{CCCCCC}& \textbf{DDDDDD}& \textbf{EEEEEE}& \textbf{F} \\
        \midrule
        600 & 600 & 100 & 200 & 100 & -   & -  \\
        600 & 600 & 100 & 200 & -   & 100 & -  \\
        600 & 600 & 100 & 200 & -   & -   & 100\\
        600 & 600 & 100 & 250 & 50  & -   & -  \\
        600 & 600 & 100 & 250 & -   & 50  & -  \\
        600 & 600 & 100 & 250 & -   & -   & 50 \\
        \bottomrule
    \end{tabular}
\end{table}

\begin{table}
    \centering
    \caption{Something1}
    \label{tab:15}
    \begin{tabular}{cccccc}
        \toprule
        \textbf{AAAA} &\textbf{BBBB}/nm & \textbf{CCCCC}/\% & \textbf{DDDDD}/s& \textbf{EEEEE}/J& \textbf{FFFFFF}/N\\
        \midrule
        600 & - & 123 & 123 & -  & 12345 \\
        600 & - & 123 & 123 & -  & - \\
        600 & - & 123 & 123 & -  & - \\
        600 & 600.7 & 600.5 & 4.01 & -  & - \\
        600 & 600.0 & 600.9 & 2.73 & -  & - \\
        600 & 600.3 & 600.7 & 1.75 & -  & - \\ 
        600 & 600.7 & 600.9 & 2.40 & -  & - \\
        \bottomrule
    \end{tabular}
\end{table}

\clearpage
\begin{sidewaystable}
    \centering
    \caption{LALALALALALALALALALAL}
    \label{tab:16}
    \begin{tabular}{ccccccccc}
        \toprule
        \textbf{No.} &\textbf{AAAAAAAAA} &\textbf{AAAAAAAAAA} & \textbf{VVVVVVV} &\textbf{XXX} &\textbf{AAAA} & \textbf{CCCCT}& \textbf{XXNT}& \textbf{BIBIBI} \\
        \midrule
        600 & 614 & 650 & 100 & 200 & 50  & -   & -   & 50\\
        600 & 614 & 650 & 100 & 200 & 50  & -   & -   & 80\\
        600 & 615 & 650 & 100 & 200 & -   & 50  & -   & 50\\
        600 & 615 & 650 & 100 & 200 & -   & 50  & -   & 80\\
        600 & 616 & 650 & 100 & 200 & -   & -   & 50  & 50\\
        600 & 616 & 650 & 100 & 200 & -   & -   & 50  & 80\\
        \bottomrule
    \end{tabular}
\end{sidewaystable}

\end{document}

Maybe i should use more minipages, cause that floating sucks sometimes.

Regards

0

Just use the optional argument [!htb] for the first two tables. For the sideways table,add \hfill just before \begin{tabular}.

Unrelated, I replaced the hyphens in the tables with more correct endashes.

\documentclass[12pt, a4paper, listof=totoc, footlines=2, ngerman,english]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\setlength{\parindent}{0em}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{graphicx, rotating}
\usepackage{booktabs}
\usepackage{gensymb}
\usepackage{mwe}
\usepackage{xpatch}

\makeatletter% Set distance from top of page to first float
\setlength\@fptop{0\p@}
\makeatother
\setlength{\belowcaptionskip}{1ex}

\begin{document}

\begin{table}[!htb]
    \centering
    \caption{Something}
    \label{tab:14}
    \begin{tabular}{ccccccc}
        \toprule
        \textbf{No.} &\textbf{AAAAAA} & \textbf{BBBBBB}& \textbf{CCCCCC}& \textbf{DDDDDD}& \textbf{EEEEEE}& \textbf{F} \\
        \midrule
        600 & 600 & 100 & 200 & 100 & – & – \\
        600 & 600 & 100 & 200 & – & 100 & – \\
        600 & 600 & 100 & 200 & – & – & 100\\
        600 & 600 & 100 & 250 & 50 & – & – \\
        600 & 600 & 100 & 250 & – & 50 & – \\
        600 & 600 & 100 & 250 & – & – & 50 \\
        \bottomrule
    \end{tabular}
\end{table}

\begin{table}[!htb]
    \centering
    \caption{Something1}
    \label{tab:15}
    \begin{tabular}{cccccc}
        \toprule
        \textbf{AAAA} &\textbf{BBBB}/nm & \textbf{CCCCC}/\% & \textbf{DDDDD}/s& \textbf{EEEEE}/J& \textbf{FFFFFF}/N\\
        \midrule
        600 & – & 123 & 123 & – & 12345 \\
        600 & – & 123 & 123 & – & – \\
        600 & – & 123 & 123 & – & – \\
        600 & 600.7 & 600.5 & 4.01 & – & – \\
        600 & 600.0 & 600.9 & 2.73 & – & – \\
        600 & 600.3 & 600.7 & 1.75 & – & – \\
        600 & 600.7 & 600.9 & 2.40 & – & – \\
        \bottomrule
    \end{tabular}
\end{table}

\clearpage
{\rotFPtop = 0pt plus 0.18 fil
\begin{sidewaystable}[
\centering
\caption{LALALALALALALALALALAL}
\label{tab:16}
  \begin{tabular}{ccccccccc}
        \toprule
        \textbf{No.} &\textbf{AAAAAAAAA} &\textbf{AAAAAAAAAA} & \textbf{VVVVVVV} &\textbf{XXX} &\textbf{AAAA} & \textbf{CCCCT}& \textbf{XXNT}& \textbf{BIBIBI} \\
        \midrule
        600 & 614 & 650 & 100 & 200 & 50 & – & – & 50\\
        600 & 614 & 650 & 100 & 200 & 50 & – & – & 80\\
        600 & 615 & 650 & 100 & 200 & – & 50 & – & 50\\
        600 & 615 & 650 & 100 & 200 & – & 50 & – & 80\\
        600 & 616 & 650 & 100 & 200 & – & – & 50 & 50\\
        600 & 616 & 650 & 100 & 200 & – & – & 50 & 80\\
        \bottomrule
    \end{tabular}
\end{sidewaystable}}

enter image description here enter image description here

  • I tried the [!htb] already in my original file, it doesn't work. I don't know why it works here and not in my other document. U took me wrong with the second one. I mean not to the top of a portrait page, i mean to the top of the landscape page. So if u want to the left margin of a portrait page. But thanks for the endashes :)! – sandor_123 Feb 24 '18 at 14:56
  • @sandor_123: I've updated my answer. For the sideways table, I have a solution by trial and error, modifying the value of \rotFPtop. For the horizontal tables, could you post a small example reproducing the problem? – Bernard Feb 24 '18 at 15:57
  • Yes, thanks! So the sidewaystable works fine, also with the \vspace command u posted before. I took that one before u posted the second one. Hope its fine, or why did u change it? I managed to align also the 2 other tables. it worked with a \clearpage before :D. Thanks a lot – sandor_123 Feb 24 '18 at 16:28
  • I change it to when I saw these two glue lengths – \rotFPtop and \rotFPbot – in the documentation of rotating, just to use the ‘legal’ tools, also because one is never too sure there isn't a side effect. – Bernard Feb 24 '18 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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