1

I am trying to create a large table in landscape mode, but using the geometry package changes where the page numbers go. The result is a visually appealing table, but awkwardly placed page number. Does anyone know how to get both? I can break the table up as needed.

\documentclass[11pt]{book}
\usepackage[all]{xy}
\usepackage{xparse}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{pdflscape}
\usepackage{endnotes}
\usepackage{caption}


\newcommand{\cocktail}[1]{\textbf{#1}\index{Cocktails!#1}}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}

%%% BEGIN DOCUMENT

\begin{document}

\mainmatter

\makeatletter
\def\cleardoublepage{\clearpage\if@twoside
    \ifodd\c@page
    \else\hbox{}\thispagestyle{empty}\newpage
    \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother


\makeatletter
\newcommand*{\cleartoleftpage}{%
    \clearpage
    \if@twoside
    \ifodd\c@page
    \hbox{}\thispagestyle{empty}\newpage
    \if@twocolumn
    \hbox{}\newpage
    \fi
    \fi
    \fi
}


\sloppy


\newgeometry{margin=1.5cm}
\begin{landscape}


\begin{table}[htbp]
  \centering
  \caption{Something Sweet and Sour}\label{sweetSour}%
    \begin{tabular}{l L{12em} L{12em}L{12em} L{10em}}
    \toprule
    Cocktail & Spirit & {Fruit juice} & {Sweetener} & Finishing touches \\
    \midrule
    \rowcolor[rgb]{ .929,  .929,  .929} \cocktail{Alabama Slammer} & {Southern Comfort,~0.75 oz} & {Orange juice, 2 oz} & Amaretto, 0.75 oz\newline{}Sloe Gin, 0.75 oz & {} \\[2em]
    \cocktail{Amaretto Sour} & Whiskey, 0.75 oz & {Lemon juice, 1 oz} & Amaretto, 1.5 oz\newline{}Simple syrup, 0.5 oz & Egg white\newline{}Angostura \\[2em]
    \rowcolor[rgb]{ .929,  .929,  .929} \cocktail{Arrack Punch} & Batavia Arrack, 1.5 oz\newline{}Rum, 0.5 oz & Lemon juice, 0.75 oz\newline{}Pineapple juice, 0.5 oz & {Simple syrup, 0.75 oz} & Mint sprig\newline{}Seasonal berries \\[2em]
    \cocktail{Autumn in New Jersey} & Applejack, 2 oz & {Lemon juice, 0.75 oz} & {Orgeat, 0.75 oz} & Angostura\newline{}Mint sprig \\[2em]
    \rowcolor[rgb]{ .929,  .929,  .929} \cocktail{Aviation} & Gin, 1.5 oz & {Lemon juice, 0.5 oz} & Luxardo, 0.75 oz \newline{}Cr\`{e}me de violette, 0.25 oz & Cherry or Lemon peel \\[2em]
    \cocktail{Batida de Coco} & Cacha\c{c}a, 1.5 oz & {Lime juice, 0.5 oz} & Cream of coconut, 1.75 oz & Grated nutmeg \\[2em]
    \rowcolor[rgb]{ .929,  .929,  .929} \cocktail{Bees Knees} & Genever, 1.5 oz & {Lemon juice, 0.5 oz} & {Honey syrup, 0.75 oz} & Lemon twist \\[2em]
    \cocktail{Bella Luna} & Gin, 2 oz & {Lemon juice, 0.75 oz} & Elderflower liqueur, 0.75 oz\newline{}Cr\`{e}me de violette, 0.5 oz\newline{}Simple syrup, 1 tsp & {} \\[2em]
    \rowcolor[rgb]{ .929,  .929,  .929} \cocktail{Blue martini} & Vodka, 0.75 oz & Lemon juice, 0.25 oz\newline{}Lime juice, 0.25 oz & Malibu coconut, 1 oz\newline{}Blue cura\c{c}ao, 0.5 oz\newline{}Simple syrup, 0.5 oz & Orange wheel \\[2em]
    \cocktail{Bramble} & Gin, 2 oz & {Lemon juice, 0.75 oz} & Cr\`{e}me de m\^{u}re, 0.5 oz\newline{}Simple syrup, 0.5 oz & Blackberry, lemon wheel \\[2em]
    \rowcolor[rgb]{ .929,  .929,  .929} \cocktail{Cable car} & Spiced rum, 1.5 oz & {Lemon juice, 1 oz} & Orange liqueur, 0.75 oz\newline{}Simple syrup, 0.5 oz & Cinnamon rim\newline{}Orange twist \\[2em]
    \cocktail{Caipirinha} & Cacha\c{c}a, 2 oz & {Muddle 1 lime} & Simple syrup, 1 oz & {} \\[2em]



\bottomrule
\end{tabular}
\end{table}
\end{landscape}

\restoregeometry

\end{document}

Table with awkwardly placed page number !(https://imgur.com/a/M5ahB8h)

New contributor
Ryan Aycock is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • Welcome to TeX.SE! Where yiz expect to be page number?
    – Zarko
    Sep 23 at 5:54
  • It should be spaced further inward at its default margin location. Right now, the page number is too close to the edge of the paper. Sep 23 at 6:18
  • It is located according to set of \newgeometry. However, your table can be fit on one page if you are willing a wee bit to change it design without to change its page layout.
    – Zarko
    Sep 23 at 6:30

1 Answer 1

1
  • Page number is positioned according to this page layout.
  • Since you are changed it by instruction
\newgeometry{margin=1.5cm}

it is placed according to new page layout.

  • To have page number on the sam place as on the others pages, you need to remove this instruction and a wee bit redesign your table. For example, use smaller font size and prescribe table width.
  • The table width you can specify in tabular*, xtabular, tblr (defined in the tabularray package) environments, etc.
  • An example, how your table can be set by use of rotating and tabularray packages, is:
\documentclass[11pt]{book}
\usepackage{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{rotating}
\usepackage{caption}
%\usepackage{endnotes}  N not needed in this example
%\usepackage[all]{xy}

\begin{document}

\begin{sidewaystable}[htbp]
    \centering
    \caption{Something Sweet and Sour}
    \label{sweetSour} 
    \small
\begin{tblr}{colsep=3pt,
             colspec={Q[l, font=\bfseries]
                      *{2}{X[l]} 
                      X[1.2, l]
                      X[0.8, l]},
             row{1}={font=\normalfont, c, m},
             row{even}={bg=gray!30},
             rowsep=3pt
             }
    \toprule
Cocktail    
    & Spirit & Fruit juice & Sweetener & Finishing touches  \\
    \midrule
{Alabama Slammer}
    & {Southern Comfort,\\ 0.75 oz}
        & Orange juice, 2 oz 
            & {Amaretto, 0.75 oz\\ Sloe Gin, 0.75 oz} 
                &                               \\
Amaretto Sour
    & Whiskey, 0.75 oz 
        & Lemon juice, 1 oz
            & {Amaretto, 1.5 oz\\ Simple syrup, 0.5 oz} 
                & Egg white Angostura           \\
Arrack Punch
    & Batavia Arrack, 1.5 oz Rum, 0.5 oz 
        & Lemon juice, 0.75 oz Pineapple juice, 0.5 oz 
            & Simple syrup, 0.75 oz
                & Mint sprig Seasonal berries   \\
{Autumn in\\
 New Jersey}
    & Applejack, 2 oz 
        & Lemon juice, 0.75 oz
            & Orgeat, 0.75 oz
                & Angostura Mint sprig          \\
Aviation
    & Gin, 1.5 oz 
        & Lemon juice, 0.5 oz
            & {Luxardo, 0.75 oz\\
               Cr\`{e}me de violette, 0.25 oz} 
                & Cherry or Lemon peel          \\
Batida de Coc
    & Cacha\c{c}a, 1.5 oz 
        & Lime juice, 0.5 oz
            & Cream of coconut, 1.75 oz 
                & Grated nutmeg                 \\
Bees Knees
    & Genever, 1.5 oz 
        & Lemon juice, 0.5 oz
            & Honey syrup, 0.75 oz
                & Lemon twist                   \\
Bella Luna
    & Gin, 2 oz 
        & Lemon juice, 0.75 oz
            & {Elderflower liqueur, 0.75 oz\\ 
              Cr\`{e}me de violette, 0.5 oz
              Simple syrup, 1 tsp}
                &                               \\
Blue martini
    & Vodka, 0.75 oz 
        & Lemon juice, 0.25 oz Lime juice, 0.25 oz 
            & Malibu coconut, 1 oz
              Blue cura\c{c}ao, 0.5 oz
              Simple syrup, 0.5 oz 
                & Orange wheel                  \\
Bramble
    & Gin, 2 oz 
        & Lemon juice, 0.75 oz
            & Cr\`{e}me de m\^{u}re, 0.5 oz
              Simple syrup, 0.5 oz 
                & Blackberry, lemon wheel       \\
Cable car
    & Spiced rum, 1.5 oz 
        & Lemon juice, 1 oz
            & Orange liqueur, 0.75 oz
              Simple syrup, 0.5 oz 
                & Cinnamon rim
                  Orange twist                  \\
Caipirinha
    & Cacha\c{c}a, 2 oz 
        & Muddle 1 lime
            & Simple syrup, 1 oz 
                &                               \\
    \bottomrule
\end{tblr}
\end{sidewaystable}

\end{document}

enter image description here

2
  • Thank you. This was really helpful. Sep 24 at 13:19
  • @RyanAycock, you are welcome. BTW, you may consider to accept answer (by clicking on check mark at top left side of the answer.)
    – Zarko
    Sep 24 at 15:23

Your Answer

Ryan Aycock is a new contributor. Be nice, and check out our Code of Conduct.

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.