Template talk:Roman

Documentation
This template converts Arabic numerals (that is, 1, 2, 3, etc) into Roman numerals (I, II, III etc). It currently works for any whole number between 1 and 4999999. To use it, enter, replacing "YOURNUMBER" with a number.

For example, returns MMVI. Warofdreams talk 22:51, 28 May 2006 (UTC)

With the addition of numbers over 5000 with the macron (here done with tpl:Overline), the current version keeps the macron characters separate from the non-macron characters, and thus uses MMMM rather than M$\overline{V}$ for 4000. This may be a matter of taste, or it may be something that needs fixing. Dpv 13:00, 11 June 2006 (UTC)

Font-family
I've added a "font" param to the template to allow the serif font to be turned off. It still defaults to "serif", but passing "inherit" will cause it to appear in the same font as the containing text. Mike Dillon 15:24, 3 December 2006 (UTC)
 * I really needed this to be the default font for what I'm doing. It does look good with serif though. Is there a way to default it to whatever the default is, but give the option of serif? (The opposite of now?) → &ensp; J A R E D &ensp;(t)&ensp; 15:38, 3 December 2006 (UTC)


 * I've just reverted the removal of the font span. Please discuss changes that affect the appearance of templates in widespread use. I may ask to have this template protected because it is in every "year" article (e.g. 2006). Mike Dillon 15:41, 3 December 2006 (UTC)


 * I don't think changing the default of something already in use in hundreds of articles is reasonable. You can use "font=inherit" for your specific purposes. Mike Dillon 15:42, 3 December 2006 (UTC)

The funny thing is that this was just changed to serif two weeks ago (without discussion). So your suggestion to change it back and have serif an override may be a good one. Mike Dillon 16:39, 3 December 2006 (UTC)

It looks like nearly all of the uses of this template are done through Year in other calendars. It seems like this template should not have a font-family or a  and should be a purely functional conversion template. The Year in other calendars template is the appropriate place to do font styling, it would seem. Mike Dillon 17:20, 3 December 2006 (UTC)


 * I've removed the font styling from this template and moved it up to Year in other calendars to keep this as a purely functional template. I'm going to contact User:AzaToth (the user who added it) to say that I've removed the font styling. Mike Dillon 17:27, 3 December 2006 (UTC)


 * So I was right all along... haha. → &ensp; J A R E D &ensp;(t)&ensp; 17:32, 3 December 2006 (UTC)


 * It would seem so. Let's hope everyone else agrees ;) Mike Dillon 17:38, 3 December 2006 (UTC)

Protection
I've requested that this page be fully protected because it is esoteric and in widespread use. See Requests for page protection. Mike Dillon 15:47, 3 December 2006 (UTC)
 * I appologize if I've brought on this request. I didn't realize how widespread it was. → &ensp; J A R E D &ensp;(t)&ensp; 16:24, 3 December 2006 (UTC)
 * No need to apologize. Protection of widespread templates is not a bad thing. It just means we have to discuss changes before making them. Mike Dillon 16:31, 3 December 2006 (UTC)

The request was not accepted. The template is only used in about 2,000-2,500 articles at the moment, so there isn't much need anyways. Mike Dillon 23:40, 3 December 2006 (UTC)

Edit request
editprotected Please update with. Per Template documentation/List Thankyou. -- ṃ• α• Ł• ṭ• ʰ• Ə• Щ•   @  05:57, 28 April 2008 (UTC)
 * Done. – Luna Santin  (talk) 08:34, 28 April 2008 (UTC)

Extended template
See User:Stelio/Roman for an extended version of this template. That alternative version has the following differences to the current version here (as at 13 March 2009):
 * The alternative version includes handling for fractional values with a precision of 1/1728 (following the rules in Roman numerals).
 * The alternative version avoids the use of 'div' and 'mod' in the mathematical expressions, since their algorithms currently differ from the standard algorithms (see 6068), and their calculation algorithm may therefore potentially be altered in the future.
 * The alternative version renders 4000 as '$\overline{IV}$' as per Roman numerals, as opposed to 'MMMM' as this template currently does.
 * The alternative version handles errors through more detailed messages, rather than returning 'N/A' (and the option to override the error message is still there). A negative argument is treated as an error.
 * The current version produces erroneous results if the argument passed to it is a calculation. For example  currently returns 'MCXII' rather than 'II'. This can be fixed by wrapping all references to the argument in brackets (so using '' rather than ''); the alternative version includes this fix.

-Stelio (talk) 16:35, 13 March 2009 (UTC)
 * Make it official, this template deserves a jubilation.--Neurorebel (talk) 01:37, 12 June 2017 (UTC)

