Zeroclanzhang(讨论 | 贡献) (创建页面,内容为“{{Documentation subpage}} <!-- Categories and interwikis go at the bottom of this page. --> This template wraps a math expression written in TeX code between <code><nowiki><math>...</math></nowiki></code> tags using the <code><nowiki>{{#tag:}}</nowiki></code> parser function magic word. It further avoids wrapping points at either end of expression that normally occurs with <code><nowiki><math>...</math></nowiki></code>, so avoiding being…”) |
Zeroclanzhang(讨论 | 贡献) 无编辑摘要 |
||
第2行: | 第2行: | ||
<!-- Categories and interwikis go at the bottom of this page. --> | <!-- Categories and interwikis go at the bottom of this page. --> | ||
This template wraps a math expression written in [[TeX]] code between <code><nowiki> | This template wraps a math expression written in [[TeX]] code between <code><nowiki>[math]...[/math]</nowiki></code> tags using the <code><nowiki>{{#tag:}}</nowiki></code> [[WP:PF|parser function]] [[H:MW|magic word]]. It further avoids wrapping points at either end of expression that normally occurs with <code><nowiki>[math]...[/math]</nowiki></code>, so avoiding being split from punctuation as would be normal for text. Intended to be used for very short expressions. | ||
Neither <code>display="inline"</code> nor TeX math mode <code>\textstyle</code> is set by this template. | Neither <code>display="inline"</code> nor TeX math mode <code>\textstyle</code> is set by this template. | ||
== Usage == | == Usage == | ||
: {{tlxi|tmath|expression}} | : {{tlxi|tmath|expression}} | ||
===Examples=== | ===Examples=== | ||
第21行: | 第21行: | ||
Apart from using the <code>{{tl|(}}</code> and <code>{{tl|)}}</code> templates to get <code>{</code> and <code>}</code>, you may use the braces <code>{</code> and <code>}</code> as long as <code>{</code> is not preceded or followed by another <code>{</code>, and <code>}</code> is not preceded or followed by another <code>}</code>, e.g. | Apart from using the <code>{{tl|(}}</code> and <code>{{tl|)}}</code> templates to get <code>{</code> and <code>}</code>, you may use the braces <code>{</code> and <code>}</code> as long as <code>{</code> is not preceded or followed by another <code>{</code>, and <code>}</code> is not preceded or followed by another <code>}</code>, e.g. | ||
* {{tlc|tmath|<nowiki>x {{=}} {{!}} \vec{x} {{!}} </nowiki>}} gives {{tmath|x {{=}} {{!}} \vec{x} {{!}} }} | * {{tlc|tmath|<nowiki>x {{=}} {{!}} \vec{x} {{!}} </nowiki>}} gives {{tmath|x {{=}} {{!}} \vec{x} {{!}} }} | ||
* {{tlc|tmath|<nowiki>\zeta(2) {{=}} \frac{\pi^2}{6} </nowiki>}} parses (you added that space!) to {{tmath|\zeta(2) {{=}} \frac{\pi^2}{6} }} | * {{tlc|tmath|<nowiki>\zeta(2) {{=}} \frac{\pi^2}{6} </nowiki>}} parses (you added that space!) to {{tmath|\zeta(2) {{=}} \frac{\pi^2}{6} }} | ||
* {{tlc|tmath|<nowiki>\zeta(2) {{=}} \frac{\pi^2}{6}</nowiki>}} fails to parse (you forgot that space!), v.g. {{tmath|\zeta(2) {{=}} \frac{\pi^2}{6}}} | * {{tlc|tmath|<nowiki>\zeta(2) {{=}} \frac{\pi^2}{6}</nowiki>}} fails to parse (you forgot that space!), v.g. {{tmath|\zeta(2) {{=}} \frac{\pi^2}{6}}} | ||
第31行: | 第31行: | ||
* {{tl|math}} | * {{tl|math}} | ||
* {{tl|mvar}} | * {{tl|mvar}} | ||
{{Math templates|notation}} | {{Math templates|notation}} | ||
<includeonly>{{Sandbox other|| | <includeonly>{{Sandbox other|| |
2024年1月21日 (日) 23:13的最新版本
This is a documentation subpage for 模板:Tmath. It may contain usage information, categories and other content that is not part of the original 模板 page. |
This template wraps a math expression written in TeX code between [math]...[/math]
tags using the {{#tag:}}
parser function magic word. It further avoids wrapping points at either end of expression that normally occurs with [math]...[/math]
, so avoiding being split from punctuation as would be normal for text. Intended to be used for very short expressions.
Neither display="inline"
nor TeX math mode \textstyle
is set by this template.
Usage
{{tmath|expression}}
Examples
{{tmath|a}}
gives[mathmath>[/math]
{{tmath|\pi}}
gives[mathmath>[/math]
{{tmath|x_0}}
gives[mathmath>[/math]
The template is intended to be used for very short LaTeX mathematical expressions like variables. It is more cumbersome to use for equations or other expressions containing special signs that have to be escaped, like the equal sign =
with
and the vertical pipe {{}}
|
with
:
{{!}}
{{tmath|E {{=}} mc^2}}
gives[mathmath>[/math]
{{tmath|x {{=}} {{!}} \vec x {{!}} }}
gives[mathmath>[/math]
Use braces { and } with caution
Apart from using the
and {{(}}
templates to get {{)}}
{
and }
, you may use the braces {
and }
as long as {
is not preceded or followed by another {
, and }
is not preceded or followed by another }
, e.g.
{{tmath|x {{=}} {{!}} \vec{x} {{!}} }}
gives[mathmath>[/math]
{{tmath|\zeta(2) {{=}} \frac{\pi^2}{6} }}
parses (you added that space!) to[mathmath>[/math]
{{tmath|\zeta(2) {{=}} \frac{\pi^2}{6}}}
fails to parse (you forgot that space!), v.g.[mathmath>[/math]
}
{{tmath|\frac{1}{ x^{2n+1} } }}
parses (you added all those spaces!) to[mathmath>[/math]
{{tmath|\frac{1}{x^{2n+1}} }}
fails to parse (you forgot some of those spaces!), v.g.[mathmath>[/math]
}}
See also