# Page number in outer margin affects vertical ruler

I adapted the idea from here to place the page numbers in the outer margin. However, by doing so, the vertical ruler disappears. I first thought that adjusting the horizontal spacing parameters for the ruler might bring it back, but it doesn't seem so. How can this be fixed?

\documentclass{scrartcl}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[american]{babel}
\usepackage{scrpage2}
\usepackage{vruler}

% comment this paragraph out and see that the ruler appears again
\rofoot{foo\ \ \textbullet\,\ bar\pageno{o}}% right odd
\lefoot{\pageno{e}Foo\ Bar}% left even
\def\pageno#1{\leavevmode
\vbox to 0pt{
\vss
\hbox to 0pt{%
\if#1o\kern 2em\else\hss\fi\thepage
\if#1o\hss\else\kern2em\fi}}}

\begin{document}
\setvruler[10pt][1][1][4][1][10pt][10pt][-24pt][\textheight]%
Foo Bar
\clearpage
Foo Bar
\end{document}

-

Quite subtle. :)

The vruler package distinguishes between LaTeX and Plain TeX by looking whether the \pageno macro is defined. So with that code it guesses wrongly that the document is a Plain TeX one.

Change \pageno into \xpageno or whatever.

Here's the relevant part from vruler.sty

141 \ifx\pageno\undefined % this is considered as LaTeX
142     % we assume all LaTeX versions have \@outputpage in the form of
143     % \@outputpage= ...\vbox{ ... \vbox{...}...}... , where 2nd \vbox
144     % contains the true content.

-
Many thanks, that's indeed quite subtle :-) –  Marius Hofert Nov 27 '12 at 0:59