Subst
I made the template substable - but only the first tranch of numbers. Big numbers will require Roman/2 sorting out. Rich Farmbrough, 23:42, 18 May 2011 (UTC).

According to mw:Help:Extension:ParserFunctions parser function can handle numbers between 1 and 3000. Using this might simplify the template. For example gives  and  gives. --Jarekt (talk) 16:05, 7 September 2011 (UTC)

Edit request on 18 December 2012
please update using the current version in the sandbox. a recent change to the "mod" function in the backend software has made this template generate incorrect results. you can clearly see the problem in the testcases. Frietjes (talk) 19:57, 18 December 2012 (UTC)


 * Yes check.svg Done -- Red rose64 (talk) 20:14, 18 December 2012 (UTC)

Template-protected edit request on 23 April 2016
FYI, I am able to complete these edits myself (Module:Roman is not template-protected). But I wanted to alert template/module folks to take a look at the code and sign-off before I port it.

Changes needed to be made
 * 1) (Nothing at Template:Roman)
 * 2) Copy Module:Roman/sandbox code to Module:Roman.
 * 3) Update the documentation for Roman. Basically, add yes support, mention symbols listed at User:Stelio/Roman.
 * 4) Update the documentation for the Lua if necessary to include some implementation details.

Differences between the live version and the sandbox version (observe Template:Roman/testcases)
 * Sandbox supports 0. Displays as 'N'.
 * Live/sandbox differ on large Romans. (see 4999, 49999, etc) 69105 is LXIX CV in the sandbox version, which mirrors Stelio's version. Live version displays LXV MMMMCV instead.
 * Different due to new tokens IX and IV being 9000 and 4000 respectively.


 * Sandbox handles decimal, fractional, and arithmetic expressions to a precision of 1/1728 (like Stelio's version).
 * Stelio's version seems incorrect on 0.3333, 0.00347222, 0.9999, 0.41666, 9999/1000, 4999999+1727/1728, etc. In all of these cases, sandbox is either closer to the value, or a simple error/failure to numeralize by Stelio's version. 0.9999 should output like the sandbox does. I don't know why Stelio's version leaves out the little 1/1728 ticks.

How sandbox ensures correct fractional output on tricky cases (0.00001 and 99.99999)
 * 1) Find the Roman numerals for the integer part of the number.
 * 2) If the number is not an integer:
 * 3) * Add half of the smallest unit (1/1728) to simulate rounding instead of truncation.
 * 4) * Ensure this new result is between 1/1728 and 1727/1728. (actually 1.1/1728 and 1727.1/1728 due to floating point rounding issues)
 * 5) Hence, 0.00001 is guaranteed to have at least the smallest unit symbol (instead of being blank or 0), and 99.99999 does not display as 100 or 99 and 2 halves.

Validation
 * Template:Roman/testcases (permalink). Updated with decimal/fraction/arithmetic cases
 * Module:Roman/testcases - can't figure out fractional/decimal tests
 * Module talk:Roman/testcases - all passing
 * Non-numerical input to Roman/sandbox leaves blank (like the live version)
 * The sandbox template supports subst: and safesubst:.

Please let me know if you have any questions. Thanks.

&mdash; Andy W. (talk · contrib)  19:51, 23 April 2016 (UTC)
 * "The negative number -3299 cannot be converted to Roman numerals" - might it be clearer to say "Negative numbers (such as -3299) cannot be converted to Roman numerals".  I.E. make it clear that the negative numbers are out, not just this one or some of them.
 * All the best: Rich Farmbrough, 20:07, 23 April 2016 (UTC).


 * Were you referring to Stelio's template (which I'm not editing) or the changes I made? Currently, the sandbox version I refer to has no negative message. I could add it if deemed appropriate. &mdash; Andy W. (talk · contrib)  20:10, 23 April 2016 (UTC)
 * Ah, I see. Well I think it appropriate... what do you think?  All the best: Rich Farmbrough, 20:27, 23 April 2016 (UTC).


 * Thanks, this would be something like "if negative then" error("cannot convert negative") or something. or anyone else, is an error message appropriate for how the template is currently being used? Interested in a second opinion. &mdash; Andy W. (talk · contrib)  20:47, 23 April 2016 (UTC)

