Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Template:Tmath

Permanently protected template
From Wikipedia, the free encyclopedia
Template documentation[view] [edit] [history] [purge]

This template wraps a math expression written inTeX code between<math>...</math> tags using the{{#tag:}}parser functionmagic word.

It further helps to avoid 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.

Neitherdisplay="inline" nor TeX math mode\textstyle is set by this template. Where inline formatting is desired, use{{tmath|\textstyle ...}}.

Usage

{{tmath|expression}}

Examples

The template is intended to be used for shortLaTeX mathematical expressions like variables, and is useful for limiting awkward wrapping points. It is more cumbersome to use for equations or other expressions containing special signs that must be escaped or replaced, like the equal sign= with{{=}} and the vertical pipe| with\vert,\mid or{{!}}, and\| with\Vert:

Wrapping behavior

With{{tmath}}With<math>
Lorem ipsum dolor sitamet{\displaystyle {\text{amet}}}, consectetur adipiscingelit{\displaystyle {\text{elit}}},sed do eiusmod tempor incididunt ut labore et dolore magna aliqua{\displaystyle {\text{sed do eiusmod tempor incididunt ut labore et dolore magna aliqua}}}. Ut enim ad minimveniam{\displaystyle {\text{veniam}}}, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Lorem ipsum dolor sitamet{\displaystyle {\text{amet}}}, consectetur adipiscingelit{\displaystyle {\text{elit}}},sed do eiusmod tempor incididunt ut labore et dolore magna aliqua{\displaystyle {\text{sed do eiusmod tempor incididunt ut labore et dolore magna aliqua}}}. Ut enim ad minimveniam{\displaystyle {\text{veniam}}}, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

See the difference? The punctuation stays. The block of math itself is still not amenable to line break, that we can't fix.

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|1=\zeta(2) =\frac{\pi^2}{6} }} parses (you added that space!) toζ(2)=π26{\displaystyle \zeta (2)={\frac {\pi ^{2}}{6}}}
  • {{tmath|1=\zeta(2) =\frac{\pi^2}{6}}} fails to parse (you forgot that space!), v.g.Failed to parse (syntax error): {\displaystyle \zeta(2) = \frac{\pi^2}{6}}
  • {{tmath|\frac{1}{ x^{2n+1}} }} parses (you added all those spaces!) to1x2n+1{\displaystyle {\frac {1}{x^{2n+1}}}}
  • {{tmath|\frac{1}{x^{2n+1 }}}} fails to parse (you forgot some of those spaces!), v.g.Failed to parse (syntax error): {\displaystyle \frac{1}{x^{2n+1} }}

Uniform compatible formatting guideline

When converting between<math>...</math> and{{tmath|...}}, first adjusting the expression to be compatible with both can help. A guideline for such formatting is:

  • Do not use templates internally, such as{{(}},{{!(}}, etc.
  • Name the parameter|1= if the formula contains an equals sign (=). This removes the need to use the magic word{{=}}.
  • Replace all pipe characters:| by\vert or\mid, and\| by\Vert. This is clearer than using the magic word{{!}} since it doesn't mix wiki markup with TeX.
  • Introduce a space between adjacent identical braces: replace all occurrences of{{ by{ { and}} by} }.
  • Ensure a space at the end – this removes the possibility that a trailing} will adjoin the closing braces of the{{tmath|...}}.
  • Replace adisplay="inline" parameter with a leading\textstyle.
  • With these adjustments, it should be possible to interchange the tags<math>...</math> and a template{{tmath|1=...}}. Any text, such as punctuation, that does not naturally form part of the expression should be moved out of the{{tmath|...}}.

See also

Math templates
  • Functions
  • Numeral systems
Functions
Numeral systems
Conversions
convert many units (see:list)
cvt abbreviated{{convert}}
convinfobox{{convert}} for infoboxes
bbl to t barrels of oil to tonnes
long ton long hundredweights, quarters and pounds to kilograms;
long tons and hundredweights to pounds and metric tons
miles-chains miles and chains to kilometres linking "chains"
decdeg degrees, minutes, and seconds todecimal degrees
deg2dms decimal degrees to degrees, minutes, and seconds
deg2hms decimal degrees tohour angle (in hours, minutes, and seconds)
hms2deghour angle (in hours, minutes, and seconds) to decimal degrees
inflation calculate inflation of Consumer Price Index-related prices
pop density population density in an area
track gauge railway track gauges
Notation andformatting
bigmath bigger font to matchTeX\displaystyle (standalone formulas only)math short text-based formulas
mathcal [mathematical] calligraphic font; alternative toLaTeX\mathcal{...}tombstone symbol indicating theend of a proof
mvar individual italicized maths variables in normal textval measurement values, uncertainties and units
a line set above/below a sequence of charactersvec various overarrows, underarrows, etc.
abs absolute values (paired vertical lines)
  • langle
  • rangle
  • angbr
  • angular brackets
  • bra-ket
  • braket
  • bra
  • ket
  • bra–ket notation
  • ldelim
  • rdelim
  • multiline delimiters (2–5 lines inclusive)
    ceil,floor calculations:mw:Help:#expr; formatting indicators3.14,3.14 (no calculation performed)pars parentheses that can be resized()
    fraction slant fractions35 (not for maths/science articles; usestanding or upright fractions{{sfrac}} instead)sfrac "standing" or upright fractions3/5 (use in maths/science articles instead of{{fraction}})
    intmathintegral symbols
  • sub
  • sup
  • su
  • subscripts and superscripts
  • overset
  • underset
  • arbitrary characters/diacritics set above/below one another    
    tmath WrapTeX in<math> tags
  • Boxes
  • Tags
  • Notices
  • The abovedocumentation istranscluded fromTemplate:Tmath/doc.(edit |history)
    Editors can experiment in this template's sandbox(create |mirror) and testcases(create) pages.
    Add categories to the/doc subpage.Subpages of this template.
    Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Tmath&oldid=1299876955"
    Categories:
    Hidden categories:

    [8]ページ先頭

    ©2009-2025 Movatter.jp