Cham wrote:I just found that adding the following code to the previous MWE adds a vertical text line in the gray band,
actually, there's nothing in that code providing a
\rotatebox
command.
graphicx and rotating packages come to mind.
Cham wrote:
but it's not properly centered inside.
I don't see any
\centering
or similar attempt to actually center anything here.
Cham wrote:
Also, there's a slight offset of the "Document Title".
The reference point for rotating is not at the bottom of the text, more like at the height of letter x. In the code below, I've added `B' for baseline to the origin option(s).
I don't think it wise to have text in the inner margin with different orientation, but that's up to you.
Code: Select all
\documentclass[12pt,letterpaper]{article}
\usepackage[T1]{fontenc}
% Code to add a vertical gray band in the inner margin :
\usepackage{eso-pic}
\usepackage{graphicx}
\definecolor{colorMarge}{RGB}{242,242,245}
\newlength{\distance}
\setlength{\distance}{0.0in} % 0.5in
\newlength{\rulethickness}
\setlength{\rulethickness}{0.5in} % 1pt
\newlength{\ruleheight}
\setlength{\ruleheight}{\paperheight} % Longueur de la ligne
\newlength{\xoffset}
\newlength{\yoffset}
\setlength{\yoffset}{0pt} %{0.5\dimexpr\paperheight-\ruleheight}
\AddToShipoutPicture{%
\setlength\fboxsep{0pt}% no additional frame for \colorbox
\ifodd\value{page}%
\setlength{\xoffset}{\distance}%
\else
\setlength{\xoffset}{\dimexpr\paperwidth-\rulethickness-\distance}%
\fi
\AtPageLowerLeft{%
\put(\LenToUnit{\xoffset},\LenToUnit{\yoffset}){%
\colorbox{colorMarge}{%
\parbox[b][\ruleheight][b]{\rulethickness}{%
\centering
\ifodd\value{page}%
\rotatebox[origin=lB]{90}{\color{gray}{\strut Document Title}}%
\else
\rotatebox[origin=rB]{-90}{\color{gray}{\strut Copyright Notice}}%
\fi
}%
}%
}%
}%
}
\begin{document}
Test
\newpage
Another page
\end{document}
would be an idea.
KR
Rainer