Template:LaTeX operators/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{dochead}}{{{{ROOTPAGENAME}} }}
{{dochead}}{{{{ROOTPAGENAME}} }}
This template allows easy typesetting of the floor, ceiling, and rounding functions in LaTeX.
=== Usage ===
=== Usage ===
Place this template at the top of any page where these operators will need to be used.
{{Shortcut|texops}}
{| class="wikitable" style="text-align: center;"
{| class="wikitable" style="text-align: center;"
|+ style="font-size: 105%;" | Pre-defined LaTeX control sequences
|+ style="font-size: 105%;" | Pre-defined LaTeX control sequences
|- style="white-space: nowrap;"
|-
! rowspan="2" | Operator !! colspan="2" | Example !! rowspan="2" | Definition
! rowspan="2" | Operator !! colspan="2" | Example !! rowspan="2" | Definition
|- style="white-space: nowrap;"
|-
! You type !! You get
! You type !! You get
|-
|-
| <code>floor</code> || <code>{{nowrap|\floor{{(}}x + y{{)}}}}</code> || <math>\floor{x + y}</math> || Floor (round down)
| <code>floor</code> || <code>{{nowrap|<nowiki>\floor{x + y}</nowiki>}}</code> || <math>\floor{x + y}</math> || Floor (round down)
|-
|-
| <code>ceil</code> || <code>{{nowrap|\ceil{{(}}x + y{{)}}}}</code> || <math>\ceil{x + y}</math> || Ceiling (round up)
| <code>ceil</code> || <code>{{nowrap|<nowiki>\ceil{x + y}</nowiki>}}</code> || <math>\ceil{x + y}</math> || Ceiling (round up)
|-
|-
| <code>abs</code> || <code>{{nowrap|\abs{{(}}x + y{{)}}}}</code> || <math>\abs{x + y}</math> || Absolute value (magnitude)
| <code>abs</code> || <code>{{nowrap|<nowiki>\abs{x + y}</nowiki>}}</code> || <math>\abs{x + y}</math> || Absolute value (magnitude)
|-
|-
| <code>round</code> || <code>{{nowrap|\round{{(}}x + y{{)}}}}</code> || <math>\round{x + y}</math> || Round (to the nearest integer)
| <code>norm</code> || <code>{{nowrap|<nowiki>\norm{x + y}</nowiki>}}</code> || <math>\norm{x + y}</math> || Norm (magnitude)
|-
|-
| <code>rround</code> || <code>{{nowrap|\rround{{(}}x + y{{)}}}}</code> || <math>\rround{x + y}</math> || "Reverse round" (distance to nearest integer)
| <code>round</code> || <code>{{nowrap|<nowiki>\round{x + y}</nowiki>}}</code> || <math>\round{x + y}</math> || Round (to the nearest integer)
|-
|-
| <code>hs</code> || colspan="2" | <code>\hs</code> || Narrow whitespace
| <code>rround</code> || <code>{{nowrap|<nowiki>\rround{x + y}</nowiki>}}</code> || <math>\rround{x + y}</math> || "Reverse round" (distance to nearest integer)
|}
|}


=== See also ===
=== See also ===
* [[:Template:LaTeX mapping operators]] &ndash; a more advanced LaTeX template used for typesetting [[monzo]]s and [[val]]s.
* [[Template:LaTeX mapping operators]] a more advanced LaTeX template used for typesetting [[monzo]]s and [[val]]s.
* [[:Template:LaTeX preset characters]] &ndash; for predefining the bracket sequences.
* [[Template:LaTeX preset characters]] for predefining the bracket sequences.

Latest revision as of 18:55, 30 January 2025

[math]\displaystyle{ \def\hs{\hspace{-3px}} \def\lvsp{{}\mkern-5.5mu}{} \def\rvsp{{}\mkern-2.5mu}{} \def\llangle{\left\langle\lvsp\left\langle} \def\lllangle{\left\langle\lvsp\left\langle\lvsp\left\langle} \def\llllangle{\left\langle\lvsp\left\langle\lvsp\left\langle\lvsp\left\langle} \def\llbrack{\left[\left[} \def\lllbrack{\left[\left[\left[} \def\llllbrack{\left[\left[\left[\left[} \def\llvert{\left\vert\left\vert} \def\lllvert{\left\vert\left\vert\left\vert} \def\llllvert{\left\vert\left\vert\left\vert\left\vert} \def\rrangle{\right\rangle\rvsp\right\rangle} \def\rrrangle{\right\rangle\rvsp\right\rangle\rvsp\right\rangle} \def\rrrrangle{\right\rangle\rvsp\right\rangle\rvsp\right\rangle\rvsp\right\rangle} \def\rrbrack{\right]\right]} \def\rrrbrack{\right]\right]\right]} \def\rrrrbrack{\right]\right]\right]\right]} \def\rrvert{\right\vert\right\vert} \def\rrrvert{\right\vert\right\vert\right\vert} \def\rrrrvert{\right\vert\right\vert\right\vert\right\vert} }[/math][math]\displaystyle{ \def\abs#1{\left|{#1}\right|} \def\norm#1{\left\|{#1}\right\|} \def\floor#1{\left\lfloor{#1}\right\rfloor} \def\ceil#1{\left\lceil{#1}\right\rceil} \def\round#1{\left\lceil{#1}\right\rfloor} \def\rround#1{\left\lfloor{#1}\right\rceil} }[/math] This template allows easy typesetting of the floor, ceiling, and rounding functions in LaTeX.

Usage

Place this template at the top of any page where these operators will need to be used.

Note: You can use {{texops}} as a shortcut.

Pre-defined LaTeX control sequences
Operator Example Definition
You type You get
floor \floor{x + y} [math]\displaystyle{ \floor{x + y} }[/math] Floor (round down)
ceil \ceil{x + y} [math]\displaystyle{ \ceil{x + y} }[/math] Ceiling (round up)
abs \abs{x + y} [math]\displaystyle{ \abs{x + y} }[/math] Absolute value (magnitude)
norm \norm{x + y} [math]\displaystyle{ \norm{x + y} }[/math] Norm (magnitude)
round \round{x + y} [math]\displaystyle{ \round{x + y} }[/math] Round (to the nearest integer)
rround \rround{x + y} [math]\displaystyle{ \rround{x + y} }[/math] "Reverse round" (distance to nearest integer)

See also