Help talk:Displaying a formula

Latest comment: 1 month ago by Jacobolus in topic Whither TikZ?

Indentation rules

edit

The most used indentation rule for displaying math is to use a colon such that :<math>E=mc^2</math> renders

however if I am reading MOS:INDENT and this page right, we should use two line breaks and <math display=block>E=mc^2</math>

Is this right? This would require a lot of work to change everywhere. Is this recent? Is there anyway to revert to the previous convention? The colon is shorter and simpler, while the double line break and block display does not indent on mobile, and leads to other problems, specially if text is in the same line. ReyHahn (talk) 11:23, 7 April 2025 (UTC)Reply

  • A leading colon is not indentation, it is the definition part of a description list. Using it for indentation produces invalid HTML and is an accessibility error. It has never been correct practice. Lack of indentation and displaying on the same line on mobile is a bug IMO, which I've reported. Hairy Dude (talk) 23:29, 8 February 2026 (UTC)Reply

{align} vs {aligned}

edit

Is {align} silently being converted to {aligned}? In amsmath LaTeX, {align} can only be used in text-mode, whereas on WP it works even in a sub-expression.

Is it ok to use {aligned}? It seems to work.

If so, should this be stated (for anybody wanting to use the same code for amsmath LaTeX and WP)? catslash (talk) 23:46, 14 May 2025 (UTC)Reply

The question is unclear. By {align} and {aligned} do you mean the align and aligned environments? please show the LaTeX source inside <syntaxhighlight lang=latex>...</syntaxhighlight> or the <math>...</math> wikitext inside <syntaxhighlight lang=wikitext>...</syntaxhighlight>. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 11:44, 15 May 2025 (UTC)Reply
Yes, the align and aligned environments. The source:
\left .\begin{aligned}a & = b \\
 & = c \\
 & = d \\
 & \phantom = \vdots \\
 & = z \end{aligned} \right\} 25 \text{ lines}
works fine both as wikitext and LaTeX:
Whereas, if aligned is changed to align, then while it still works as wikitext, as LaTeX it gives the error ! Package amsmath Error: Erroneous nesting of equation structures;. catslash (talk) 16:06, 15 May 2025 (UTC)Reply
Could One consequence is that the formula enclosed in the \left ... \right pair cannot have line breaks in the output. be the problem? Do you need anything from amsmath that is not already in LaTeX2ε? -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 17:14, 15 May 2025 (UTC)Reply
It is the amsmath package which supplies the align and aligned environments. Without \usepackage{amsmath} the above code results in ! LaTeX Error: Environment aligned undefined. or ! LaTeX Error: Environment align undefined.. The code works fine with or without the \left ... \right pair. The question is (1) why does it also work with align in wikitext, (2) is there any reason not to use aligned in wikitext, (3) should the help page say that's is ok to use aligned? catslash (talk) 21:11, 15 May 2025 (UTC)Reply
The "explanation" for the message is circular. Have you tried, e.g., stack exchange? What hapens if you remove the NL (\\)? -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 13:35, 16 May 2025 (UTC)Reply

Inconsistency between <math> and {math} within page

edit

On Astronomical coordinate systems phi sub o renders differently on MacOS Chrome browser (Version 141.0.7390.108 (Official Build) (arm64)) depending on the whether HTML or Latex formatting context is used. This makes the article confusing because this expression appears in both contexts but the visual appearance is inconsistent.

Inside {math} formatting the character phi does not appear.

ϕo, observer's latitude

Inside <math> formatting phi appears correctly.

, observer's latitude Setikites (talk) 15:53, 19 October 2025 (UTC)Reply

Dark-mode

edit

I think this Talk page is for the template used in Formula#Chemical_formulas.In dark mode it's not working for me displaying a white rectangle instead of Butane.

Light mode does work, as does removing the filter (commented out) in the following rule of load.php, which applies to the <img> tag

@media screen {
html.skin-theme-clientpref-night .skin-invert-image img, html.skin-theme-clientpref-night .skin-invert, html.skin-theme-clientpref-night .oo-ui-iconElement-icon:not(.oo-ui-image-progressive):not(.oo-ui-image-destructive):not(.oo-ui-checkboxInputWidget-checkIcon):not(.oo-ui-image-invert):not(.mw-no-invert), html.skin-theme-clientpref-night .oo-ui-indicatorElement-indicator {
	color-scheme: light;
	/* filter: invert(1) hue-rotate(180deg); */
  }
}

I hope this is the right place to repot this. ThanksTc 13 17 19 (talk) 01:32, 6 November 2025 (UTC)Reply

