4

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.

5

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.)

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

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

\usepackage{romanbarpagenumber}
% And after \begin{document}
\pagenumbering{Roman}
| improve this answer | |
0

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}}{%
    %\renewcommand*{\pagemark}{\Roman@bar{\Roman{page}}}% not added by \pageref.
    \renewcommand*{\thepage}{\Roman@bar{\Roman{page}}}%
  }{
    %\renewcommand*{\pagemark}{\thepage}%
  }
}

Edit: After all redefining \thepage seams to be the best way because it is also used by \pageref. Thanks again Heiko Oberdiek.

| improve this answer | |
  • \Roman@bar will not be added for Roman page numbers referenced via \pageref. – Heiko Oberdiek Jun 23 '13 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.