# Pagenumbering with romanbar compatible to hyperref

Is there a good way to use the package romanbar also for page numbering, with compatibility to hyperref?

The following example works without hyperref but not with it.

\documentclass[12pt,a4paper,ngerman]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{romanbar,hyperref}

\begin{document}
\makeatletter
\renewcommand*{\thepage}{\Roman@bar{\Roman{page}}}%
\makeatother
\jobname

\end{document}


It would even better to activate this with \pagenumbering{Roman}.

This is just an example. I know that changing \thepage in that way is probably not a good idea.

Page labels are only text strings, thus additional bars of package romanbar are not supported. but they can easily be disabled:

\usepackage{romanbar,hyperref}
\pdfstringdefDisableCommands{\let\Roman@bar\@firstofone}


(Instead of \@firstofone also \@empty or \relax can be used.)

• Good to know that there is a macro like \pdfstringdefDisableCommands – ypid Jun 23 '13 at 12:01

I simplified the usage by converting answer 1 into a LaTeX package. See romanbarpagenumber on CTAN.

\usepackage{romanbarpagenumber}
% And after \begin{document}
\pagenumbering{Roman}


Thanks. I just found out that I can also redefined \pagemark which is a bit more elegant.

I use this to set \pagemark when ever the \pagenumbering is expanded.

\let\pagenumberingRaw\pagenumbering\relax%
\renewcommand{\pagenumbering}[1]{%
\pagenumberingRaw{#1}%
\ifthenelse{\equal{#1}{Roman}}{%

Edit: After all redefining \thepage seams to be the best way because it is also used by \pageref. Thanks again Heiko Oberdiek.
• \Roman@bar will not be added for Roman page numbers referenced via \pageref. – Heiko Oberdiek Jun 23 '13 at 12:29