Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21d2c89ddcf554f

Jump to content

Template talk:Val

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Val/units)
Latest comment: 10 days ago by A Shortfall Of Gravitas in topic Heat capacity and viscosity

Making this available in other languages

[edit]

Can this template be added to other languages like dutch? I see it is available in English since ages but the editors in dutch wikipedia are still manually formatting every number with sticks and stones (dashes and dots).

The page source seems not the real code, only a reference #invoke:val|main, and copying this does not work. Does the actual code file need to be placed on a wikipedia server somewhere, or how do we get this essential function into Wikipedia more broadly than just English?

The table alignment template is also missing, it has to be manually done for every cell in a table. This template also is not a normal source page but a reference to a .css file that I assume regular users can not place on the server. Maybe an admin who sees this can copy that one over too (or make it usable on all of wikipedia instead of duplicating code). (Update: this part is resolved with the help of ItsNyoty.)

80dot171dot93dot89 (talk) 10:04, 17 February 2026 (UTC)Reply

Volts per metre?

[edit]

Is it possible to add V.m or similar, linking to electric field? I've found it in dust devil.-- Carnby (talk) 13:35, 11 April 2026 (UTC)Reply

The wikitext in the article is {{val|10000|ul=volts per metre|fmt=commas}}. All val is doing to putting a comma in 10000 and adding the text "volts per metre" as a wikilink. Since there is an article with that name, the link is blue. Replace the wikitext with what is wanted, namely: 10,000 [[Electric field|volts per metre]] → 10,000 volts per metre Johnuniq (talk) 04:05, 12 April 2026 (UTC)Reply
I meant to use the SI symbol V‧m in {{val}} linking it to electric field.-- Carnby (talk) 13:11, 13 April 2026 (UTC)Reply
Why not use the wikitext given in my last comment? Replace "volts per metre" with whatever is wanted. It is linking to electric field. The time to think about adding a unit to val is when a dozen articles need the same thing. Johnuniq (talk) 07:23, 14 April 2026 (UTC)Reply
I tried this workaround:
10,000{{sp}}[[Electric field|{{Abbr|V‧m|volts per metre}}]]
yielding
10,000 V‧m
Does it look good?-- Carnby (talk) 10:13, 14 April 2026 (UTC)Reply
Ah, I didn't realize an abbreviation was wanted. It looks good but there are two issues. First, the dot in V‧m is U+2027 Hyphenation Point. Units looking like that normally use U+00B7 Middle Dot. Second, V·m would be read as "volt metre" where the dot indicates multiplication like N·m (Newton-metre). An electric field is V/m (volts per metre). Johnuniq (talk) 11:12, 14 April 2026 (UTC)Reply
 Done-- Carnby (talk) 12:00, 14 April 2026 (UTC)Reply

Ohms and omegas

[edit]

In the realm of electrical resistance, the Greek letter capital omega (Ω) is used, which is inconvenient to type. Can we get some aliases for the relevant units? "Ohm", "ohm", and "Omega" all seem like good options. — LucasBrown 11:08, 8 June 2026 (UTC)Reply

@LucasBrown: I have looked at doing this but am having trouble because it's a very long time since I worked on val and I'm having trouble understanding why obvious unit definitions don't work with SI prefixes that I assume you would want (I can see what's going on but the why is puzzling and I can't see a workaround at the moment). I'll think about it in a few days. Remind me if I forget. Johnuniq (talk) 05:28, 9 June 2026 (UTC)Reply
Done. I added definitions for ohm and some SI prefixes: ohm Gohm Mohm kohm mohm μohm uohm nohm. Examples:
  • {{val|999|u=ohm}}999 Ω
  • {{val|1|u=kohm}}1 
  • {{val|1|ul=uohm}}1 μΩ
Johnuniq (talk) 03:28, 13 June 2026 (UTC)Reply

Heat capacity and viscosity

[edit]

Hello I've been templatizing Chemboxes lately, and Chembox_Thermochemistry could badly use a unit here for Molar heat capacity (the same units are used in a couple of other fields in the chembox).

I propose adding:
J.mol-1.K-1 Molar heat capacity - Jmol-1K-1
J/mol.K Molar heat capacity - J/(molK)
I use the existing kJ.mol-1 unit code on every chemical page I edit, then have to manually correct J.mol-1 to add the K-1 as a postfix right now, which makes the template much uglier than it could be. This ordering is how the CRC Handbook of Chemistry and Physics and most wikipedia pages already use it, but the SI definition is apparently the equivalent J/(Kmol) and that's what the molar heat capacity page lists, so it might be worth adding the additional two that match that (also since J.mol-1 and J.K-1 both exist here already). There are also probably pages on here somewhere that order things like that so it might make converting those to val slightly easier.
J.K-1.mol-1 Molar heat capacity - JK−1mol-1
J/K.mol Molar heat capacity - J/(Kmol)

I don't know if molar heat capacity is the best place to link since it applies to entropy and I think a couple of other less used fields in Chembox_Thermochemistry but it has no specific page for the SI unit like some of the others (and probably won't), and heat capacity defines it more clearly than any other article I could find.

For the division versions, I'm not sure how parens are normally handled in unit codes and I'll end up using the -1 exponent versions pretty much exclusively anyway so do what you will with that info. I'm only requesting them for parity with the multiply-by-inverse versions and the existing similar templates. I don't think kJ variants are needed, the CRC Handbook's table headers don't use anything but the J version.


And also while I'm at it, the SI Dynamic viscosity unit would be useful but is less commonly needed and I don't know how much work this stuff is:
μPa.s Dynamic Viscosity - micropascal-second mPas
mPa.s Dynamic Viscosity - millipascal-second mPas
Pa.s Dynamic Viscosity - pascal-second mPas

