I've recently read about a middle age variation on roman numerals where the last "i" character is replaced by a "j". I was thinking about writing my own \roman and \Roman variations, but hit a stone wall... does anyone have any idea how one may go about doing something like this? Thanks in advance!

PS: I'd like to change a final "v" to a "y" while we're at it ;)

edit: clarifying the issue, I'd only like to replace the last "i" and "v" in a roman numeral for "j" and "y" respectively. I'm not interested (at the moment at least :P) in every other middle age variation.

  • Are you going use it also for counters and calculations or just for typesetting? – Yiannis Lazarides Oct 19 '11 at 13:45
  • Hmm... on the one hand, i'd like it to behave like \roman and \Roman (ie. accepting a counter as an argument and producing the typeset numerals); on the other hand, it would be nice to have a \MiddleAgeRoman sort of thing that would get a number and typeset it accordingly. – mpr Oct 19 '11 at 13:53
  • It is possible, but not easy, especially as the wikipedia article is partially incomplete. The approach is to rather use your own macro, i.e., \MiddleAgeRoman I cannot see it possible hacking \roman or \Roman but I can be wrong. I have posted some code at pastebin.com/caS5mAnR, if you modify the table to typest the middle age variation, either me or someone would be able to post the code. – Yiannis Lazarides Oct 19 '11 at 14:07
  • I've created a revision at link. It looks admittedly bad in uppercase, it should lok better in lowercase ;) – mpr Oct 19 '11 at 14:19
  • If you want only the last i to be changed to j it will be easier to do. Is that the only change? It doesn't appear to be so from wikipedia. – Yiannis Lazarides Oct 19 '11 at 14:28

Here is a start,

    \ifcase#1 zero not allowed
    \or i\or ij\or iij\or iv\or v \or vi 
    \or vij \or viij \or ix\or x 
    \else Not available for #1\fi\relax}


Will have a look at the revised link and try and get some more code later.

Also check out the package http://www.ctan.org/tex-archive/macros/latex/contrib/modroman, it appears to be able to do what you want.

  • This works great! (the "custom command" part) I just don't see how I can extend it to accommodate for arbitrary roman numerals... On the other hand, will this work \pagenumbering{MiddleAgeRoman}? – mpr Oct 19 '11 at 14:45
  • @mpr No it will not work for sectioning commands, if you after that look at ctan.org/tex-archive/macros/latex/contrib/romannum – Yiannis Lazarides Oct 19 '11 at 14:47
    \errmessage{Invalid number}%
  \expandafter\if\string i#1%




We read two tokens from the expansion of \romannumeral#1\relax; if the second is \relax, then we are at the end; so we have to decide if the last token of the Roman numeral is i; if it is, we print j, otherwise the character.

Using this for representing counters in LaTeX

Add to the code above also

\def\MAroman#1{\expandafter\@MAroman\csname c@#1\endcsname}



will work as expected.

Different version

The following version will print "i", "ij", "iij", "iv", "v", "vi", "vij" and so on (a final "i" becomes "j" only if preceded by "i").

    \expandafter\@middle@ge\romannumeral#1\expandafter @\expandafter @%
    \errmessage{Invalid number}%
  \expandafter\if\string i#2%
    \expandafter\if\string i#1%
  • Nice way to catch the last letter of the argument, I was going to try it out with a loop and @cdr. Me thinks though that this is not the only difference in Middle Age Roman, one will have to build a more complicated algo to get other alphabet letters in. – Yiannis Lazarides Oct 19 '11 at 15:05
  • This works like a charm for the whole range of values! Alas, I can't still use it for page numbering (is that what you meant by "not expandable"?)... – mpr Oct 19 '11 at 15:09
  • @mpr The first version was not expandable; the present one is and I've added the code for representing counters with it. Of course it's not perfect, as 1 is represented as j. – egreg Oct 19 '11 at 15:26
  • @egreg Sorry, but I can't seem to get it to work with page numbers... using \pagenumbering{MAroman} still displays the "normal" roman numerals. One being represented as "j" is ok as far as I can tell :) – mpr Oct 19 '11 at 16:25
  • 1
    @mpr Where are you putting \pagenumbering{MAroman}? If before \frontmatter it won't work. – egreg Oct 19 '11 at 19:45

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.