단일 페이지 번호가 인쇄되는 방식 변경

단일 페이지 번호가 인쇄되는 방식 변경

저는 책 작업을 하고 있는데 문서 텍스트의 표시나 참조에 의존하지 않고 임의의 페이지 번호를 에서 arabic로 변경하고 싶습니다 . alph어디서부터 시작해야 할지 모르겠습니다.이 질문도 비슷해요, 제 생각에는 이러한 솔루션 중 어느 것도 내 문제로 변환할 수 없었습니다.

아래 MWE에서는 본문의 페이지 번호 "3"을 "3"으로 변경하고 다른 페이지 번호는 모두 그대로 두고 싶습니다.

\documentclass{book}
\usepackage[english]{babel}
\usepackage{blindtext}

\begin{document}

\frontmatter
\blinddocument

\mainmatter
\blinddocument

\end{document}

따라서 주요 문제의 최종 페이지 수는 (1, 2, 3, 4)가 됩니다.

업데이트: 내 간단한 예에서는 (어리석게도) 페이지 스타일 지정 방법을 지정하지 않았으며 이로 인해 구현이 좀 더 까다로워졌다는 것을 깨달았습니다. \the...나는 목차를 사용하고 있기 때문에 Henri의 솔루션이 구현하기 더 간단하다는 것을 알았음에도 불구하고 매크로를 변경하지 말라는 Christian의 제안을 계속 진행했습니다 . 내 원래 코드는 다음과 같습니다.

\RequirePackage[markcase=used]{scrlayer-scrpage}
\providepairofpagestyles{mystyle}{%
    \clearpairofpagestyles%
    \automark[chapter]{chapter}
    \ihead{\headmark}
    \ohead[\pagemark]{\pagemark}
}

업데이트됨:

\def\targetpage{3}
\def\pagestring{\numberstringnum{\targetpage}}

\RequirePackage[markcase=used]{scrlayer-scrpage}
\providepairofpagestyles{mystyle}{%
    \clearpairofpagestyles%
    \automark[chapter]{chapter}
    \ihead{\headmark}
    \ohead[\ifnum\value{page}=\targetpage\pagestring\else\thepage\fi]{\ifnum\value{page}=\targetpage\pagestring\else\thepage\fi}
} 

이 작업을 수행하는 더 좋은 방법이 있을 수 있지만 효과가 있는 것 같습니다!

답변1

이는 plain이후에 적용될 페이지 스타일을 가정 \mainmatter하고 페이지 번호가 미리 정의된 번호(예: )와 같은지 확인한 다음 매크로를 3적용합니다 \numberstringnum.

\documentclass{book}
\usepackage[english]{babel}

\usepackage{fmtcount}
\usepackage{fancyhdr}
\usepackage{blindtext}

\def\theliteralpage{3}

\fancypagestyle{plain}{%
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \cfoot{\ifnum\theliteralpage=\value{page}\numberstringnum{\theliteralpage}\else\thepage\fi}
}

\begin{document}
\frontmatter
\blinddocument

\mainmatter
\pagestyle{plain}
\blinddocument

\end{document}

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

답변2

\thepage원하는 형식으로 인쇄하도록 재정의할 수 있습니다 . 이 \mainmatter명령은 재정의 \thepage도 수행하므로 재정의는 그 뒤에 배치해야 합니다.

\documentclass{book}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{fmtcount}
\begin{document}

\frontmatter
\blinddocument

\mainmatter
\renewcommand\thepage{%
  \ifnum\value{page}=3
    \numberstring{page}%
  \else
    \arabic{page}%
  \fi}

\blinddocument

\end{document}

관련 정보