大きな tikz 画像を含む文書があります。この画像を pdflatex を使用して表示するために、用紙サイズを切り替えるマクロを作成し、pdflscape
pdf ビューアで表示するときにページを回転するパッケージを使用しています。この手法を使用すると、回転した大きなサイズのページに図を希望どおりに表示できますが、次のページのフッターにページ番号がありません (手動の がないと\clearpage
、テキストは適切に次のページに分割されず、フッターを通り抜けてその先の目に見えない深淵へと続きます)。図の次の 2 ページ目で、ページ番号が戻ります。
以下の最小限の動作例は、この現象を示しています。
\documentclass{article}
\usepackage{tikz}
\usepackage{pdflscape}
\usetikzlibrary{shapes}
% Macros for changing paper size
\newcommand{\startPaperSizeB}{%
\begingroup
\clearpage
\setlength{\pdfpagewidth}{11in}
\setlength{\pdfpageheight}{17in}
\setlength{\paperwidth}{\pdfpagewidth}
\setlength{\paperheight}{\pdfpageheight}
\setlength{\oddsidemargin}{0pt}
\setlength{\textwidth}{650pt}
\setlength{\topmargin}{0pt}
\setlength{\headheight}{0pt}
\setlength{\headsep}{0pt}
\setlength{\textheight}{1084pt}
}
\newcommand{\stopPaperSizeB}{\endgroup \clearpage}
\begin{document}
Some text on the first page.
\startPaperSizeB
\begin{landscape}
\begin{figure}
\centering
\begin{tikzpicture}[]
\node [draw, rectangle, minimum height=625pt, minimum width=1000pt] (1) {};
\end{tikzpicture}
\caption{Caption for the large size figure}
\end{figure}
\end{landscape}
\stopPaperSizeB
Missing page number on this page?
\clearpage
Now the page number is back!
\end{document}
私は最近尋ねました非常に似た質問ただし、MWE から図を省きました。この質問には回答がありましたが、tikzpicture
大きな横長のページに を挿入すると解決策が機能しません。代わりに、大きな横長のページも図も表示されず、消えてしまいます。ボックスがいっぱいになっているという警告は表示されますが、図は表示されません。以下の MWE はこれを示しています。
\documentclass{article}
\usepackage{tikz}
\usepackage{pdflscape}
\usetikzlibrary{shapes}
% Macros for changing paper size
\newcommand{\startPaperSizeB}{%
\setlength{\pdfpagewidth}{11in}
\setlength{\pdfpageheight}{17in}
\setlength{\paperwidth}{\pdfpagewidth}
\setlength{\paperheight}{\pdfpageheight}
\setlength{\oddsidemargin}{0pt}
\setlength{\textwidth}{650pt}
\setlength{\topmargin}{0pt}
\setlength{\headheight}{0pt}
\setlength{\headsep}{0pt}
\setlength{\textheight}{1084pt}
}
\newcommand{\stopPaperSizeB}{}
\begin{document}
Some text on the first page.
\begin{landscape}
\startPaperSizeB
\begin{figure}
\centering
\begin{tikzpicture}[]
\node [draw, rectangle, minimum height=625pt, minimum width=1000pt] (1) {};
\end{tikzpicture}
\caption{Caption for the large size figure}
\end{figure}
\stopPaperSizeB
\end{landscape}
The page number is here, but the figure is not.
\end{document}
長方形のサイズが十分に縮小されると (たとえば、525 x 550 に縮小されると)、ページは通常のサイズで図がページからはみ出しているにもかかわらず、図はドキュメントの最後のページに表示されます。このため、パッケージ[H]
のオプションを試してみましたfloat
が、目標に近づいているようですが、まだ目標には達していません。何かアイデアはありますか?
答え1
geometry
パッケージを使用してテキスト領域のサイズを調整するという、受け入れ可能な答えを見つけました(geometry
パッケージ自体では、ドキュメントの途中で用紙サイズを変更することはできません)。コマンドを使用してtextwidth
と を設定し(パッケージを使用せずにこれらを設定すると奇妙な効果があります) 、環境を開始する前にこれを行うことが重要です。また、環境を終了した後は を呼び出す必要があります。textheight
\newgeometry
geometry
landscape
\restoregeometry
landscape
以下の例では、ページ番号の問題と tikz 図が消える問題の両方が修正されます。
\documentclass{article}
\usepackage{tikz}
\usepackage{pdflscape}
\usepackage[papersize={8.5in,11in}]{geometry}
\usepackage{lipsum}
\usetikzlibrary{shapes}
% Macros for changing paper size
\newcommand{\startBSizeLandscape}{%
\newgeometry{textwidth=614pt, textheight=1084pt}
\begin{landscape}
\setlength{\pdfpagewidth}{11in}
\setlength{\pdfpageheight}{17in}
\setlength{\paperwidth}{\pdfpagewidth}
\setlength{\paperheight}{\pdfpageheight}
\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{0pt}
\setlength{\marginparwidth}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\headheight}{0pt}
\setlength{\headsep}{0pt}
}
\newcommand{\stopBSizeLandscape}{%
\end{landscape}
\restoregeometry
}
\begin{document}
\lipsum
\startBSizeLandscape
\begin{figure}
\centering
\begin{tikzpicture}[]
\node [draw, rectangle, minimum height=589pt, minimum width=1000pt] {};
\end{tikzpicture}
\caption{Caption for the large size figure}
\end{figure}
\stopBSizeLandscape
\lipsum
\end{document}
これをコンパイルすると警告が表示されます。 'tmargin' and 'bmargin' result in NEGATIVE (-289.03001pt). 'height' should be shortened in length.
もちろん、テキストの高さを小さくするとこの警告は回避されますが、代わりにボックスがいっぱいであるという警告が表示されます。より良い解決策は、警告なしです。