다른 크기의 가로 페이지에 큰 tikz 이미지를 배치할 때 부동 또는 페이지 번호가 누락됨

다른 크기의 가로 페이지에 큰 tikz 이미지를 배치할 때 부동 또는 페이지 번호가 누락됨

큰 tikz 이미지가 포함된 문서가 있습니다. pdflatex를 사용하여 이 이미지를 표시하기 위해 용지 크기를 전환하는 매크로를 만들었고 pdflscapePDF 뷰어에 표시될 때 페이지를 회전하는 패키지를 사용하고 있습니다. 이 기술을 사용하면 회전된 더 큰 크기의 페이지에서 원하는 대로 그림을 표시할 수 있지만 다음 페이지의 바닥글에 페이지 번호가 누락되어 있습니다. 매뉴얼이 없으면 \clearpage텍스트가 다음 페이지로 제대로 넘어가지 않습니다. , 대신 바닥글을 통해 보이지 않는 심연으로 이어집니다.) 그림 다음의 두 번째 페이지에서는 페이지 번호가 반환됩니다.

아래의 최소 작업 예는 이 현상을 보여줍니다.

\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. 물론 텍스트 높이를 줄이면 이 경고가 방지되지만 대신 상자가 가득 찼다는 경고가 생성됩니다. 더 나은 솔루션은 경고가 없는 것입니다.

관련 정보