User:Mgkrupa/Code and Symbols
Math LaTeX code
[edit]- Detexify − Online tool: Find LaTeX code for a symbol by drawing it. (More tools here)
- Shapecatcher − Online tool: Find Unicode and HTML codes for a symbol by drawing it.
- Common misc code
{{abbreviation|TVS|Topological Vector Space}}
TVS
<ol type="a">
<ol style="list-style-type: lower-latin;">
WP:ACCESSIBILITY anTable of Binary Operatorsd MOS:MATH
|
---|
Indentation:
Do NOT use
"Do not use possibly unpronounceable symbols"
|
{{quote frame}} and {{quote box}} |
---|
|
{{math theorem}} |
---|
|
Proofs:
{{math proof}} |
---|
|
- Indentation
{{Block indent}}
{{in5}}
- Table of contents
{{TOC limit|3}}
Common math code
[edit]- Help:Displaying a formula (Commutative diagrams)
- List of mathematical symbols by subject
- WP:LaTeX symbols
- LaTeX + Unicode list: Long list 1, Long list 2.
- Involving indices/subscripts
Result | LaTeX code | Other info |
---|---|---|
<math>x_\bull = \left(x_i\right)_{i \in I}</math>
|
||
<math>x_\bull = \left(x_i\right)_{i=1}^\infty</math>
|
||
\sum_{\stackrel{i \in I,}{j \in J}} x_{i,j}
|
||
<math display=block>\begin{alignat}{4} f :\;&& X &&\;\to \;& Y \\[0.3ex] && x &&\;\mapsto\;& y \\ \end{alignat}</math> |
||
<math display=block>\begin{alignat}{4} \pi_i :\;&& \prod_{j \in I} X_j &&\;\to\; & X_i \\[0.3ex] && \left(x_j\right)_{j \in I} &&\;\mapsto\;& x_i \\ \end{alignat}</math> |
||
<math display=block>\begin{alignat}{9} f :\;&& X &&\;\to \;& Y && \quad \text{ and } \quad & g :\;&& X &&\;\to \;& Y \\[0.3ex] && x &&\;\mapsto\;& y && & && x &&\;\mapsto\;& y \\ \end{alignat}</math> |
||
|
<math display=block>f(x) = \begin{cases} x & \text{if } x \leq 0 \\ 0 & \text{otherwise } \\ \end{cases}</math> or (for more fine control over spacing/alignment) you can use <math display=block>f(x) =
\left\{
\begin{alignat}{9}
x&\,+\,&&x^2 \quad& \text{if } && &x \leq 0 \\
& &&x^2 & \text{if } && 0 \leq\,&x < 1 \\
x& && & \text{if } && 1 \leq\,&x \\
\end{alignat}
\right.
</math>
|
|
<math display=block>f(x) = \begin{cases} x & \text{if} & x \in (-\infty, 0] \\ x + x^2 & \text{if} & x \in (0, 1) \\ x + x^3 & \text{if} & x \geq 1 \\ \end{cases}</math> |
||
|
<math>\mathop\implies</math>
|
Misc
| ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Table/2-D sequence
|
---|
The following is used in the article Fréchet–Urysohn space.
<math>\begin{alignat}{11} &x_1^1, ~~ &x_1^2, ~~ &x_1^3, ~~ &x_1^4, ~~ &x_1^5, ~~ &\ldots ~~ &x_1^i, ~~ \ldots ~~ &\to ~~ &x_l \\ &x_2^1, ~~ &x_2^2, ~~ &x_2^3, ~~ &x_2^4, ~~ &x_2^5, ~~ &\ldots ~~ &x_2^i, ~~ \ldots ~~ &\to ~~ &x_2 \\ &x_3^1, ~~ &x_3^2, ~~ &x_3^3, ~~ &x_3^4, ~~ &x_3^5, ~~ &\ldots ~~ &x_3^i, ~~ \ldots ~~ &\to ~~ &x_3 \\ &x_4^1, ~~ &x_4^2, ~~ &x_4^3, ~~ &x_4^4, ~~ &x_4^5, ~~ &\ldots ~~ &x_4^i, ~~ \ldots ~~ &\to ~~ &x_4 \\ & & &\;\,\vdots & & & &\;\,\vdots & &\;\,\vdots \\ &x_l^1, ~~ &x_l^2, ~~ &x_l^3, ~~ &x_l^4, ~~ &x_l^5, ~~ &\ldots ~~ &x_l^i, ~~ \ldots ~~ &\to ~~ &x_l \\ & & &\;\,\vdots & & & &\;\,\vdots & &\;\,\vdots \\ & & & & & & & & &\,\downarrow \\ & & & & & & & & ~~ &\;x \\ \end{alignat} </math> |
Spaces and Sizes
[edit]Result | LaTeX code | Other info |
---|---|---|
Text text text text text
Text text text text text. Now without vertical spaces: Text text text text text. |
<math display=block> h_\bull \begin{aligned}&\\[1.0ex]\end{aligned} </math> |
Vertical space before and/or after a single line math statement. 2.0ex is 2.0 times the height of the 'x ' character.
|
<math>\displaystyle \sum_{i=1}^\infty</math>
|
||
<math>\bigl( \bigr) ~ ()</math>
|
||
<math>\dotsb</math> for binary operators/relations
|
- Spacing
- See also: em (typography) and Help:Displaying a formula#Spacing
- Zero-width space:
​
​
(The LaTeX\hspace{0pt}
and\hskip0pt
do not work on Wikipedia)
Result | LaTeX code |
---|---|
<math>\begin{alignat}{8} &M \! M&&\quad&&\backslash! &&\text{negative thin space (-3 mu)}\\ &MMM && && &&\text{no space}\\ &M \, M&& &&\backslash, &&\text{thin (3 mu)}\\ &M \; M&& &&\backslash; &&\text{thick (5 mu)}\\ &M \ M&& &&\backslash\text{ } &&\text{length of a text space character}\\ &M \text{ } M&& &&\backslash\text{text}\{\ \}&&\text{using } \backslash\text{text}\{\text{ }\}\\ &M \quad M&& &&\backslash\text{quad} &&\text{width of } M \text{ (18 mu)}\\ &MMM && && &&\text{no space }\\ &M \qquad M&& &&\backslash\text{qquad} &&\text{double width of } M \text{ (36 mu)}\\ &M \mathbin{M} M&& &&\backslash\text{mathbin}\{M\}\quad&&\text{spaces around binary relation } M\\ &M \mathrel{M} M&& &&\backslash\text{mathrel}\{M\}\quad&&\text{spaces around binary operator } M\\ \end{alignat}</math> |
Symbols (LaTeX)
[edit]- Links to Math symbol articles
|
- Symbols for Operations/Relations
- Unicode + corresponding LaTeX code
- Common Unicode/LaTeX symbols: Short list Long list
Result | LaTeX code | Other info |
---|---|---|
|
|
Weierstrass P |
|
|
|
|
|
QED end of proof box. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NOTE: |
|
|
|
|
|
Words/Terminology
[edit]Useful terminology or words with special symbols
- Fréchet
- Kuratowski closure axioms#Definition has useful terminology.
Lists of words at wiktionary:
|
---|
|
Non-Latex Code
[edit]Superscripts and subscripts
|
---|
Alignment:
{{center}} |
---|
Text goes here
|
Divide text into multiple columns: <div style="column-count: 3; column-rule-style: dotted; column-rule-color: lightblue; column-rule-style: outset; column-width: 80px;">The COVID‑19 pandemic, also known as the coronavirus pandemic, is an ongoing pandemic of coronavirus disease 2019 (COVID‑19) caused by severe acute respiratory syndrome coronavirus 2 (SARS‑CoV‑2). It was first identified in December 2019 in Wuhan, China. The World Health Organization declared the outbreak a Public Health Emergency of International Concern on 30 January 2020 and a pandemic on 11 March.</div> |
Spacing
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Equations and boxes
[edit]Boxes
| |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
For Box shadows - See also: CSS box-shadow Box shadows:
|
Referencing and Displaying equations
| ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Step (1): Wrap the equation in Step (2): Reference the equation by its Example: <div id=EquationID><math display=block>x \mapsto f x</math></div> where [[#EquationID|the equation above]] Output: where the equation above
Use
Complex number
(Eq. 90) Use
(3.5)
Step (2) Use
|
Aligning: \begin{alignat}{4}
and \begin{array}{4}
[edit]- For additional vertical space at the end of a line, use
\\[0.7ex]
instead of just\\
(2.0ex
is twice the height of thex
character).
LaTeX: Aligning equations
\begin{alignat}{4} \stackrel{a}{b} | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Wikipedia equivalent of the LaTeX code
|
Result | LaTeX code | Other info |
---|---|---|
<math>f(x) = \begin{cases} x & \text{ if } x \leq 0 \\ 0 & \text{ otherwise } \\ \end{cases}</math> |
||
<math>\begin{alignat}{4} f : \,& X && \to \,&& Y \\ & x && \mapsto\,&& y \\ \end{alignat}</math> |
||
<math>\begin{array}{rccl} f : &X& \to \,&Y \\ &x& \mapsto\,&y \\ \end{array}</math> |
||
|
{{dfn}}
Ex: Without alt text:
Say that {{em|{{dfn|1=new term|id=dfn-anchorname}}}} if ....<br/>this term ([[#dfn-anchorname|defined here]]), ...
- Say that new term if ....
this term (defined here), ...
Ex: With alt text:
Say that {{em|{{dfn|1=new term 2|2=Alt text giving definition of term|id=dfn-anchorname2}}}} if ....<br/>this term ([[#dfn-anchorname2|defined here]]), ...
- Say that new term if ....
this term (defined here), ...
Color
[edit]Result | LaTeX code | Other info |
---|---|---|
{\color{Red}{\bigcup}} B
|
||
A \color{Red}{\bigcup}\color{Black}{} B
|
See below for why \color{Black}{} is needed
| |
\color{Red}{\bigcup} B
|
Without the \color{Black}{} it renders as:
| |
<span style="color:red">red text</span>
|
For plain text. |
- Wikipedia:Manual of Style/Accessibility − MOS:COLORS has a table of acceptable colors. − More details at MOS:COLOR
- {{Color sample}}
- {{Font color}}
Colors
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
General Wiki code
[edit]Lists
[edit]<li value="7">Item</li>
- but
<li value="7a">Item</li>
does not produce "7a".
- but
<ol type="a"> or <ol style="list-style-type:lower-latin;"> or <ol style="list-style-type:square;"> or circle; {{Columns-list}} | ||||||
---|---|---|---|---|---|---|
|
Blank lists (no symbol)
{{plainlist}} {{unbulleted list}} | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Horizontal/Flat lists
{{hlist|class=inline|Entry1|Entry2}} | ||||||
---|---|---|---|---|---|---|
{{flatlist| * Entry 1 * Entry 2 * entry 3 }}produces:
Using {{flatlist}} improves WP:ACCESSIBILITY:
|
<ol style="list-style-position:inside;"> |
---|
where note that "words" appears directly underneath the "1." The default is "
where note that there is empty space directly underneath the "1." |
Spacing/Padding
<ol style="line-height:180%;"> |
---|
Produces:
The default is:
|
Tables and columns
[edit]
Sorting Tables
|
---|
|
Wikipedia: Tables
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
For side by side info (e.g. code next to output): (The <div style="background: white; border: 2px solid rgb(0, 255, 0); padding: 2px;"> {| style="border-collapse: collapse; width: ; background: ; color: ; border: ; margin: ;" <!--- Example: {| style="width: 100%; background: yellow; color: red; border: 2px solid green;" ---> !style="text-align:center;"|Column 1 Title !style="text-align:center;"|Column 2 Title |-style="vertical-align:top;" |style="border-right:2px solid rgb(0, 255, 0); padding-top: ; padding-right:1em; padding-left:1em;"| Left side info - e.g. Code goes here |style="padding-top: ; padding-right:1em; padding-left:1em;"| Right side info here |} </div>
You can also use other languages for
|
Columns
| |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Column 1 start:
Column 2 start: If there is not enough space to display 2 columns then the second column will be displayed underneth the first column. Otherwise they will be side by side.
|
See also, Main, and other Hatnotes
[edit]- {{About}}
- {{About-distinguish2}}
Images
[edit]- Wikipedia:How to create charts for Wikipedia articles
- Wikipedia:Graphics tutorials
- This program displays webpages as a color blind person would see it. (See also MOS:COLORCODING).
Wikipedia:Images
|
---|
|
- {{Overlay}} – "Allows image numbered, textual number, or colour tag overlays to be positioned over an image"
- {{Annotated image}}
- - "allows the addition of explanatory notes to images in the form of actual text (which can also contain links)"
- - "Other uses include cropping an image"
{{Multiple image}} | |||||||||
---|---|---|---|---|---|---|---|---|---|
{{Multiple image |total_width =600 <!-- REMOVE total_width= TO PREVENT AUTOMATIC RESIZING. total width of all the displayed images in pixels --> |perrow=1 <!-- Layout parameters --> | align =<!-- right (default), left, center, none --> | direction =<!-- horizontal (default), vertical --> | background color =<!-- #33CC00 - 'hex triplet' web color --> | width =<!-- displayed width of each image in pixels (an integer, omit "px" suffix); overrides "width[n]"s below --> | caption_align =<!-- left (default), center, right --> | image_style =<!-- border:1; (default) --> | image_gap =<!-- 5 (default)--> <!-- Header --> | header_background =<!-- #33CC00 --> | header_align =<!-- center (default), left, right --> | header =<!-- header text --> | image1 =<!-- NO "File:" or "Image:" prefix. Filename ONLY --> | width1 =<!-- displayed width of image; overridden by "width" above --> | height1= | alt1 = | link1 = | image2 = | width2 = | height2= | alt2 = | link2 = <!-- Max 10 images (image10) --> <!-- Footer --> | footer_background=<!-- #33CC00 --> | footer_align =<!-- left (default), center, right --> | footer =<!-- footer text --> }} |
{{Panorama}} {{Wide image}} Panorama images | ||||
---|---|---|---|---|
|
- {{Scalable image}}
Code (Displaying)
[edit]
The
|
A single space in front of a line displays the line as code.
Example: Line displayed as code because of a single space
| ||
---|---|---|
Example: _<------ _ indicates where the single space is. This line has no space so is displayed as normal. -->
code_here
<nowiki />{|class="wikitable sortable"
!Name and surname!!Height
displays _<------ _ indicates where the single space is. This line has no space so is displayed as normal. --> code_here {|class="wikitable sortable" |
Name and surname | Height |
|
Source code and result side by side
| ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
syntaxhighlight
[edit]- Main: MediaWiki:Extension:SyntaxHighlight
- For examples, see Wiki source code of: Help:Table
<syntaxhighlight lang="html" style="overflow:auto;" highlight="1,3-4"> | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Can also use: <syntaxhighlight lang="css" highlight="1,1-2" style="overflow:auto;"> {{Panorama|image=File:Example.jpg|height=300}} </syntaxhighlight> {{Panorama|image=File:Example.jpg|height=300}}
Show line numbers with From: Help:Sorting#Specifying a sort key for a cell
|
- Misc: Over the edit box, there is a "Syntax highlighting" button (its icon is a marker angled at 45 degrees and it is to the left of "> Advanced > Special characters > Help > Cite"). It is a very helpful feature that is not on by default.
Maps
[edit]{{Graph:Map}}
- Clickable and colorable world map that highlights countries that your mouse hovers over.- See here for an example that uses
{{Graph:Map}}
in combination with the{{infobox}}
,{{legend}}
,{{flagu}}
, and{{columns-list}}
templates.
- See here for an example that uses
{{OSM Location map}}
- Uses OpenStreetView- Example: Siege of Saguntum#Aftermath
{{Location map many}}
- Map allowing multiple labels{{Location map}}
- Only allows 1 label.- Example: Example where a user may select any one of multiple maps.
- Examples: User:Rr016 has many examples of high quality maps.
- {{legend}} -
{{legend|OliveDrab|[[Lists of colors]]}}
{{legend|#f1f580|[[Template:Color chart X11]]}}
produces
pushpin maps
|
---|
Using The Suwałki Gap is named after the city of Suwałki {{stack begin}}
<div style="background:white; border:1px solid rgb(0, 0, 0); padding:2px; align:center; text-align:left; width:260; position:relative;">
{{Location map|Poland#Podlaskie Voivodeship#Baltic Sea#Europe#European Russia#NATO#European Union
|relief = Yes
|width = 260
|default_width =
|float =
|caption = The [[Suwałki Gap]] is named after the city of [[Suwałki]]
|alt = The city of Suwałki
|label = Suwałki
|link = Suwałki
|position =
|mark = Blue_pog.svg
|marksize = 6
|coordinates = {{coord|54|05|56|N|22|55|43|E|region:PL_type:city|display=inline,title}}
|border = infobox
|background =
}}
</div>
{{stack end}}
| coordinates = {{coord|54|20|51|N|18|38|43|E|region:PL|display=inline,title}}
| pushpin_relief = Yes
| pushpin_label =
| pushpin_label_position =
| pushpin_map = Poland#Pomeranian Voivodeship#Europe#Baltic Sea
| pushpin_map_alt =
| pushpin_map_caption =
| pushpin_mapsize = <!-- In pixels without px (Ex: write 300, not 300px) -->
| pushpin_mark =
| pushpin_mark_width =
| pushpin_overlay =
| coor_pinpoint =
| coordinates_footnotes = <!-- References -->
|
Links and anchors
[edit]- Wiktionary & Linking between Wikis
- Links to Wikimedia Commons
{{Commons category inline}}
generates a link to the corresponding Commons category.- Place in the "External links" section of the article.
Ex: * {{Commons category inline}}
in the article "ArticleName" produces:
- Media related to ArticleName at Wikimedia Commons
- Links to category pages; renaming links
[[:Category:Sodium|Sodium]]
produces: Sodium{{See also|:Category:Sodium compounds|l1=Sodium compounds}}
- Adding categories
- To make "Category:Isotopes of sodium" a subcategory of "Category:Sodium", edit the category page "Category:Isotopes of sodium" and add the code "
[[Category:Sodium]]
" as you normally would with an article. - Add this
[[Category:People|Einstein, Albert]]
"to add an article called Albert Einstein to the category "People" and have the article sorted by "Einstein, Albert""
- Annotated links
{{Annotated link}} |
---|
Ex:
EX: Topological vector space – Vector space with a notion of nearness |
{{visible anchor|Displayed Anchor Name|name2}}
{{visible anchor|name1|name2|text=Displayed Text}}
- DISADVANTAGE: Using
|text=
prevents "Displayed Text" from being highlighted by a back.
{{anchor}} and
|
---|
|
Misc
[edit]{{Audio|filename.ogg|pronunciation}}
- Ex:{{Audio|en-us-gymnosperm.ogg|pronunciation|help=no}}
produces: as in the article Gymnosperm.
Page titles/Page names
{{tl|short description}} |
---|
Taken from: WP:SDNOTDEF:
|
Page titles/Page names
{{DISPLAYTITLE:''example'' title}} and {{lowercase title}} and {{italic title}} |
---|
Place BELOW {{Short description}} at the top of the page's source.
|
Horizontal lines
{{hr}} and {{dividing line}} |
---|
|