0

I have a problem similar to:

Problem between Sidewaystable and page header

I want to insert some blank space above the vbox such that the table isn't overlapping with the page header.

Due to GDPR I can't share my table but It's on the below form:

\documentclass[12pt]{article}
\usepackage{float}
\usepackage{adjustbox}
\usepackage{rotating}

\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}

\fancypagestyle{documentstyle}{
    \fancyhf{} % clear all header and footer fields
    \renewcommand{\headrulewidth}{0.2pt}
    \lhead{\textit{Section 1}}
    \rhead{\textit{Name}}
    \cfoot{\thepage\ of \pageref{LastPage}}
}


\begin{document}

\newpage\pagestyle{documentstyle}

\setlength{\tabcolsep}{0.1cm}
\rotatebox{90}{
\vbox{
\begin{table}[H]
\centering
\begin{adjustbox}{width=1.5\textwidth,center=\textwidth}
\tiny
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1&1\\ \hline
1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1&1\\ \hline
\end{tabular}
\end{adjustbox}
\end{table}
}}

\end{document}
6
  • 1
    Your code produces an error on my machine.
    – user194703
    Apr 24, 2020 at 22:25
  • 1
    Anyway, you should never use adjustbox for tables, as it leads to fontsize inconsistencies.
    – Bernard
    Apr 24, 2020 at 22:33
  • @Schrödinger'scat, I updated the latex part, and it should work now. Apr 25, 2020 at 11:13
  • @Bernard Thank you for your comment, I was wondering, why it changed the size of the text when adjustbox was added. I use adjustbox to move the caption relative to the table, my table is so large that the difference between \tiny when using adjustbox and not using adjustbox is so small that I prefer using adjustbox in this case. Apr 25, 2020 at 11:21
  • You have several better solutions, but it's impossible to propose whatever without a representative example. Among the solutions, if there are many columns, reducing the value of tabcolsep (6pt by default, and there are two of them between two adjacent columns), using multilined cells and of course, reducing the font size (in my opinion, under \footnotesize, it gets unreadable – and very likely unread.
    – Bernard
    Apr 25, 2020 at 11:36

1 Answer 1

1

I would use sidewaystable. The table will be in the center of the text area as long as it is smaller than it:

\documentclass[12pt]{article}
\usepackage{rotating}

\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}

\fancypagestyle{documentstyle}{
    \fancyhf{} % clear all header and footer fields
    \renewcommand{\headrulewidth}{0.2pt}
    \lhead{\textit{Section 1}}
    \rhead{\textit{Name}}
    \cfoot{\thepage\ of \pageref{LastPage}}
}

\begin{document}
\pagestyle{documentstyle}

\begin{sidewaystable}
    \centering
\begin{tabular}{|c|c| c|c| c|c| c|c| c|c| c|c| c|c| c|}
    \hline
1& 2& 3& 4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15\\ \hline
1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1&1\\ \hline
\end{tabular}
\end{sidewaystable}

\end{document}

enter image description here

0

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.