여백에 수직 방향의 문장

여백에 수직 방향의 문장

문서를 작성 중인데 목차 페이지를 제외한 모든 페이지 여백에 세로 방향의 문장을 넣고 싶습니다.

내 코드는 다음과 같습니다

\documentclass[12pt,a4paper,twoside,openright]{book}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{eso-pic}

\makeatletter
\newlength\@tempdim@x
\newlength\@tempdim@y
% structure des commandes :
%   #1 = deplacement selon x
%   #2 = deplacement selon y
%   #3 = texte à mettre
\newcommand\AtUpperLeftCorner[3]{%
\begingroup
\@tempdim@x=0cm
\@tempdim@y=\paperheight
\advance\@tempdim@x#1
\advance\@tempdim@y-#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtUpperRightCorner[3]{%
\begingroup
\@tempdim@x=\paperwidth
\@tempdim@y=\paperheight
\advance\@tempdim@x-#1
\advance\@tempdim@y-#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtLowerLeftCorner[3]{%
\begingroup
\@tempdim@x=0cm
\@tempdim@y=0cm
\advance\@tempdim@x#1
\advance\@tempdim@y#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtLowerRightCorner[3]{%
\begingroup
\@tempdim@x=\paperwidth
\@tempdim@y=0cm
\advance\@tempdim@x-#1
\advance\@tempdim@y#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}

\AddToShipoutPicture{%
    \AtLowerRightCorner{2cm}{5cm}{\ifodd\c@page\ifnum\arabic{page}>1 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
    \AtLowerLeftCorner{2cm}{5cm}{\ifodd\c@page\else\ifnum\arabic{page}>1 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
}
\makeatother

\pagenumbering{roman}
\begin{document}
    {\pagestyle{plain}
    \tableofcontents}

\chapter{Chapter one}
\pagenumbering{arabic}
\section{one}
\lipsum[2]
\section{two}
\lipsum[4]
\section{three}
\lipsum[11]
\chapter{Chapter two}
\section{four}
\lipsum[1]

\end{document}

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

답변1

페이지 값과 함께 if를 배치할 수 있습니다.

\AddToShipoutPicture{%
\AtLowerRightCorner{2cm}{5cm}{\ifodd\c@page\ifnum\value{page}>1 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
\AtLowerLeftCorner{2cm}{5cm}{\ifodd\c@page\else\ifnum\value{page}>1 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
}

원하는 경우 카운터를 정의하고 목차가 인쇄된 후 페이지 번호로 설정하고 이 값을 추가하여 프로세스를 자동화할 수 있습니다. 두 번째 편집.).

편집하다:(물건에 대한 해결 방법 mainmatter)

\newcounter{realpage}

\AddToShipoutPicture{%
\AtLowerRightCorner{2cm}{5cm}{\ifodd\c@page\ifnum\value{realpage}>0 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
\AtLowerLeftCorner{2cm}{5cm}{\ifodd\c@page\else\ifnum\value{realpage}>0 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
} 

\let\oldmainmatter\mainmatter
\def\mainmatter{\oldmainmatter\stepcounter{realpage}}

마지막 편집:

\documentclass[12pt,a4paper,twoside,openright]{book}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{eso-pic}

\makeatletter
\newlength\@tempdim@x
\newlength\@tempdim@y
% structure des commandes :
%   #1 = deplacement selon x
%   #2 = deplacement selon y
%   #3 = texte à mettre
\newcommand\AtUpperLeftCorner[3]{%
\begingroup
\@tempdim@x=0cm
\@tempdim@y=\paperheight
\advance\@tempdim@x#1
\advance\@tempdim@y-#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtUpperRightCorner[3]{%
\begingroup
\@tempdim@x=\paperwidth
\@tempdim@y=\paperheight
\advance\@tempdim@x-#1
\advance\@tempdim@y-#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtLowerLeftCorner[3]{%
\begingroup
\@tempdim@x=0cm
\@tempdim@y=0cm
\advance\@tempdim@x#1
\advance\@tempdim@y#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtLowerRightCorner[3]{%
\begingroup
\@tempdim@x=\paperwidth
\@tempdim@y=0cm
\advance\@tempdim@x-#1
\advance\@tempdim@y#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}

\newcounter{realpage}

\AddToShipoutPicture{%
\AtLowerRightCorner{2cm}{5cm}{\ifodd\c@page\ifnum\value{realpage}>0 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
\AtLowerLeftCorner{2cm}{5cm}{\ifodd\c@page\else\ifnum\value{realpage}>0 \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
} 
\makeatother

\pagenumbering{roman}
\begin{document}
    {\pagestyle{plain}
    \tableofcontents}



\chapter{Chapter one}
\stepcounter{realpage}
\pagenumbering{arabic}
\section{one}
\lipsum[2]
\section{two}
\lipsum[4]
\section{three}
\lipsum[11]
\chapter{Chapter two}
\section{four}
\lipsum[1]

\end{document}

동일한 서문을 사용하여 ... 다음과 같이 toc 사용 후 다가오는 빈 페이지에 세로 텍스트를 인쇄하려면 다음을 수행하십시오.

\begin{document}
    {\pagestyle{plain}
    \tableofcontents}
    \clearpage
    \stepcounter{realpage}

\chapter{Chapter one}

\pagenumbering{arabic}
\section{one}
\lipsum[2]
\section{two}
\lipsum[4]
\section{three}
\lipsum[11]
\chapter{Chapter two}
\section{four}
\lipsum[1]

\end{document}

답변2

오버레이를 켜거나 끄는 플래그를 수동으로 설정할 수도 있습니다.

\documentclass[12pt,a4paper,twoside,openright]{book}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{eso-pic}

\makeatletter
\newlength\@tempdim@x
\newlength\@tempdim@y
% structure des commandes :
%   #1 = deplacement selon x
%   #2 = deplacement selon y
%   #3 = texte à mettre
\newcommand\AtUpperLeftCorner[3]{%
\begingroup
\@tempdim@x=0cm
\@tempdim@y=\paperheight
\advance\@tempdim@x#1
\advance\@tempdim@y-#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtUpperRightCorner[3]{%
\begingroup
\@tempdim@x=\paperwidth
\@tempdim@y=\paperheight
\advance\@tempdim@x-#1
\advance\@tempdim@y-#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtLowerLeftCorner[3]{%
\begingroup
\@tempdim@x=0cm
\@tempdim@y=0cm
\advance\@tempdim@x#1
\advance\@tempdim@y#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}
\newcommand\AtLowerRightCorner[3]{%
\begingroup
\@tempdim@x=\paperwidth
\@tempdim@y=0cm
\advance\@tempdim@x-#1
\advance\@tempdim@y#2
\put(\LenToUnit{\@tempdim@x},\LenToUnit{\@tempdim@y}){#3}%
\endgroup
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start edit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\iftoc 

\AddToShipoutPicture{%
    \AtLowerRightCorner{2cm}{5cm}{\ifodd\c@page\iftoc\else \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
    \AtLowerLeftCorner{2cm}{5cm}{\ifodd\c@page\else\iftoc\else \rotatebox{90}{Good \raisebox{0.1ex}{--} My book}\fi\fi}
}
\makeatother

\pagenumbering{roman}
\begin{document}
    {\pagestyle{plain}
    \global\toctrue% or place outside braces
    \tableofcontents}

\chapter{Chapter one}\tocfalse
\pagenumbering{arabic}
\section{one}
\lipsum[2]
\section{two}
\lipsum[4]
\section{three}
\lipsum[11]
\chapter{Chapter two}
\section{four}
\lipsum[1]

\end{document}

관련 정보