헤더를 끄려면 페이지를 분리하세요.

헤더를 끄려면 페이지를 분리하세요.

문서 전반에 걸쳐 각 페이지에 머리글을 사용하고 있는데 \usepackage{fancyhdr}, 큰 숫자가 있는 특정 페이지에서는 머리글을 끄고 싶습니다. 올바르게 사용하면 \thispagestyle{empty}헤더가 제거되지만 임의의 페이지에서만 제거됩니다. \newpage그림 바로 앞에 놓고 를 사용하면 올바른 페이지에 효과를 적용할 수 있을 거라 생각했는데 \thispagestyle{empty}결과는 여전히 마찬가지입니다. 그림에 대해서만 새로 만들어야 합니까 .tex, 아니면 더 쉬운 방법이 있습니까?

내 문서에는 , , , , 다양한 문서가 main.tex있습니다 . 특정 문서를 보면 아래와 같이 그래픽이 삽입된 텍스트가 많이 있습니다.\begin{document}\pagestyle{fancy}\fancyfoot{}\lhead{\thepage}\rhead{\nouppercase{\rightmark}}.tex.tex

\begin{figure}
\centering
\hbox{\hspace{-15mm} \includegraphics[scale=0.9]{my-image}}
\caption{my caption}
\label{myfigure}
\end{figure}

이미지 바로 앞에 퍼팅을 시도했지만 잘못된 페이지에 적용 \newpage됩니다 . 댓글에 제시된 방법으로 \thispagestyle{empty}시도해 보았 으나 마찬가지 현상이 발생했습니다.\clearpage

답변1

\documentclass이것은 작동하는 것으로 보입니다(비록 우리는 시행 착오 솔루션에 대해 귀하나 그 밖의 많은 것을 알지 못하지만 ).

여기에 이미지 설명을 입력하세요여기에 이미지 설명을 입력하세요

\documentclass{article}

\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lipsum} % For text

\begin{filecontents}[overwrite]{chapter1.tex}
    \clearpage
    \thispagestyle{empty}
    \begin{figure}[p]
    \centering
    \hbox{\hspace{-15mm} \includegraphics[scale=0.9]{example-image-a}}
    \caption{my caption}
    \label{myfigure}
    \end{figure}
\end{filecontents}

\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\thepage}
\fancyhead[R]{\nouppercase{\rightmark}}
\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}

\begin{document}

\section{Test}
\lipsum[1-8]

\include{chapter1}

\lipsum[1-8]

\end{document}

의 부분은 제가 만든 파일 filecontents중 하나의 예일 뿐입니다 ..tex


페이지 에 페이지 번호를 넣으려면 [p]다음을 사용하십시오.

여기에 이미지 설명을 입력하세요

\documentclass{article}

\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lipsum} % For text

\begin{filecontents}[overwrite]{chapter1.tex}
    \clearpage
    \thispagestyle{floatp}
    \begin{figure}[p]
    \centering
    \hbox{\hspace{-15mm} \includegraphics[scale=0.9]{example-image-a}}
    \caption{my caption}
    \label{myfigure}
    \end{figure}
\end{filecontents}

\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\thepage}
\fancyhead[R]{\nouppercase{\rightmark}}
\renewcommand{\headrulewidth}{0pt}

% ------------ Added
\fancypagestyle{floatp}{%redefining plain pagestyle
    \fancyfoot{}
    \fancyhead{}
    \fancyfoot[R]{\thepage}         % Page number in bottom right
}

\pagestyle{fancy}

\begin{document}

\section{Test}
\lipsum[1-8]

\include{chapter1}

\lipsum[1-8]

\end{document}

답변2

대형 플로트에만 \floatpagestyle{empty}사용하려면 어떻게 해야 합니까 ?[p]

\rotfloatpagestyle및 패키지 \thisfloatpagestyle 설명서를 참조하십시오 floatpag.

