Template talk:Math theorem

(Redirected from Template talk:Math theorem/testcases)
Latest comment: 2 months ago by The-erinaceous-one in topic Addition of Optional Proof Parameter

Issues with this template

edit

I think this template is problematic as currently implemented. The template is very simple but displays poorly — particularly on mobile devices, which make up over half of all users. On mobile devices, the whitespace on the left and right makes the width of the text very narrow. The narrow width makes the text harder to read. The narrowness also makes it more likely for equations/formulas to overflow the width of the box and appear truncated (which of course is already a problem on mobile devices, but the box makes it worse).

The template could be improved, but also I wonder if it should be deprecated. All things considered, I think ordinary text or ordinary indented blocks do the job as well or better than this template.

Also see Wikipedia talk:WikiProject Mathematics/Archive/2017/May#template for the theorems for some previous discussion about this template. Adumbrativus (talk) 11:58, 26 July 2021 (UTC)Reply

We can probably adjust the style sheet to remove the whitespace on a mobile view. I've created a sandbox version of the template at Template:Math theorem/sandbox which uses a style sheet at Template:Math theorem/sandbox/styles.css. Currently I've used a media query so that if the width of the screen is less than 500px there is no horizontal margin. You can look at the difference between the two at Template:Math_theorem/testcases mobile site. It would be possible to tweak the style and test things before going live. If you do modify things then make sure to purge the testcase page before looking at changes. --Salix alba (talk): 16:47, 26 July 2021 (UTC)Reply
Thanks for working on improving this! It definitely helps. Adumbrativus (talk) 06:50, 27 July 2021 (UTC)Reply
OK. I'll make it live. --Salix alba (talk): 07:03, 27 July 2021 (UTC)Reply

Addition of Optional Proof Parameter

edit

Currently, there are two templates, {{Math theorem}} and {{Math proof}}, but in most cases the proof of a theorem directly follows the theorem. The formatting when juxtaposing these templates is not great, however:

Theorem — My theorem statement.

Proof

My proof statement.

I have written a modified version of {{Math theorem}} (see {{Math theorem/sandbox}}, at [this revision]) to improve the formatting:

Theorem. My theorem statement.
Proof. My proof statement.

I find this format much more consistent with the typical formatting in math texts, it is easier to use when including a proof, and it automatically collapses the proof so that it is deemphasized by default (but there is a parameter to make it expanded by default). A QED symbol is also included at the end of the proof.

@Salix alba, Hyacinth, Frietjes, TakuyaMurata, and Maproom: What do you think? (@PatrickR2: this might also be of interest to you.) The-erinaceous-one (talk) 20:57, 31 August 2024 (UTC)Reply

As an example of how the current template results in some poor usage when editors try to include a proof, see Multi-task learning#Task_structure_representations. The-erinaceous-one (talk) 21:39, 31 August 2024 (UTC)Reply
Generally speaking, I agree it’s a good idea to have a template that can cover both a statement and a proof. But I think such a template should be distinct from the current math_theorem template since the style is different (and we shouldn’t change the style). I personally don’t like to put a proof in a box since I like the proof to be a part of the text, like in typical math texts, but others would disagree. —- Taku (talk) 09:15, 1 September 2024 (UTC)Reply
Why shouldn't we change the style? As far as I see, there was no discussion to decide on the current style, it was just the result of whatever the initial template author happened to use.
Regarding the proof formatting, as a collapsible box: The guidelines in Wikipedia:WikiProject Mathematics/Proofs say to deemphasize proofs and recommends putting them in collapsible boxes to that end. There is a parameter "expand_proof" in my current implementation that allows showing the proof expanded by default. We could tweak both the styling of the proofs and parameter behavior to make it look nicer and (if we like) to disable the collapsibility. The-erinaceous-one (talk) 04:43, 2 September 2024 (UTC)Reply
Why? Mainly because of the inertia. Those who use the math_theorem template use that to get a certain style so if we changed the style at this point, that would be disrupting. As for the formatting, the page you cited is not a guideline. Some, including me, don't like a collapsed proof and would prefer other formattings. -- Taku (talk) 08:52, 2 September 2024 (UTC)Reply
You could add a |style= option, with values
old
Use old format
new
Use new format
local
Use the default format for current page
and define a new template to specify the default for the page. --Shmuel (Seymour J.) Metz Username:Chatul (talk) 12:01, 2 September 2024 (UTC)Reply
Adding new parameters is a bad idea. Just make a new template under a new name. –jacobolus (t) 23:48, 2 September 2024 (UTC)Reply
I would rather define a new template that doesn't use boxes as the default, with a parameter to enable them. Otherwise, people will continue using {{Math theorem}} to insert boxed theorems where a less emphasized statement may be more suiting. Nevertheless, I think having more parameters would be useful for allowing editors to choose between several formatting options. See {{Math theorem/sandbox}} for several examples. The-erinaceous-one (talk) 09:45, 3 September 2024 (UTC)Reply


The-erinaceous-one: Please note that your markup above,

{{Math theorem/sandbox
|My theorem statement.
|proof=My proof statement.
|style=margin: 1em; padding: 0em; border: 0px solid #ef7; overflow: hidden;<!--This is to make the display match the sandbox CSS -->
}}

generates a Misnested tags error for italics. However, moving the pipe of "proof" to the end of the preceding line, viz:

{{Math theorem/sandbox
|My theorem statement.|
proof=My proof statement.
|style=margin: 1em; padding: 0em; border: 0px solid #ef7; overflow: hidden;<!--This is to make the display match the sandbox CSS -->
}}

makes the misnested tags error go away. It would be good to modify the template so that it doesn't generate the misnested tags error either way. —Anomalocaris (talk) 11:06, 3 September 2024 (UTC)Reply

Thanks for the recommendation. I think I fixed it now? The-erinaceous-one (talk) 08:20, 6 September 2024 (UTC)Reply