Template talk:Overline
Is it possible to make the line not be coloured black? – SmiddleTC@ 16:08, 20 May 2007 (UTC)
- It's probably not too hard for someone to code, but when would you need it to be another color? --Brandon Dilbeck 05:01, 27 July 2007 (UTC)
- Like this? --Abdull 19:16, 7 November 2007 (UTC)
- Rather than use a template, you can use the combining diacritical mark U+0305 (combining overline). Example: x̅. The overline will be the same colour as the surrounding text. Needless to say, this is useful only for single letters (or very short strings), and appropriate only when the overline is semantically significant (as opposed to purely decorative). —Psychonaut 18:54, 12 November 2007 (UTC)
See also
[edit]Could Template:Strikethrough be added to See also? Olli Niemitalo (talk) 20:16, 1 October 2012 (UTC)
Edit request: a two-parameter form for repeating decimals
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
(Writing this in the form of a formal edit request in the spirit of WP:BOLD. Feel free to demote to discussion if you think that's warranted.)
For repeating decimals, it would be nice if 4⁄15 = 0.26 could be written as {{overline|0.2|6}}
, making the wikitext easier to read than the current 0.2{{overline|6}}
. That could be done in a backward-compatible way by making the template sensitive to the presence of a second argument:
{{#ifeq:{{{2|}}}|{{{2}}}|{{{1}}}}}<span style="text-decoration:overline;">{{{2|{{{1}}}}}}</span><noinclude>
(The edit request is specifically to change the current definition to the above.)
I'm also open to a separate template, but I couldn't think of any good names no longer than "overline", so I chose to combine the two functionalities.
The code above chooses based on whether parameter 2 is defined, even if it has an empty (null) value, because that simplifies the second part more than it complicates the first, but requiring a non-empty value is possible too. 71.41.210.146 (talk) 20:01, 17 April 2017 (UTC)
- Note: Sandboxing this. It's not a terrible idea, but I want to make sure it works first. Primefac (talk) 16:57, 18 April 2017 (UTC)
- Not done: Sandboxing that code gives some invalid responses. I'd love to play around with it but I don't have the time. Feel free to mess about in the sandbox, get the edge cases working, and resubmit. Primefac (talk) 17:12, 18 April 2017 (UTC)
- @Primefac: Thanks for the test. But I din't see the problem; after changing the code in Template:Overline/sandbox to the proposed version above, I get what appears to be correct output. Note that
{{Overline/sandbox|232}}
will produce "232", with an empty overlined portion. This is as I explained originally; the presence of a second parameter even if empty triggers the 2-argument form. There's an overline span in the HTML, but it's invisible because there's nothing inside it. - If you want an empty second argument to have no effect, try the slightly longer:
{{#if:{{{2|}}}|{{{1}}}}}<span style="text-decoration:overline;">{{#ifeq:{{{2|}}}|{{{2}}}|{{{1}}}}}}</span><noinclude>
- I added it to the sandbox so you can compare. 71.41.210.146 (talk) 04:37, 19 April 2017 (UTC)
- I think the problem is that a blank second parameter shouldn't chance the outcome.
{{overline|123}}
shouldn't give the same output as123
. I've added many an extraneous pipe when coding too fast, so I can easily see someone getting confused why it's not showing properly when they mistype. Primefac (talk) 12:06, 19 April 2017 (UTC)- @Primefac: The reason I pointed out that implementation choice and mentioned "but requiring a non-empty value is possible too" was specifically to invite comments like this. Myself, I wouldn't have thought a trailing pipe would be likely, and most templates make a pretty strong distinction between
{{foo|bar}}
and{{foo|bar}}
, which I would think would be a more common typo. But I also know that most templates consider missing and empty parameters to be synonymous, so I wanted to point out the different implementation in case it was significant. As I said, it's quite possible, just a bit longer, and I put both forms on the sandbox page. - If we can settle that, the question is now whether this a desirable change, or would a separate template be better? It would certainly simplify both templates; the question is whether we can find a good name for it. Template:vinculum? 71.41.210.146 (talk) 17:47, 19 April 2017 (UTC)
- @Primefac: The reason I pointed out that implementation choice and mentioned "but requiring a non-empty value is possible too" was specifically to invite comments like this. Myself, I wouldn't have thought a trailing pipe would be likely, and most templates make a pretty strong distinction between
- I think the problem is that a blank second parameter shouldn't chance the outcome.
- @Primefac: Thanks for the test. But I din't see the problem; after changing the code in Template:Overline/sandbox to the proposed version above, I get what appears to be correct output. Note that
Done - I went with Option 2 (with slight modification) because I didn't want to break any existing uses. Primefac (talk) 18:19, 19 April 2017 (UTC)
- Thank you 71.41.210.146 (talk) 20:29, 19 April 2017 (UTC)
Bug when used within {math} and {mvar} templates
[edit]When this template is used within {{math}} or {{mvar}}, AB and AB is produced respectively. In the Chrome and Safari browsers this shows up as an unnaturally thick (almost bolded) overline, which is a little ugly but passable. On Firefox, however, the overline shows up thin like normal but lowered just enough to be obscured by the tops of the letters, completely messing up its purpose. This can be avoided by swapping the nesting order as in {{overline|{{mvar|AB}}}}, but this fails for more complex equations (like AB + BC = CA) for which the {{math}} template would need would need to be broken up, thereby defeating its whole purpose and making the underlying wikitext much messier. Do you all have any idea what issues within the template source code might be causing this discrepancy between browsers? OlliverWithDoubleL (talk) 07:51, 27 October 2023 (UTC)
- Looks fine to me (in all instances of the above). This might be a user-side issue. Primefac (talk) 08:00, 27 October 2023 (UTC)