Template talk:EquationRef

Latest comment: 4 months ago by StrategyPanda30 in topic Dark Mode Incompatibility

Space before equations

edit

Hello, very recently I got interested in the EquationRef template: it would be interesting to add a bit of space (say, the size of a TAB, for example) even when the equation number (or reference) is placed before the equation. Is it possible to modify according to this requirement? Best Regards, Daniele.tampieri (talk) 19:05, 25 June 2009 (UTC)Reply

What's wrong with :{{EquationRef|2|(Eq. 2){{spaces|5}}}} <math>x^2-2x+1=0</math>? It renders as
(Eq. 2)       
there's space (5 of them) after the label, as requested. Alternatively, you can put the spaces outside the template, as in :{{EquationRef|2|(Eq. 2)}}{{spaces|5}} <math>x^2-2x+1=0</math>. That gives you:
(Eq. 2)       
Do either of those work for you? —TedPavlic (talk) 20:49, 25 June 2009 (UTC)Reply
Well, they are just fine: thank you. Daniele.tampieri (talk) 06:03, 26 June 2009 (UTC)Reply

Invalid HTML

edit

When EquationRef is used with the same name multiple times, it results in duplicate HTML ids and invalid HTML output. Examples:

---— Gadget850 (Ed) talk 15:35, 28 September 2011 (UTC)Reply

Duplicated <cite> tags

edit

Also when this template is used with {{NumBlk}}, it causes the <cite> tag to prematurely be closed and reopened, also causing duplicate identifiers. Apparently it is because both templates are trying to add bold formatting.

Simplified wiki code:

'''(<cite id="math_1"><span>'''1'''</span></cite>)'''

HTML (spacing added):

<b>(
  <cite id="math_1"></cite>
  <span>
    <cite id="math_1">1</cite>
    <b>
      <cite id="math_1"></cite>)
    </b>
  </span>
</b>

I’m not sure if it’s a bug and Media Wiki should be able to handle it, or if it’s just an abuse of the markup. A workaround would be to use the {{NumBlk|RawN=.}} option. Or you could give the id parameter to the <span> element and remove the <cite> tag; what’s the point of it anyway? Or remove the bold markup from this template. Vadmium (talk, contribs) 03:05, 13 June 2012 (UTC).Reply

Fixed now. I've replace the '''...''' with a span style. So the two templates should nest well.--Salix alba (talk): 11:25, 15 February 2014 (UTC)Reply

Automatic numbering possible?

edit

Is it possible to automatically number the equations in the order they appear like in TEX?Ciro.santilli (talk) 08:47, 24 January 2012 (UTC)Reply

Cite

edit

This template is wrapped in <cite>...</cite>. Under HTML5, which we will migrate to someday, <cite> is only for titles. Recommend that this be changed to <span>. ---— Gadget850 (Ed) talk 00:24, 26 January 2012 (UTC)Reply

Fixed now. I've merged the <cite> and <span> into a single <span>.--Salix alba (talk): 11:27, 15 February 2014 (UTC)Reply

Error checking

edit

Adding User:Gadget850/EquationRefErrors.js to your JS will show errors associated with these templates. For example: Additive synthesis equations 1 and 2 do not link to a matching EquationNote. ---— Gadget850 (Ed) talk 00:28, 26 January 2012 (UTC)Reply

Incompatability with Template:NumBlk

edit

This was spotted at Wikipedia:VisualEditor/Feedback. There was an incompatibility of this template and {{NumBlk}}. Basically both used '''...''' to put the equation number in bold, but when nested you basically got

...
'''    (From NumBlk)
<cite ...><span class="reference plainlinksneverexpand"> (from EquationRef)
'''    (from EquationRef)
Eqn 1
'''    (from EquationRef)
</span></cite> (from EquationRef)
'''    (From NumBlk)
...

Which can either be interpreted as <b>...<b>...</b>...</b> (normal renderer) or <b>...<b>...</b>...</b> (VE).

I've changed the template to use an explicit style in span

<span {{#ifeq:{{{noid}}}|noid||id="math_{{{1}}}"}} class="reference plainlinksneverexpand" style="font-weight: bold; font-style: italic;">{{#if: {{{2| }}}|[[#equation_{{{1}}}|{{{2}}}]]|[[#equation_{{{1}}}|{{{1}}}]]}}</span>

which should eliminate problems. I've also removed the <cite>...</cite> as its an incorrect usage of tag in html[1] and put the id and style in the span.--Salix alba (talk): 11:16, 15 February 2014 (UTC)Reply

edit

The combination of this template with EquationNote creates a link from EquationNote to EquationRef, as expected, but also a link back from EquationRef to EquationNote. The link back is not explained in the documentation, as far as I could see, and it is also rather surprising to me. Besides, the link back does not quite work if there are multiple instance of EquationNote refering to the same EquationRef. Therefore, I propose to remove the link back. -- Jitse Niesen (talk) 09:40, 4 September 2014 (UTC)Reply

Having received no comments, I now made this change. -- Jitse Niesen (talk) 12:22, 6 September 2014 (UTC)Reply

Incorrect italics

edit

Why is the parenthesized digit italicized? That is not done in standard systems such as TeX, LaTeX, and MathJax? Michael Hardy (talk) 04:12, 4 December 2014 (UTC)Reply

No bold?

edit

To recent editors Mikhail_Ryazanov, Daviddwd and any others. Is there a version of this without the bold? I saw this being used in Carnot cycle for Figures, so have adopted it in Electron diffraction. The only partial issue is that the Bold is not exactly WP:MOS, apart from that it looks good. Any suggestions, or is there another template (I could not find one). Ldm1954 (talk) 21:25, 30 October 2023 (UTC)Reply

There is {{Equation}} without bold but with other problems (centering inconsistent with the usual layout; wrongly italicized number) and very small usage (I guess, all these should be weeded out). MOS:MATH doesn't tell anything about equation numbering, only referring to WP:MATH, which in turn recommends (see WP:DISPLAYTAG) just this set of {{NumBlk}}, {{EquationRef}}, {{EquationNote}}. I suggest rising this issue about formatting at the MOS:MATH talk page (I'd support removing bold from both {{EquationRef}} and {{EquationNote}}, as it's really unnecessary, unusual for mathematics/physics texts, and is indeed inconsistent with MOS:BOLD), then modify these templates accordingly. — Mikhail Ryazanov (talk) 22:25, 30 October 2023 (UTC)Reply
Thanks. I am an archaic coder (Fortran 90) so I just used the template decoder at https://en.wikipedia.org/wiki/Special:ExpandTemplates to reverse engineer them, then used the css without the bold and better positioning for Figure links. Works nicely. Ldm1954 (talk) 02:15, 4 November 2023 (UTC)Reply

Dark Mode Incompatibility

edit

Some pages have equationref used in an equation box, like in Conditional entropy. In dark mode, the text colour stays black making it hard to read. Not sure if this is a problem with the equationref template or with Template:Equation box 1. StrategyPanda30 (talk) 00:50, 12 July 2024 (UTC)Reply