I am working on a diplomatic edition of a 15th century book and it numbers its folios using the standard roman numerals of the time. I've been using the following to get the page/folio in my header:
\newcommand{\rectoverso}[1]{\ifthenelse{\isodd{#1}}{r}{v}}
\newcommand{\folio}[1]{\the\numexpr (#1+1)/2\relax}
\uppercase\expandafter{\romannumeral \value{\folio{\thepage}}}\rectoverso{\thepage}
This works great, but the problem is that the roman numeral sequence is off of what I need. Instead of I, II, III, IIII, V, VI, VII, VIII, IX, X, I get the subtractive IV (somewhat understandably, given it's the far more common one in modern usage). My source text only (and always) uses the additive 4 in the one's position: 24 is XXIIII, 34 is XXXIIII but 44 is XLIIII. 9 is universally rendered subtractively as IX or XC.
Is there a package that allows for some control over which numbers are done additively and which are subtractively, or would my best option be to write my own custom definition to account for the specific style used in my book?


IIIIor must all cases ofIVbe eliminated? In other words, isXXIVOK? or should it beXXIIII? I'm asking because I notice that for 9 you've writtenIXwhich seems a bit inconsistent. – A.Ellett Dec 31 '15 at 18:14\thepagein calculations are discouraged, as it may not represent a number in general. – Werner Dec 31 '15 at 18:58\value{page}would retrieve the value (number) of thepagecounter. However, even that is not reliable at times, the page shipout routine (which influences thepagecounter) is asynchronous. The best option is to set a\label{<something>}and then userefcount's\getpagerefnumber{<something>}. References are guaranteed to produce the correct page number, and\getpagerefnumberis expandable (so can be used in calculations). – Werner Jan 01 '16 at 23:07