Frase orientada verticalmente nas margens

Frase orientada verticalmente nas margens

Estou escrevendo um documento e gostaria de colocar uma frase orientada verticalmente em todas as margens da página, exceto na página do índice.

meu código é:

\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}

insira a descrição da imagem aqui

Responder1

Você pode colocar um if com o valor da página:

\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}
}

Se desejar você pode definir um contador e configurá-lo para o número da página após a impressão do índice e adicionar este valor para automatizar o processo (pode ser um pouco mais complexo porque o índice é impresso após o segunda compilação.).

Editar:(Uma solução alternativa com as mainmattercoisas)

\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}}

Última edição:

\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}

com o mesmo preâmbulo ... para imprimir o texto vertical na próxima página possivelmente vazia após o toc use assim:

\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}

Responder2

Você também pode definir manualmente um sinalizador para ativar e desativar a sobreposição.

\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}

informação relacionada