또한 다음을 fancyhdr제공합니다. \iffloatpage{플로트 페이지의 값}{다른 페이지의 값}.

\documentclass[twoside]{article}
\usepackage{graphicx}
\usepackage{floatpag}\floatpagestyle{empty}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\begin{document}
\section{foo1}\subsection{foo}\lipsum[1]
\section{foo}\subsection{foo}\lipsum[1]
\section{foo}\subsection{foo}\lipsum[1-2]
\begin{figure}[h]\includegraphics[]{example-image-9x16}\caption{foo}\end{figure}
\section{foo}\subsection{foo}\lipsum[1]
\begin{figure}[p]\centering\includegraphics[]{example-image-9x16}\caption{foo}\end{figure}
\section{foo}\subsection{foo}\lipsum[1]
\section{foo}\subsection{foo}\lipsum[1]
\end{document}

답변3

\pagestyle{empty}그림이 담긴 페이지가 배송되기 전에 페이지 이후에 지시문이 발행되어야 합니다 .

  • shipout/after최근 LaTeX 릴리스에서는 LaTeX가 일부 페이지를 출시한 후 바로 코드를 실행하기 위한 후크를 사용할 수 있습니다 . ( \changes-항목 에 따르면ltshipout.dtx해당 후크는 2021년 1월 8일에 추가되었습니다.)

  • 패키지를 이용하시면 됩니다zrefLaTeX가 문제의 그림을 배치하는 페이지의 소위 "절대 페이지 번호" 값을 저장하고 검색합니다.

  • 또한 절대 페이지 번호와 일부 코드를 지정할 수 있는 매크로를 정의하여 절대 페이지 번호가 지정된 값을 갖는 페이지가 배송된 후에만 코드를 수행하기 위한 \CodeAfterShipoutOfAbsolutePage후크에 지시문이 추가되도록 할 수 있습니다.shipout/after

  • 아래 예에서는 TeX가 zref-label에 액세스하는 계산을 수행하도록 하여 절대 페이지 번호를 지정할 수 있습니다. 따라서 아래 예에서는 \CodeAfterShipoutOfAbsolutePage두 개의 인수만 사용하는 것이 아니라 세 개의 인수를 사용합니다. 그 중 하나는 절대 페이지 번호 지정을 위해 정의해야 하는 쉼표로 구분된 zlabel 목록을 나타냅니다. 첫 번째 컴파일의 경우처럼 zlabel 중 하나가 정의되지 않은 경우 코드도 실행되지 않습니다.

    !! 따라서 모든 것이 일치하려면 최소한 두 개의 컴파일이 필요합니다. !!

따라서 구문은 다음과 \CodeAfterShipoutOfAbsolutePage같습니다.

\CodeAfterShipoutOfAbsolutePage
  {<comma-list of zref-labels that must exist for the code to be carried out>%
    % Here you specify both those zref-labels that are needed for the
    % <expression for computing the absolute page number of the page after 
    % whose shipping-out code shall be carried out> to work out and probably
    % also those zref-labels that are needed for the <code to carry out after
    % the page has been shipped out> to work out.
  }%
  {<expression for computing the absolute page number of the page after 
    whose shipping-out code shall be carried out>}%
  {<code to carry out after the page has been shipped out>%
    % Be aware that you cannot use this for adding visible material
    % or glue to a page. You can use this only for doing abstract actions
    % like calculations or directives like `\thispagestyle{...}`.
  }%

다음은 최소한의 작업 예입니다.
이 예에서는 후크가 shipout/after사용되었습니다. -항목
에 따르면\changesltshipout.dtx해당 후크는 2021년 1월 8일에 추가되었습니다.
따라서 이 예제는 2021년 1월 8일 이전의 LaTeX 릴리스에서는 확실히 작동하지 않지만 이전 LaTeX 릴리스에서는 오류 메시지가 표시되지 않습니다!
이는 사용법이 구현되지 않는다는 의미에서 존재하지 않는 후크에 코드를 할당해도 경고 또는 오류 메시지가 트리거되지 않기 때문입니다. 이 예는 예를 들어 TeX Live 2022를 사용하여 작동합니다. 따라서 다음과 같이 컴파일할 수 있습니다.뒷면Overleaf 메뉴에서 TeX Live 2022가 선택된 경우.

