Template talk:Convert/Archive April 2016

Single maintenance category

Per Johnuniq observation here, I propose/support the improvement to have a single maintenance category for the module. See Category:Convert error categories. -DePiep (talk) 21:11, 30 March 2016 (UTC)

We currently use categories "Convert invalid options" and "Convert invalid units", and as previously mentioned I like simple names, so how about one category to replace them called "Convert errors"? Some people may like "Pages with errors in the convert template", but omitting redundant words and having the category name start with "Convert" seems better to me. Johnuniq (talk) 03:44, 31 March 2016 (UTC)
"Category:Convert errors" looks great, and for these reasons. But an other name could be fine too. No big issue imo. -DePiep (talk) 07:37, 5 April 2016 (UTC)
OK, I've added a note to do that when the next release occurs. Johnuniq (talk) 11:36, 5 April 2016 (UTC)

Perhaps re-add option adj=split

Now that Module:Convert is being updated again, perhaps it is time to re-add option "adj=split" from September 2013, as in:

  • {{convert/old |8|and|10|ft|adj=split}}
  • {{convert/old |2|or|3|m|adj=split}}

Back in September 2013, I ran Google Searches and found slightly more split "3- and 4-foot" examples, more frequent than "3-and-4-foot" format, although both styles were used in many webpages, almost 50-50% usage. -Wikid77 (talk) 23:49, 15 March 2016 (UTC)

I don't recall adj=split but will have a look. The following table shows fixed output from Special:ExpandTemplates for three examples. The second column is all convert can currently do (adj=on), while if adj=split were available, the resulting output would be as shown in the third column.
Convert {{convert|...|adj=on}} {{convert/old|...|adj=split}}
{{convert|8|to|10|ft|adj=on}} 8-to-10-foot (2.4 to 3.0 m) 8- to 10-foot (2.4 to 3.0 m)
{{convert|8|and|10|ft|adj=on}} 8-and-10-foot (2.4 and 3.0 m) 8- and 10-foot (2.4 and 3.0 m)
{{convert|2|or|3|m|adj=on}} 2-or-3-metre (6 ft 7 in or 9 ft 10 in) 2- or 3-metre (6 ft 7 in or 9 ft 10 in)
Any thoughts? I would want to see a few examples in articles and maybe ask for opinions at WP:MOS talk. Johnuniq (talk) 01:33, 16 March 2016 (UTC)
During the prior years, someone maybe removed all uses of "adj=split" but the user who requested this split style of hyphens, back in 2013, is still active, LlywelynII (talk · contribs), and I had replied how both forms (with prior "8-to-10") are widely used in other webpages. -Wikid77 (talk) 08:19, 16 March 2016 (UTC)
Well, I'm not going to touch the script of a template this complex myself but of course you should have the functionality for it. — LlywelynII 15:30, 16 March 2016 (UTC)
I'd call this a very bad idea. Sorry Wikid. We don't need such a thing as adj=split. Either "3- and 4-foot" or "3-and-4-foot" is grammatically correct. Which one is it? That is, unless they mean subtly different thing or it's a dialect issue, but i doubt that either are the case. So, probably I got it wrong and it should be "3- and 4-foot" not "3-and-4-foot"; I think LlywelynII is correct here; sorry about that. Just fix it. If need be, sure, bring it up at WT:MOS, but I don't see why we'd need both. Jimp 12:08, 22 March 2016 (UTC)
As I understand it: Jimp says both versions are grammatically correct; there is no need to supply both options; if the spaced version is considered better then change the single=default template behaviour for |adj=on into that one; but no need to add an other option. Sounds complete to me. -DePiep (talk) 13:28, 5 April 2016 (UTC)

Area

Are there preferred pairings of units? The examples given are hectares to acres e.g.: 1 hectare (2.5 acres) and square miles to square kilometres e.g.: 1 square mile (2.6 km2), etc. No examples are given of 2,500 hectares (9.7 sq mi) or 2,500 acres (10 km2), etc. Does this suggest that the preferred pairings are the former? Converting acres to square kilometres (or hectares to square miles), and vice versa, seems odd to me. But I can find no advice at WP:MOSNUM. Thanks. Martinevans123 (talk) 20:16, 4 April 2016 (UTC)

Convert has a default output unit for each input unit, so unless there is a specific requirement, the best procedure is to omit the output unit and let convert deal with it. Examples:
  • {{convert|1|ha}} → 1 hectare (2.5 acres)
  • {{convert|1|sqmi}} → 1 square mile (2.6 km2)
  • {{convert|2500|ha}} → 2,500 hectares (6,200 acres)
  • {{convert|2500|acre}} → 2,500 acres (1,000 ha)