Recent edit

edit

@Altamediandies: Edit permalink/1335113448 introduce a typo LLaTeX vs. {{math}} and deleted an anchor

<span class="anchor" id="LaTeX vs. math template"></span>

. Was the removal of the anchor deliberate?

 Preceding unsigned comment added by Chatul (talkcontribs) 27 January 2026

A diff link would work better in this case, I think:
Special:Diff/1335113448
CiaPan (talk) 16:35, 27 January 2026 (UTC)Reply
I've reverted the edits for now. There were also a bunch of unhelpful incidental markup changes. –jacobolus (t) 11:22, 28 January 2026 (UTC)Reply

math display="block" failing?

edit

The page g-factor (physics) is incorrectly formatted: the display="block" seems to be rendered as several spaces. The "Block" section on this page has the same problem. Johnjbarton (talk) 02:29, 10 February 2026 (UTC)Reply

It looks fine to me. What kind of rendering do you have set in Special:Preferences § mw-prefsection-rendering? It should be set to "SVG". Other modes are still buggy. –jacobolus (t) 03:33, 10 February 2026 (UTC)Reply
Yes, I have SVG. Hmm. I guess I have to reboot :-( Johnjbarton (talk) 03:47, 10 February 2026 (UTC)Reply
Well rebooting did not fix it. Any other ideas?
mwe-math-element-block in my style sheet is setting the inline. If I disable it with the Inspector the display block is corrected. Johnjbarton (talk) 04:02, 10 February 2026 (UTC)Reply
I'm not entirely sure what you are seeing. Maybe you can take a screenshot? Does it look better if you open an 'incognito' browser tab? Does it look better in a different browser? –jacobolus (t) 07:55, 10 February 2026 (UTC)Reply
Debugging screenshot for a math rendering problem
The problem occurs in a incognito tab is Chrome (Mac OS) but not in Safari on the same machine. Johnjbarton (talk) 22:00, 10 February 2026 (UTC)Reply

Whither TikZ?

edit

§ Diagrams in TeX says Xy-pic[a] (online manual) is the most powerful and general-purpose diagram package in TeX. Surely TikZ deserves mention, and the wording seems to violate WP:NPOV. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 13:10, 22 April 2026 (UTC)Reply

If the aim is to make the diagram in SVG, then it seems strange to suggest starting with any sort of TeX. catslash (talk) 14:28, 27 April 2026 (UTC)Reply
Commutative diagrams are very simple and usually created directly in people's LaTeX documents, rather than with a separate graphical tool. –jacobolus (t) 14:59, 27 April 2026 (UTC)Reply
This is a help page, not an encyclopedia article. The goal is to give helpful advice, not encyclopedic summary. I don't see how pointing someone at the Tikz manual at https://pgf-tikz.github.io/pgf/pgfmanual.pdf is supposed to help them create a commutative diagram (the topic of the section under discussion). –jacobolus (t) 15:07, 27 April 2026 (UTC)Reply
How about a link to https://ctan.org/pkg/tikz-cd, which uses PGF/TikZ|TikZ? -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 15:29, 27 April 2026 (UTC)Reply
That's probably better. (I don't have much experience here; I haven't made any commutative diagrams for Wikipedia articles.) Also feel free to expand the section with examples, etc. –jacobolus (t) 16:34, 27 April 2026 (UTC)Reply
I've used both, but never for wiki. I've added three examples for both packages. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 14:01, 28 April 2026 (UTC)Reply
Not quite sure what happened, but now the page is full of "Lua error: too many expensive function calls." –jacobolus (t) 16:24, 28 April 2026 (UTC)Reply
I don't see them. My guess is that it's something in <syntaxhighlightt\s>...</syntaxhighlightt\s>. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 16:59, 28 April 2026 (UTC)Reply
Try scrolling down to the bottom of the page. It's breaking the citations and some of the external links. –jacobolus (t) 17:58, 28 April 2026 (UTC)Reply
Weird! I tried deleting references and example, and each took the count down by one. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 19:05, 28 April 2026 (UTC)Reply
Yeah, there's probably just overall too much LaTeX, syntax highlighting, etc. on the page. I wonder if there's a way to get some of it to be cached better and not stress the Lua so much. –jacobolus (t) 19:44, 28 April 2026 (UTC)Reply
  1. Use the barr option for commutative diagrams, e.g., \usepackage[cmtip,all,barr]{xy}.
Cite error: There are <ref group=lower-alpha> tags or {{efn}} templates on this page, but the references will not show without a {{reflist|group=lower-alpha}} template or {{notelist}} template (see the help page).