As of now, I'm feeling very confident about simply porting the changes myself, including updating documentation. I'm expecting to make the changes around the end of the month if I hear no reply. If anyone has any comments before the end of this week, let me know. &mdash; Andy W. (talk · contrib)  03:18, 25 April 2016 (UTC)
 * Disabled request as you are not actually requesting a change. It seems to me that you are careful and conscientious enough just to make the change and follow-up with any issues. Regards &mdash; Martin (MSGJ · talk) 08:21, 25 April 2016 (UTC)
 * Thanks, it's done. &mdash; Andy W. (talk · contrib)  08:45, 25 April 2016 (UTC)
 * Thanks for the heads up. (Oh also: good point on the wording of the error message, Rich; I've made that change to my own version even though it won't now be used.) -Stelio (talk) 12:18, 25 April 2016 (UTC)


 * I reverted by . It was causing a big red error message at e.g. 2016: Lua error in Module:Roman at line 119: attempt to call method 'callParserFunction' (a nil value). Clicking that message gives a box headed "Script error" containing:   and I have no idea how to fix it. -- Red rose64 (talk) 20:27, 25 April 2016 (UTC)


 * Addressing this issue now... Thanks for the notice... on first glance, this might have something to do with the parser function . I have no idea how to fix this myself at the moment. I've restored much of the code but commented out the line that calls the parser function. &mdash; Andy W. (talk · contrib)  20:56, 25 April 2016 (UTC)
 * Issue is fixed. Special:Diff/717026907/717124504. We're using a safer  (similar to the edit request made to Module math here) and everything seems to be okay now. &mdash; Andy W. (talk · contrib)  21:33, 25 April 2016 (UTC)
 * -- Red rose64 (talk) 22:41, 25 April 2016 (UTC)

Good work! All the best: Rich Farmbrough, 23:57, 4 May 2016 (UTC).

Negative Numbers

 * Handle negative with an "m" example: -1521=mMDXXI
 * before the - sign existed an m was used. — Preceding unsigned comment added by Neurorebel (talk • contribs) 01:47, 12 June 2017 (UTC)

For discussion: Neurorebel is suggesting that the template should be extended to allow for negative numbers. And that the way to do this is by using an "m" prefix. Some more commentary here. -Stelio (talk) 12:30, 16 June 2017 (UTC)
 * I would support this. All the best: Rich Farmbrough, 11:07, 28 July 2017 (UTC).


 * This could affect things if my edit is picked up—things would potentially be unclear if 'mdccc' is taken as input—would need to check case of input if all lowercase then must ignore and not take 'm' as negative sign? Trivial to work around but should likely specify behavior in doc –ASiplas (talk) 09:38, 20 February 2018 (UTC)

Roman → Arabic
See Module:ConvertNumeric's roman_to_numeral


 * Pictogram voting question.svg Question: would it not be more intuitive to create a different template to do the conversion the other way round? &mdash; Martin (MSGJ · talk) 20:51, 20 February 2018 (UTC).
 * First intuition was Arabic as template for new module but that was taken… Ideas on something just as apt? Seemed logical second choice to add to Roman at that point. Would be happy to rewrite some more efficient code under a new name; main focus is driving use to help minimize transcription errors and best name is part of that whether that's Roman or not. –ASiplas (talk) 21:30, 20 February 2018 (UTC)
 * this I see is duplicate of Module:ConvertNumeric going to Revert Module:Roman/sandbox and Module:Roman/doc –ASiplas (talk) 21:57, 20 February 2018 (UTC)

Feature request: hovertext with arabic numerals
I think the title is pretty self-explanatory, and this could be implemented as a flag, e.g. would display as , which would be functionally equivalent to  .-Ich (talk) 07:54, 13 August 2018 (UTC)

Edit request
The ƻ is wrong in the fractions, albeit for a decent reason: There's a system of reversing characters in place, but the most correct character, 𐆔 has basically no support. But we can do far, far better in a very simple way: We should replace ƻ with Ƨ

a.k.a. &lt;s>Ƨ&lt;/s> by simple search-replace substitution. I'll admit, I'm not good with modern lua-y templates, so can't say where the thing is. Adam Cuerden (talk) 23:23, 2 November 2018 (UTC)
 * This is on line 80 of Module:Roman. — xaosflux  Talk 16:00, 3 November 2018 (UTC)


 * 1/144 --> <-- updated value. —  xaosflux  Talk 16:05, 3 November 2018 (UTC)


 * ✅ see above, should this cause any issues anyone should feel free to revert and reopen this. —  xaosflux  Talk 16:06, 3 November 2018 (UTC)
 * Thank you! Adam Cuerden (talk) 17:42, 10 November 2018 (UTC)

Edit request
According to the article Roman numerals, ancient Romans used Є· for 1/8. Can this particular numeral be added?

—Yours sincerely, Soumyabrata 17:55, 12 July 2019 (UTC)