The Pascal-second is equivalent to N·s/m2 if that info is useful for some reason. It isn't written that way in tables or data sheets. The CGS equivalent is the centiPoise (cP) which is equal to 1 mPa·s and shows up in US safety data sheets sometimes. I don't think it had an entry when I last tried to use it in ul, but it could link to the Poise (unit) page and would probably want normal / milli / micro / and possible kilo versions as well. I'm not requesting this one though, there's nothing complicated involved in typing it.

Thanks A Shortfall Of Gravitas (talk) 18:45, 18 June 2026 (UTC)Reply

I'll do this in a couple of days, remind me if I forget. I removed the edit request as that is not needed here. A couple of points need clarification first. The above definition for J.mol-1.K-1 displays as
Molar heat capacity - Jmol-1K-1
when linked, or as
Molar heat capacity - Jmol-1K-1
when not linked. Is that really what is wanted? With the name using uppercase "M", and a hyphen dash, and the symbol? No other units are shown like that in val. Similarly, the three proposed viscosity units display with a doubly uppercase name and mPa⋅s as the symbol for each (I assume that's a copy/paste problem and the m needs to be adjusted). And a reminder to myself: need to investigate why Template:Val/list is showing "invalid definition" for four units. Johnuniq (talk) 06:14, 19 June 2026 (UTC)Reply
Apologies for that... the capitalization isn't needed; I spaced out and forgot to remove the name, I think I was intending to just write the name of the page it should link to (if linking was enabled) with the stuff after the dash being the rendition of the output, then looked at the code and figured out the rendition should be the link text, then got tired and forgot what I was doing. It should just be:
J.mol-1.K-1 Jmol-1K-1
J/mol.K J/(molK)
J.K-1.mol-1 JK−1mol-1
J/K.mol J/(Kmol)
Without the target page name / text in the output link or unit, like everything else. Like I said the parenthesized versions aren't really required, I stuck them in as convenience templates. I'm also making the assumption that adding a unit causes little rendering overhead in the module, so if this isn't the case for some reason just the J.mol-1.K-1 and J.K-1.mol-1 versions would be ok.
And you're correct, the mPa⋅s everywhere was a copy-paste error (and the capitalized units should be left out) and those should be:
μPa.s μPas
mPa.s mPas
Pa.s Pas
kPa.s kPas
Hopefully I got all those right this time.
Lower SI prefixes only apply to gases where viscosity isn't generally given / specified in chembox. I threw kPas on there in case someone wants to use it for a non-newtonian fluid since those are more common, though I don't know if I'll ever encounter a chembox for one. Everything higher than that applies to things that aren't usually described in terms of viscosity except on that page (like the Earth's mantle).
I'm remembering to watchlist this this time so I don't disappear for as long. Sorry about that confusion. A Shortfall Of Gravitas (talk) 15:20, 15 July 2026 (UTC)Reply
@A Shortfall Of Gravitas: I added the units illustrated below. Please check—is this correct?
Johnuniq (talk) 04:22, 16 July 2026 (UTC)Reply
Speaking of molar heat capacity, could we have the celsius version as well? i.e. J/mol.C or J/mol.degC J/(mol·°C), whichever is the convention for °C, same for the others one with K°C. Headbomb {t · c · p · b} 04:43, 16 July 2026 (UTC)Reply
Val uses degC for Celsius (C for coulomb). Is this what is wanted?
J.mol-1.degC-1 → Jmol−1°C−1
J/mol.degC → J/(mol°C)
J.degC-1.mol-1 → J°C−1mol−1
J/degC.mol → J/(°Cmol)
Johnuniq (talk) 05:06, 16 July 2026 (UTC)Reply
Yip. Headbomb {t · c · p · b} 05:26, 16 July 2026 (UTC)Reply
I added these. Is this correct?
Johnuniq (talk) 05:50, 16 July 2026 (UTC)Reply
Looks exactly like above? Is there a difference? Headbomb {t · c · p · b} 07:52, 16 July 2026 (UTC)Reply
Those look correct to me, TY very much. I just started using the J.mol-1.K-1 in a chembox. It'll save me a lot of ugly manual formatting. Weirdly I've never seen the degC version in reference material but since the values for them should be the same I'm sure someone has used it at some point. I'm in the US so naturally I use fahrenheit for almost everything outside of science (and some things that do involve science like hotplate temps) but I truly hope there's not some abomination of molar entropy using Joules combined with degF floating around.  :-)
Thanks again. A Shortfall Of Gravitas (talk) 22:07, 16 July 2026 (UTC)Reply

Automatic conversion from confidence interval to +/-uncertainty

[edit]

In medicine and biology a lot of values are given as the 95% confidence interval (or Bayesian HPD interval) instead of the +/-uncertainty. However, the {{val}} notation is often preferable in tight spaces such as the sub-labels of {{clade}}. Currently to format a number such as 42190 (95% HPD: 23554-77587), one would have to subtract both numbers from 42190 to arrive at {{val|35397|17636}}. Using #expr: is possible but still unwieldy to type.

It would be very helpful if Module:Val could accommodate this kind of use case by adding an option that causes it to treat an "asymmetric uncertainty" as an interval to convert into the +/- notation. Or if there is a similarly compact way to notate such an interval with a center value (be it the mean or the peak of the probability density). Artoria2e5 🌉 05:02, 19 June 2026 (UTC)Reply

I'm totally lost. When doing it manually, you have to subtract two numbers from a third number. I can't see what numbers you mean in the above example. Please clarify. I gather you are looking for ideas at the moment but if you have something in mind, it would be helpful if you could list some sample wikitext (hypothetical parameters to val) and what output they would produce. Johnuniq (talk) 06:24, 19 June 2026 (UTC)Reply