However, if adj=mid is used, it is necessary to include an empty output unit:
  • A {{convert|120|ft|adj=mid|-long}} bridge → A 120-foot ([convert: unknown unit]) bridge
  • A {{convert|120|ft||adj=mid|-long}} bridge → A 120-foot-long (37 m) bridge
The error in the first of those is because "-long" is passed to convert as if it were the output unit, which can be seen by holding the mouse above the error message to see the pop-up. Johnuniq (talk) 22:39, 4 April 2016 (UTC)
Many thanks for the refresher. I think years of seeing "the default" in these cases has suggested to me that these are indeed to be usually "preferred". I just don't see any advice as to when the non-defaults would be better? Martinevans123 (talk) 22:43, 4 April 2016 (UTC)
You'd have to take that to the talk at WP:MOS. The convert macro does something that is probably useful in many cases, but it's not a style guideline, which is what you're talking about.GliderMaven (talk) 23:01, 4 April 2016 (UTC)
re Martinevans123 "advice as to when the non-defaults would be better?" -- well, that option is in there to cover exceptions of sorts. Would be hard to list them. Situations where one could consider using non-default output units: to quote the source more literal; to follow article style (use same unit system throughout), to control swapped order (output units in first position), follow style that is common in the topic domain (e.g., "in topic X pressure is commonly expressed by unit Y"). All this is for the editor's (your) freedom to refine article style. -DePiep (talk) 07:34, 5 April 2016 (UTC)
Thanks. I have, in any case, opened a thread at WP:MOSNUM. Martinevans123 (talk) 13:38, 5 April 2016 (UTC)

The idea of letting a template select the output unit by default is so foreign to me that I never tried it and didn't know it was possible. I would always have an output unit in mind and would always put my choice in the template explicitly. Jc3s5h (talk) 18:34, 5 April 2016 (UTC)

That's fine, but for the record there are a couple of reasons why it is useful to recommend that people use the default. First, someone might not be sure what output unit "should" be used, but they can see that a conversion would be desirable—why require them to look up the recommended output when convert can do it? Second, taking the default applies a consistent style for articles. Third, I have often corrected broken converts simply by omitting the output unit because someone added a convert and did not notice that it gave an error—they got the output unit wrong and omitting it fixed the problem. There is a theoretical fourth benefit, namely that it is conceivable that we could decide a default should be changed, and doing that in convert would automatically apply the result to all articles using the default. Johnuniq (talk) 02:10, 6 April 2016 (UTC)
  • Cases to override default units: There are cases where the rest of an article or paragraph could focus on specific unit-codes, such as noting 2 buildings have area in square feet on a small lot measured in acres, and all could be shown as square metres to indicate how much of the lot was covered by the buildings. A common issue is high rainfall in mm converted to inches, but display in feet would make more sense above 5 feet, or 60 inches (1,500 mm). In general, conversions of large amounts should consider a larger output unit than the default. -Wikid77 (talk) 00:29, 8 April 2016 (UTC)

Display incorrect

{{convert|10.30|±|0.74|AU|km mi|abbr=on}}

10.30 ± 0.74 AU (1.541×109 ± 111,000,000 km; 957,000,000 ± 69,000,000 mi)
Displays "10.30 ± 0.74 AU (1.541×109 ± 111,000,000 km; 957,000,000 ± 69,000,000 mi)"
It should display "10.30 ± 0.74 AU (1.541×109 ± 1.11×108 km; 9.570×108 ± 6.90×107 mi)"
Or at the very least "10.30 ± 0.74 AU (1.541×109 ± 1.11×108 km; 957,000,000 ± 69,000,000 mi)"
  • Why would the error term not use the same format as the main term?

-- 70.51.45.100 (talk) 08:09, 9 April 2016 (UTC)

I'm afraid convert is not that clever. The ± is more for human-scaled rough measurements and is not intended as an uncertainty. {{val}} can display uncertainties in various ways, but it cannot do conversions.
  • {{val|10.30|0.74|u=AU}}10.30±0.74 AU
I don't think convert could be used with this example. If the numbers were kinder it would be possible, although very ugly, to use convert to generate numbers which could be plugged into val. However, with the example above, the output produced by convert is not a simple number than val would recognize. If it were converting miles to km, you would use several converts like the following to generate each number, and put them into a val. Very ugly!
  • {{convert|10.30|mi|km|sigfig=6|disp=number}} → 16.5762
Sorry, but I think this will have to be done with wikitext and no convert. Johnuniq (talk) 09:51, 9 April 2016 (UTC)

Is there a way to force convert to use scientific notation in its output terms? -- 70.51.45.100 (talk) 02:52, 10 April 2016 (UTC)

You can't force the output to use scientific notation, but you can strongly encourage it by using e-notation for the input value. In the following, convert thinks 100 is too small for scientific notation, but 1000 is ok.
  • {{convert|1e2|m|m|abbr=on}} → 1×102 m (100 m)
  • {{convert|1e3|m|m|abbr=on}} → 1×103 m (1.0×103 m)
