Graphics, Figures & Tableslarge sidewaystable - scale down or remove header/footer?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
amoz
Posts: 14
Joined: Mon Mar 16, 2009 1:42 pm

large sidewaystable - scale down or remove header/footer?

Post by amoz »

Hi all,

What would be an elegant way to typeset this table on a [book] page? I would like to be able to remove header and footer text from the particular page this table appears on, but a [\thispagestyle{empty}] obviously does not work. I am not sure about scaling the whole table down. What would be your workaround?

Many thanks!

Code: Select all

\begin{sidewaystable}
%\centering
\caption{Deforestation rates in Brazil's Legal Amazon states, in km$^2$/year. These data are produced by INPE and published online at \url{http://www.obt.inpe.br/prodes} (Portuguese). The 1993 and 1994 figures reflect the average yearly rates}
\label{table:deforestation}
\renewcommand{\arraystretch}{1.5} 
\renewcommand{\tabcolsep}{0.2cm}
\begin{tabular}{l*{10}{c}}
\hline
& Acre& Amap\'a& Amazonas&	 Maranh\~ao& Mato Grosso& Par\'a& Rond\^onia& Roraima& Tocantins& Legal Amazon\\[0.5ex]
\cline{2-10}
1988& 620& 60& 1 510& 2 450& 5 140& 6 990& 2 340& 290& 1 650& 21 050\\
1989& 540& 130& 1 180& 1 420& 5 960& 5 750& 1 430& 630& 730& 17 770\\
1990& 550& 250& 520& 1 100& 4 020& 4 890& 1 670& 150& 580& 13 730\\
1991& 380& 410& 980& 670& 2 840& 3 780& 1 110& 420& 440& 11 030\\
1992& 400& 36& 799& 1 135& 4 674& 3 787& 2 265& 281& 409& 13 786\\
1993& 482& 0& 370& 372& 6 220& 4 284& 2 595& 240& 333& 14 896\\
1994& 482& 0& 370& 372& 6 220& 4 284& 2 595& 240& 333& 14 896\\
1995& 1208& 9& 2 114& 1 745& 10 391& 7 845& 4 730& 220& 797& 29 059\\
1996& 433& 0& 1 023& 1061& 6 543& 6 135& 2432& 214& 320& 18 161\\
1997& 358& 18& 589& 409& 5 271& 4 139& 1986& 184& 273& 13 227\\
1998& 536& 30& 670& 1 012& 6 466& 5 829& 2041& 223& 576& 17 383\\
1999& 441& 0& 720& 1 230& 6 963& 5 111& 2358& 220& 216& 17 259\\
2000& 547& 0& 612& 1 065& 6 369& 6 671& 2465& 253& 244& 18 226\\
2001& 419& 7& 634& 9 58& 7 703& 5 237& 2673& 345& 189& 18 165\\
2002& 730& 0& 881& 1 014& 7 892& 7 324& 3067& 84& 212& 21 205\\
2003& 885& 25& 1 632& 993& 10 405& 6 996& 3620& 439& 156& 25 151\\
2004& 769& 46& 1 221& 755& 11 814& 8 521& 3834& 311& 158& 27 429\\
2005& 541& 33& 752& 922& 7 145& 5 763& 3 233& 133& 271& 18 793\\
2006& 398& 30& 788& 651& 4 333& 5 505& 2 049& 231& 124& 14 109\\
2007& 184& 39& 610& 613& 2 678& 5 425& 1 611& 309& 63& 11 532\\
2008& 222& --& 479& 1 085& 3 259& 5 180& 1 061& 570& 112& 11 968\\ 
\hline
\end{tabular}
\end{sidewaystable}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Lucia
Posts: 36
Joined: Wed Dec 31, 2008 9:03 pm

large sidewaystable - scale down or remove header/footer?

Post by Lucia »

Hello.

I'm sorry, I don't have any solution to your problem, because I haven't use sidewaystable in any Latex document, so far. However, I have a sugestion. How about using inputenc in your preamble? This package allows you to write portuguese words with their accents, without the need to use sequences such as "Maranh\~ao". So, you can just type "Maranhão", it is much faster and easier. Take a look at this document, you will find information about this package.

Lucia
amoz
Posts: 14
Joined: Mon Mar 16, 2009 1:42 pm

Re: large sidewaystable - scale down or remove header/footer?

Post by amoz »

Muito obrigado, but the main text is in English. Only now and then I have a need for such accents so the standard LaTeX tricks work fine. Thanks for making the effort, though! I will save that pdf for possible later use.
Lucia
Posts: 36
Joined: Wed Dec 31, 2008 9:03 pm

Re: large sidewaystable - scale down or remove header/footer?

Post by Lucia »

De nada! Anyway, could you post here a minimal working example? I compiled your file with the book class, no packages or other options, and got 4 errors (One of the errors was: "LaTeX Error: Environment sidewaystable undefined"), so some packages and definitions might be missing here. Also, I'm interested in learning about sidewaystable and your example might be a very good starting point...

Edit: I just figured out that sidewaystable is an environment from the rotating package, so I included it on the preamble and that error disappeared. The table seems fine, why do you want to scale it down? From the topic title, I assume you want or a smaller table to fit in the page without rotating it and maintaining the header/footer, or removing header and footer with a rotated table.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

large sidewaystable - scale down or remove header/footer?

Post by localghost »

You can change the font size for your table with a simple switch.

Code: Select all

\begin{sidewaystable}
  \centering
  \small
  \caption{Deforestation rates in Brazil's Legal Amazon states, in km$^2$/year. These data are produced by INPE and published online at \url{http://www.obt.inpe.br/prodes} (Portuguese). The 1993 and 1994 figures reflect the average yearly rates}
  \label{table:deforestation}
  \renewcommand{\arraystretch}{1.5}
  \renewcommand{\tabcolsep}{0.2cm}
  \begin{tabular}{l*{10}{c}} \hline
    % contents of the table
  \end{tabular}
\end{sidewaystable}
You may take a look at the booktabs package that improves legibility of tables.


Best regards and welcome to the board
Thorsten¹
amoz
Posts: 14
Joined: Mon Mar 16, 2009 1:42 pm

large sidewaystable - scale down or remove header/footer?

Post by amoz »

Lucia wrote:The table seems fine, why do you want to scale it down? From the topic title, I assume you want or a smaller table to fit in the page without rotating it and maintaining the header/footer, or removing header and footer with a rotated table.
Thanks for trying that out, Lucia. Yes, I have a page header (containing the running section title) and a page footer (page number). The table extended into the header and footer, and things got a bit clumsy. Good luck with your sidewaystables.

I was thinking about scaling it down (my document is in 11pt) using [\small] but that got me wondering whether it would be feasible to instead put it on an empty page without headers (and thus with no need for downscaling).

Anyway, many thanks to Thorsten (localghost) and his Einsteinian LaTeX brain, for pointing me towards the easy way and the booktabs package (looking through the manual right now).

I will make a paypal donation to the community because I am in the process of typesetting my PhD and have come across many useful tips on this forum!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

large sidewaystable - scale down or remove header/footer?

Post by localghost »

You didn't yet talk about how you set up your headers (and footers) and your entire page dimensions. The fancyhdr package offers to set up a special page layout for float pages. Consider the following example.

Code: Select all

\documentclass[11pt,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[portuguese,english]{babel}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,rotating}
\usepackage{fancyhdr}
\usepackage{lmodern}
\usepackage{blindtext}
\usepackage{hyperref}

\setlength{\parindent}{0em}
\setlength{\headheight}{14pt}

% Page setup (fancyhdr)
\fancyhf{}
\fancyhead[LO]{\iffloatpage{}{\nouppercase\rightmark}}
\fancyhead[RE]{\iffloatpage{}{\nouppercase\leftmark}}
\fancyhead[RO,LE]{\iffloatpage{}{\thepage}}
\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}

\begin{document}
  \Blinddocument
  \begin{sidewaystable}
    \centering
%    \small
    \caption{Deforestation rates in Brazil's Legal Amazon states, in km$^2$/year. These data are produced by INPE and published online at \url{http://www.obt.inpe.br/prodes} (Portuguese). The 1993 and 1994 figures reflect the average yearly rates}
    \label{table:deforestation}
%    \renewcommand{\arraystretch}{1.5}
    \renewcommand{\tabcolsep}{2mm}
    \begin{tabular}{l*{10}{c}} \toprule
      & Acre& Amap\'a& Amazonas&    Maranh\~ao& Mato Grosso& Par\'a& Rond\^onia& Roraima& Tocantins& Legal Amazon \\ \cmidrule{2-10}
      1988& 620& 60& 1 510& 2 450& 5 140& 6 990& 2 340& 290& 1 650& 21 050 \\
      1989& 540& 130& 1 180& 1 420& 5 960& 5 750& 1 430& 630& 730& 17 770 \\
      1990& 550& 250& 520& 1 100& 4 020& 4 890& 1 670& 150& 580& 13 730 \\
      1991& 380& 410& 980& 670& 2 840& 3 780& 1 110& 420& 440& 11 030 \\
      1992& 400& 36& 799& 1 135& 4 674& 3 787& 2 265& 281& 409& 13 786 \\
      1993& 482& 0& 370& 372& 6 220& 4 284& 2 595& 240& 333& 14 896 \\
      1994& 482& 0& 370& 372& 6 220& 4 284& 2 595& 240& 333& 14 896 \\
      1995& 1208& 9& 2 114& 1 745& 10 391& 7 845& 4 730& 220& 797& 29 059 \\
      1996& 433& 0& 1 023& 1061& 6 543& 6 135& 2432& 214& 320& 18 161 \\
      1997& 358& 18& 589& 409& 5 271& 4 139& 1986& 184& 273& 13 227 \\
      1998& 536& 30& 670& 1 012& 6 466& 5 829& 2041& 223& 576& 17 383 \\
      1999& 441& 0& 720& 1 230& 6 963& 5 111& 2358& 220& 216& 17 259 \\
      2000& 547& 0& 612& 1 065& 6 369& 6 671& 2465& 253& 244& 18 226 \\
      2001& 419& 7& 634& 9 58& 7 703& 5 237& 2673& 345& 189& 18 165 \\
      2002& 730& 0& 881& 1 014& 7 892& 7 324& 3067& 84& 212& 21 205 \\
      2003& 885& 25& 1 632& 993& 10 405& 6 996& 3620& 439& 156& 25 151 \\
      2004& 769& 46& 1 221& 755& 11 814& 8 521& 3834& 311& 158& 27 429 \\
      2005& 541& 33& 752& 922& 7 145& 5 763& 3 233& 133& 271& 18 793 \\
      2006& 398& 30& 788& 651& 4 333& 5 505& 2 049& 231& 124& 14 109 \\
      2007& 184& 39& 610& 613& 2 678& 5 425& 1 611& 309& 63& 11 532 \\
      2008& 222& --& 479& 1 085& 3 259& 5 180& 1 061& 570& 112& 11 968 \\ \bottomrule
    \end{tabular}
  \end{sidewaystable}
\end{document}
In this case there is no need to scale down the table because the page dimensions set with the geometry package provide a type area that is big enough for the table. This is also true for the special float page layout. Adapt the code to your needs.
Attachments
olatex_105097.pdf
The sample code as PDF output.
(152 KiB) Downloaded 405 times
amoz
Posts: 14
Joined: Mon Mar 16, 2009 1:42 pm

large sidewaystable - scale down or remove header/footer?

Post by amoz »

Yes Thorsten, thanks for the follow-up. I would like to keep the geometry (letter) of my pages as it is now, I think the simple use of \small gives a fine result.

I hereby attach the code of my page setup, to make sure that you can have a look at the trouble these headings were giving me (as much as I like them). In fact I have a question on those headers as well, but I will post it in the appropriate part of the forum.

Code: Select all

\usepackage{fancyhdr} 
\pagestyle{fancy} 
\renewcommand{\chaptermark}[1]{\markboth{#1}{}} 
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} 
\fancyhf{} % delete current setting for header and footer
\fancyhead[LO]{\bfseries\rightmark} 
\fancyhead[RE]{\bfseries\leftmark}
\fancyfoot{} % clear all footer fields 
\fancyfoot[LE,RO]{\bfseries\thepage}  
\fancypagestyle{plain}{% 
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line 
} 
Best regards
amoz
Posts: 14
Joined: Mon Mar 16, 2009 1:42 pm

large sidewaystable - scale down or remove header/footer?

Post by amoz »

Back with another large one... It is a completely different table, but much harder to typeset as well (or so it seems). Page and header setup is the same as I mentioned in the post above.

What would you do to get this one on a letter sized bookpage?

Cheers to all who try to crack this nut!

Code: Select all

\begin{sidewaystable}
\centering
\small
\caption{Selected fragmentation indices. Symbols follow authors' convention or \citet{mcg02}. For a detailed description and formulae of landscape indices, see \citet{rii95,mcg95,mcg02}. Interior area is defined as the area whose boundary is a specified distance inwards from the patch perimeter, with the specified distance varying with the process or species of interest. The 
seminal reference of each metric is provided.}
\label{table:metrics}
\renewcommand{\arraystretch}{1.5} 
\renewcommand{\tabcolsep}{0.2cm}
\begin{tabular}{>{\raggedright}p{0.2\linewidth}>{\raggedright}p{0.05\linewidth}>{\raggedright}p{0.45\linewidth}>{\raggedright}p{0.2\linewidth}}
\toprule
Metric name& Symbol& Description& Reference\tabularnewline
\midrule
Number of patches& \textit{NP}& Number of patches of a particular class (or classes pooled)& \citet{tur89}\tabularnewline
Mean patch size& \textit{MPS}& Average area of a patch of a particular class (or classes pooled)& \citet{mcg02}\tabularnewline
Modified Euler number& $\varepsilon\ast$& Spatial integrity, based on the number of fragments and perforations& \citet{bog02.2}\tabularnewline
Largest patch index& \textit{LPI}& Percentage of landscape area occupied by the largest patch (of a class)& \citet{mcg95}\tabularnewline
Nearest neighbor distance& $d_{ij}$& Distance from patch \textit{i} to the nearest occupied patch \textit{j}, measure of patch isolation& \citet{har98}\tabularnewline
Proximity index&  \textit{PX}& Sum of area of all patches within a fixed distance of the focal patch& \citet{gus92}\tabularnewline
Patch coherence index&  \textit{C}& Tendency of pixels to aggregate, quantifies patch size evenness& \citet{jae00}\tabularnewline
Monmonier index&  \textit{F}& Aggregation of pixels into patches, measure of image complexity& \citet{mon74}\tabularnewline
Contagion index& $D_{2}$& ``Clumpiness'' of a map based on pixel adjacency& \citet{one88}\tabularnewline
Interspersion/\-Juxtaposition index&  \textit{IJI}&  ``Clumpiness'' of a map based on patch adjacency& \citet{mcg95}\tabularnewline
Patch cohesion index&  \textit{PC}& Area weighted perimeter-to-area ratio divided by area weighted mean shape index& \citet{sch96}\tabularnewline
Contiguity of cells&  $G_{1}$& Spatial connectedness of pixels, uses sliding window& \citet{lag91}\tabularnewline
Clustering of pixels& $G_{2}$& Spatial clustering of pixels, uses sliding window& \citet{lag91}\tabularnewline
Adjacency probability& $p_{c}$& Probability that the nearest neighbor of a pixel of class \textit{a} is also a pixel of class \textit{a}, alternative measure of contiguity& \citet{rii00}\tabularnewline
Lacunarity index&  \textit{L}& Number of cells of a particular class inside a sliding window& \citet{plo93}\tabularnewline
Interior-to-edge ratio& $I/E$& Presence of interior area relative to edge area, dependent on centripetal perturbation& \citet{for81}\tabularnewline
Fractal dimension&  \textit{FDI}& Complexity of patch geometry, uses perimeter-to-area relationship& \citet{kru87}\tabularnewline
Composite metric& $\Phi_{f}$& Comprehensive measure incorporating patch size, perimeter, isolation, and number of patches&  \citet{bog00.2}\tabularnewline
\bottomrule
\end{tabular}
\end{sidewaystable}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

large sidewaystable - scale down or remove header/footer?

Post by localghost »

I don't see any further problems. The example from my last reply should also work with this table. Perhaps you take a look at epslatex, which introduces a narrow environment to temporary change the margin of a page. In combination with removing the headers as demonstrated you will get the desired result. You may omit the line which increases the row height of the tabular.
Post Reply