I want to set a decorated page number packing in the the Tikz node with the use of \AtBeginShipout
macro, but when a lstlisting
environment with basicstyle
option seting font to \ttfamily
breaks between pages some of font features of the page number has no proper effect; in my example it's bold!
The following code shows the problem, and it'll be produced with both pdflatex
and xelatex
.
\documentclass{article}
\usepackage{atbegshi}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{listings}
\AtBeginShipout{\AtBeginShipoutAddToBox{%
\begin{tikzpicture}[remember picture, overlay,]
\node [draw, circle, color=gray, yshift=2cm] at (current page.south){\textbf{\LARGE\thepage}};
\end{tikzpicture}%
}}
\pagestyle{empty}
\lstset{ basicstyle=\color{black}\ttfamily\small,
frameround=tftf, frame=ltbr,}
\begin{document}
\lipsum[1-4]
\begin{lstlisting}
print ('hello worlds')
print ('hello worlds')
print ('hello worlds')
print ('hello worlds')
print ('hello worlds')
print ('hello worlds')
\end{lstlisting}
\lipsum
\end{document}
The first page number isn't bold:
while the second one is OK (has bold face).