Johnuniq (talk) 03:58, 10 April 2016 (UTC)
Would there be any support to add such a feature to CONVERT (forcing scientific notation) ? -- 70.51.45.100 (talk) 03:12, 11 April 2016 (UTC)
Anything is possible but the best motivation for change is to see some examples where the proposal would be used in articles. Convert is a generic tool, and I'm not sure it should display 100 in a different way from above. In articles on scientific topics there should rarely be a need for conversions and {{val}} will do whatever is wanted. The original issue raised above arises because people want to display astronomical distances in familiar units—perhaps something specific for that purpose could be developed. Johnuniq (talk) 03:44, 11 April 2016 (UTC)
It would be all astronomical values, since astronomical values are astronomical in everyday units (even in astronomical units, some would need scientific notation to not have 9, 12 or 15 digits); distances, masses, luminance, power, etc. -- 70.51.45.100 (talk) 05:30, 11 April 2016 (UTC)
I think it's asking a bit much of convert to cover those cases. It's mostly meant to facilitate conversions between common quantities, when precision is not super critical. In scientific context, just convert things manually and format them with val, to the appropriate precision (usually 1 or 2 sig figs on error, rounding the primary value accordingly. {{val|10.30|0.74|u=AU}} [{{val|1.541|0.11|e=9|u=km}}; {{val|9.570|0.690|e=8|u=mi}}] → 10.30±0.74 AU [(1.541±0.11)×109 km; (9.57±0.69)×108 mi]. Headbomb {talk / contribs / physics / books} 14:47, 11 April 2016 (UTC)

"Extreme Example" of template misuse

I recognize that some tortured soul someone endured considerable agony and invested significant effort in a failed quest to force attempting to get this template to bend to his or her will. This editor then "perfected" and meticulously documented a three-stage technique of using and then removing {{convert}} from the end-result.

Um... no. Nobody should have to suffer through that. Now, I'm sure there are more elegant ways to do this, but I might have simply coded something like this:

The American defenders had 18-, 24-, and 32-pound ({{convert|18|,|24|,|32|lb|0|disp=out}}) cannons.

resulting in:

The American defenders had 18-, 24-, and 32-pound (8, 11, 15 kg) cannons.

I have therefore removed from the documentation the following section, in its entirety. It is preserved below. so as to... well... just because.

Extreme changes for grammatical structure: The 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons

This example is from the article Fort McHenry:

The American defenders had 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons.

You can't get this sentence structure as a direct result of using {{convert}} and its options. However, you can get the correctly converted numbers and the grammatical structure you want to use by using {{convert}} plus three stages of editing, previewing and saving versions of the text you wish to change.

Stage 1: Enter the input numbers and units in {{convert}} as usual (this stage is just to get the calculated output):
  • had {{convert|18 |, |24 |, |32 |lb |kg |0 }} cannons
Get the converted data below by clicking Preview or Save:
→ had 18, 24, 32 pounds (8, 11, 15 kg) cannons
Stage 2: Change the resulting text from a {{convert|...}} template result to plain code by adding subst: to the template name (short for "substitution") :
  • had {{subst:convert|18 |, |24 |, |32 |lb |kg |0 }} cannons
Double-check this by clicking Preview. The preview will show the converted numbers are still correct:
→ had 18, 24, 32 pounds (8, 11, 15 kg) cannons
Then click Save.
Stage 3: Click Edit at the top of the article again, and then go to the text in the editing window. You'll see that the text is there in plain code. The template {{convert|...}} itself will have disappeared. You can change the text as needed. The substituted text and plain code in the editing window in this example would be:
had 18, 24, 32 pounds (8, 11, 15 kg) cannons
You can edit this text as usual to add the grammatical features you wish. In this example, editing the above text to:
  • had 18-,_24-_and_32-pounder (8, 11_and_15 kg) cannons
And then save your edit will show the following result in the article text:
→ "had 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons"

grolltech(talk) 11:00, 14 March 2016 (UTC)

Thank you. Now I won't have to endure the obnoxious plural "cannons" any longer. Kendall-K1 (talk) 12:45, 14 March 2016 (UTC)
For completeness, it is also possible to have a mixture like this:
  • {{convert|18|,|24|,|32|lb|0|disp=out}} → 8, 11, 15 kg
  • {{convert|18|,|24|, and|32|lb|0|disp=out}} → 8, 11, and 15 kg
  • {{convert|18|,|24|and|32|lb|0|disp=out}} → 8, 11 and 15 kg
Johnuniq (talk) 22:43, 14 March 2016 (UTC)
@Grolltech: and this took you threetwo years to solve? Anyway, this was not "bending to their will" of the template, but usage. And could you prove the 'misuse' you seem to see? -DePiep (talk) 18:40, 29 March 2016 (UTC)
The "misuse" here seems to be a sin of omission. Not using the template makes it harder to come back later and change the numbers. If a re-inspection of the source, or appearance of a new source, makes it necessary to change "18" to "19", or add a 48-pounder to the list, then someone must re-do the three step process. I would rather have the template do the work, even if I must enter the new number twice. Anyway you can still use the three-step process, but I don't think we should recommend it. Kendall-K1 (talk) 18:57, 29 March 2016 (UTC)
In the original situation, the result it could not be reached without {subst:} (which is a correct -- not 'misusing' -- feature). Furthermore, the OP attitude is one I rarely if ever met after someone makes an improvement to wikipedia. -DePiep (talk) 06:12, 30 March 2016 (UTC).
@DePiep: I'm not sure what you mean by "and this took you two years to solve?" I assume from your defensive stance that you are the author, and I apologize that I have offended you. But in all honesty, I wish I had seen (and removed) that section two years ago. Once I noticed it, it only took a few minutes to come up with an example solution to your problem. It took me longer than that to figure out what you were trying to teach us, how you were trying to do so, and why you even wanted to create such grammatically-incorrect "grammatical features" as "32-pounder cannons". [Note: One shouldn't use an agent noun (see wiktionary:pounder) to describe a noun (cf. "That 32-pound cannon is in good shape" vs. "That cannon is a 32-pounder").]
Yet all of that is besides the main point. I'm sorry to say this, but the main point is that this section was not an improvement to Wikipedia. The purpose of the template's documentation page is to provide instruction for the proper usage of that template within Wikicode. The {{convert}} template is intended to be transcluded. (Yes, I know that this is now an Lua module that can be substituted – but that doesn't mean that it should.) When editors are trying to learn how to use {{convert}} properly, it's counterproductive and confusing – and therefore improper – to instruct them to delete it through substitution. grolltech(talk) 20:28, 3 April 2016 (UTC)
It was. (And btw: I am not defensive, I am attacking your pedantic dismissive black judgemental attitude. Clearly you don't know what you "apologise" for, because right away you are adding more to your stack of self-serving incomprehension and negative judgements. Really, editing to improve wikipedia has been done 822,283,242 times so far, but I never met an editor who was so self-glorifying degrading after a single edit.) -DePiep (talk) 20:39, 3 April 2016 (UTC)
File:Graham's Hierarchy of Disagreement-en.svg
Ok, it looks like I touched a nerve. So far, we've got the bottom four rungs of Graham's hierarchy of disagreement pretty well covered. Can we please dispense with the attacks and stick to the main point? I've been WP:BOLD so as to improve Wikipedia, and deleted the above – in which you feel pride of WP:OWNERSHIP, and an opposing belief that it improved Wikipedia. I've provided my reasons for considering that section unhelpful. Perhaps you'd care to enlighten my "incomprehension" with a reason to feel otherwise? Please try to stay within the top three rungs of the hierarchy. Thanks. grolltech(talk) 22:11, 3 April 2016 (UTC)

Let's stick to discussing convert. Johnuniq (talk) 01:55, 4 April 2016 (UTC)

Grolltech Can we please dispense with the attacks and stick to the main point? -- can't stop what you started yourself, can you? Even blaming someone else for your OP. -DePiep (talk) 22:07, 9 April 2016 (UTC)

DePiep, it was not my intent of my OP to "attack" you, or to offend you in any way. It is clear, however, that I personally offended you deeply, and for that, I really am sorry. When first I apologized, I should have left it at that. Instead, I was compelled to defend myself from the first of several attacks on my intelligence – and that offended you further. A couple of posts ago, I struck out that which I thought was most offensive in my OP, and today, I have struck more still. But I am not, as you say, "blaming someone else" for my OP, for they are my words and I take responsibility for them. And yet, I think that your indignation has you so focused on my initial offense that you don't realize how offensive your responses have been to me as well. So, time becomes a loop, escalate and repeat.

The main point of my OP was that {{convert}} is intended to be transcluded. It is not helpful to instruct editors to delete it through substitution. I have given my reasons for feeling that way, and on that point, there appears to be consensus. You disagree, and would probably say that the main point, actually, is that I am a prick. There's probably consensus on that as well, but I think your anger is keeping you from engaging objectively on the merits of substituting {{convert}}. Therefore, if we can't move past the ad hominem attacks, and if we respond only to the tone of the message rather than its content, then I think this discussion has run its course, and might recommend to a non-involved party that they close and archive this discussion.

Meanwhile, in the interest of transparency: I did notice the other day that this section also appears verbatim in Help:Convert. Since the same arguments about substitution apply there as here, I think it should – after giving sufficient and hopefully-less-offensive notice – be removed from there as well. grolltech(talk) 15:49, 29 April 2016 (UTC)