\NeedsTeXFormat{LaTeX2e}[2021/01/08]
% (According to \changes-entry in ltshipout.dtx the hook
%  shipout/after  was added in January 8, 2021.)
\makeatletter
\RequirePackage[abspage]{zref}
\ExplSyntaxOn
%...............................................................................
% Save the  value of abspage-counter to a zref-label:
%...............................................................................
\cs_new_protected:Npn \saveabspage #1 {\zref@labelbyprops{#1}{abspage}}
%...............................................................................
% Obtain the saved abspage-counter-value from zref-label if possible, otherwise
% deliver -1:
%...............................................................................
\cs_new_protected:Npn \getabspage #1 {\zref@extractdefault{#1}{abspage}{-1}}
%...............................................................................
% Map over comma-list #1 denoting zref-labels and execute code #2 in case all of
% them are defined, otherwise execute code #3; this is for doing calculations 
% with zref-labels which can only be done in case all of them are defined:
%...............................................................................
\cs_new:Npn \CheckWhetherAllZlabelsDefined #1 
  {
    \exp:w
      \clist_map_function:nN {#1} \mystuff_checkzlabel:nwnn
      \exp_after:wN\exp_end:\use_i:nn
  }
\cs_new:Npn \mystuff_checkzlabel:nwnn #1#2 \exp_after:wN\exp_end:\use_i:nn #3#4
  {
    \int_compare:nNnTF {\getabspage{#1}}={-1}
      {#2 \exp_after:wN\exp_end:\use_i:nn {#4}}
      {#2 \exp_after:wN\exp_end:\use_i:nn {#3}}{#4}%
  }
%...............................................................................
% Map over comma-list denoting zref-labels and generate warning for each 
% undefined zref-label:
%...............................................................................
\cs_new_protected:Npn \WarnForUndefinedZlabels #1
  {
    \clist_map_function:nN {#1}\zref@refused
  }
%...............................................................................
% Provide code to execute on background-picture-environment of page whose
% absolute page number is to be specified:
%...............................................................................
\cs_new_protected:Npn \CodeAfterShipoutOfAbsolutePage#1#2#3{ 
  % #1 = comma-list of zref-labels that must exist for the code (#3) to be 
  %      carried out.
  % #2 = expression for computing the absolute page number of the page 
  %      after whose shipout the code #3 shall be carried out:
  % #3 = code to carry out after shipping out the specified page
  \AddToHook{shipout/after}{
    \WarnForUndefinedZlabels{#1}
    \int_compare:nNnT {\CheckWhetherAllZlabelsDefined{#1}{#2}{-1}}
                      =
                      {\value{abspage}}
                      {#3}
  }
}
\ExplSyntaxOff
\makeatother



\documentclass{article}
\usepackage{lipsum}
\pagestyle{headings}

\CodeAfterShipoutOfAbsolutePage{Some ABS label}%
                               {\getabspage{Some ABS label}-1}%
                               {\thispagestyle{empty}}%

\begin{document}
\section{Some headings}
\subsection{Some more headings}
\lipsum{1-2}
\begin{figure}
\noindent\rule{\textwidth}{.6\textheight}
\caption{Some figure}\saveabspage{Some ABS label}
\end{figure}
\lipsum{3-18}
\end{document}

여기에 이미지 설명을 입력하세요

(단점은 배송 작업을 완료할 수 있는 페이지가 그 이전에 없기 때문에 첫 번째 페이지를 수정하는 데 이 기능을 사용할 수 없다는 것입니다.)

관련 정보