大表格会将页码置于尴尬的位置

大表格会将页码置于尴尬的位置

我正在尝试以横向模式创建一个大型表格,但使用几何包会更改页码的位置。结果是一个视觉上吸引人的表格,但页码位置很尴尬。有人知道如何同时获得两者吗?我可以根据需要拆分表格。

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

表格中的页码位置很尴尬 !(https://i.stack.imgur.com/L3XKf.jpg

答案1

  • 页码是根据此页面布局定位的。
  • 由于您已通过指令进行了更改
\newgeometry{margin=1.5cm}

它是根据新的页面布局放置的。

  • 要使页码与其他页面位于同一位置,您需要删除此指令并稍微重新设计表格。例如,使用较小的字体大小并规定表格宽度。
  • tabular*您可以在、、(在包中定义)环境等xtabular中指定表格宽度。tblrtabularray
  • rotating举个例子,如何使用和包来设置你的表tabularray
\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}

在此处输入图片描述

相关内容