Help:Markup
From HvWiki
Editing text on a wiki is meant to be as simple and intuitive as possible, so that most of your thought goes into content, rather than format. On this page, you'll find out just how the markup works. Please feel free to add your own examples.
Remember that looking at the source of articles that look the way you want is a very good way to learn how it is done. Also, for more detailed information, see the MediaWiki Editor Handbook.
Contents |
Basic Text Formatting
Bold and italics
Enclose your text with apostrophes. Two apostrophes cause italicized text to appear, and three cause bold text to appear. You can also enclose text with five apostrophes to get bold and italicized text. (2+3=5, after all!)
You type: You see: ''this text is italicized'' this text is italicized '''this is bold''' this is bold '''''this is bold and italicized''''' this is bold and italicized
Preformatted text
Start each line with a space or use the <pre> tag. Remember, you will have to manually wrap your lines, or they may cause the page to be wider than some peoples display. Intented text is simply accomplished with a colon at the beginning of an indented paragraph.
| You type: | You see: |
|---|---|
|
This text is preformatted, it will behave nicely.
|
This text is preformatted, it will behave nicely. Newlines will work like they ought to. |
|
<pre>This text is preformatted, it will behave nicely.
|
This text is preformatted, it will behave nicely. Newlines will work like they ought to. |
|
: This text is indented. |
|
|
This text is indented by a space. |
This text is indented by a space. |
Subscript and superscript
| You type: | You see: |
|---|---|
|
This is <sub>subscript.</sub> | This is subscript. |
| This is <sup>superscript.</sup> | This is superscript. |
Sections and Lists
In order to create and support a logical structure, articles can be divided into sections. Don't skip levels! A sub-subsection should never lie directly below a section.
| You type: | You see: |
|---|---|
|
==Section One== ===Subsection One=== ====Sub-subsection One==== |
New section Subsection Sub-subsection |
Unordered lists are created by simply marking each line with an asterisck.
| You type: | You see: |
|---|---|
|
*One *Two *Three |
|
You can also create ordered lists with the number sign (#).
| You type: | You see: |
|---|---|
|
#Apples #Oranges #Dirigibles |
|
The two types can also be combined, like so:
| You type: | You see: |
|---|---|
|
#Apples #*red #*green #Oranges #*navel #Dirigibles #*hydrogen #*helium |
|
Links and URLs
These are some examples of internal links.
| You type: | You see: |
|---|---|
|
[[high voltage]] | |
|
[[Nikola Tesla|Dr. Tesla]] | |
|
[[This shouldn't exist]] | |
|
[[HvWiki:About]] | |
|
[[HvWiki:About|]] |
These are some examples of external links.
| You type: | You see: |
|---|---|
|
http://www.google.com/ | |
|
[[Wikipedia:Tesla coil]] | |
|
[[Wikipedia:Nikola Tesla|]] | |
|
[http://www.google.com/] | |
|
[http://www.google.com/ Google] |
Math
HvWiki uses a subset of TeX markup, including some extensions from LaTeX and AMSLaTeX, for mathematical formulae.
Special characters
| Feature | Syntax | How it looks rendered |
|---|---|---|
| std. functions (good) | \sin x + \ln y +\operatorname{sgn} z | ![]() |
| std. functions (wrong) | sin x + ln y + sgn z | ![]() |
| Modular arithm. | s_k \equiv 0 \pmod{m} | ![]() |
| Derivatives | \nabla \partial x dx \dot x \ddot y | ![]() |
| Sets | \forall x \not\in \varnothing \subseteq A \cap B \cup \exists \{x,y\} \times C | ![]() |
| Logic | p \land \bar{q} \to p\lor \lnot q | ![]() |
| Root | \sqrt{2}\approx 1.4 | ![]() |
| \sqrt[n]{x} | ![]() |
|
| Relations | \sim \simeq \cong \le \ge \equiv \not\equiv \approx \ne | ![]() |
| Geometric | \triangle \angle \perp \| 45^\circ | ![]() |
| Arrows |
\leftarrow \rightarrow \leftrightarrow |
|
\Leftarrow \Rightarrow \Leftrightarrow |
|
|
| Special | \oplus \otimes \pm \mp \hbar \dagger \ddagger \star \circ \cdot \times \bullet \infty | ![]() |
| Degree in front | {}^\circ \mbox{C} | ![]() |
Subscripts, superscripts
| Feature | Syntax | How it looks rendered |
|---|---|---|
| Superscript | a^2 | a2 |
| Subscript | a_2 | a2 |
| Grouping | a^{2+2} | a2 + 2 |
| a_{i,j} | ai,j | |
| Combining sub & super | x_2^3 | ![]() |
| Derivative (good) | x' | x' |
| Derivative (wrong in HTML) | x^\prime | ![]() |
| Derivative (wrong in PNG) | x\prime | ![]() |
| Underlines & overlines | \hat a \bar b \vec c \widehat {d e f} \overline {g h i} \underline {j k l} | ![]() |
| Sum | \sum_{k=1}^N k^2 | ![]() |
| Product | \prod_{i=1}^N x_i | ![]() |
| Limit | \lim_{n \to \infty}x_n | ![]() |
| Integral | \int_{-N}^{N} e^x\, dx | ![]() |
| Line Integral | \oint_{C} x^3\, dx + 4y^2\, dy | ![]() |
Fractions, matrices, multilines
| Feature | Syntax | How it looks rendered |
|---|---|---|
| Fractions | \frac{2}{4} or {2 \over 4} | ![]() |
| Binomial coefficients | {n \choose k} | ![]() |
| Matrices | \begin{pmatrix} x & y \\ z & v \end{pmatrix} | ![]() |
| \begin{bmatrix} 0 & \cdots & 0 \\ \vdots &
\ddots & \vdots \\ 0 & \cdots & 0\end{bmatrix} |
![]() |
|
| \begin{Bmatrix} x & y \\ z & v \end{Bmatrix} | ![]() |
|
| \begin{vmatrix} x & y \\ z & v \end{vmatrix} | ![]() |
|
| \begin{Vmatrix} x & y \\ z & v \end{Vmatrix} | ![]() |
|
| \begin{matrix} x & y \\ z & v \end{matrix} | ![]() |
|
| Case distinctions | f(n) = \left \{ \begin{matrix} n/2, & \mbox{if }n\mbox{ is
even} \\ 3n+1, & \mbox{if }n\mbox{ is odd} \end{matrix} \right. |
![]() |
| Multiline equations | \begin{matrix}f(n+1) & = & (n+1)^2 \\ \ & = & n^2 + 2n + 1 \end{matrix} | ![]() |
Fonts
| Feature | Syntax | How it looks rendered |
|---|---|---|
| Greek letters | \alpha \beta \gamma \Gamma \phi \Phi \Psi\ \tau \Omega | ![]() |
| Blackboard bold | x\in\mathbb{R}\sub\mathbb{C} | ![]() |
| boldface (vectors) | \mathbf{x}\cdot\mathbf{y} = 0 | ![]() |
| boldface (greek) | \boldsymbol{\alpha} + \boldsymbol{\beta} + \boldsymbol{\gamma} | ![]() |
| Fraktur typeface | \mathfrak{a} \mathfrak{B} | ![]() |
| Script | \mathcal{ABC} | ![]() |
| Hebrew | \aleph \beth \gimel \daleth | ![]() |
| non-italicised characters | \mbox{abc} | abc |
| mixed italics (bad) | \mbox{if} n \mbox{is even} | ifnis even |
| mixed italics (good) | \mbox{if }n\mbox{ is even} | if n is even |
Parenthesizing big expressions
| Feature | Syntax | How it looks rendered |
|---|---|---|
| Not good | ( \frac{1}{2} ) | ![]() |
| Better | \left ( \frac{1}{2} \right ) | ![]() |
You can use various delimiters with \left and \right:
| Feature | Syntax | How it looks rendered |
|---|---|---|
| Parentheses | \left ( A \right ) | ![]() |
| Brackets | \left [ A \right ] | ![]() |
| Braces | \left \{ A \right \} | ![]() |
| Angle brackets | \left \langle A \right \rangle | ![]() |
| Bars and double bars | \left | A \right | and \left \| B \right \| | ![]() |
|
Delimiters can be mixed, |
\left [ 0,1 \right ) |
|
| Use \left. and \right. if you don't want a delimiter to appear: |
\left . \frac{A}{B} \right \} \to X | ![]() |
Spacing
Note that TeX handles most spacing automatically, but you may sometimes want manual control.
| Feature | Syntax | How it looks rendered |
|---|---|---|
| double quad space | a \qquad b | ![]() |
| quad space | a \quad b | ![]() |
| text space | a\ b | ![]() |
| large space | a\;b | ![]() |
| small space | a\,b | ![]() |
| no space | ab | ![]() |
| negative space | a\!b | ![]() |
Align with normal text flow
Due to the default css
img.tex { vertical-align: middle; }
an inline expression like
should look good.
If you need to align it otherwise, use <font style="vertical-align:-100%;"><math>...</math></font> and play with the vertical-align argument until you get it right; however, how it looks may depend on the browser and the browser settings.
Forced PNG rendering
To force the formula to render as PNG, add \, (small space) at the end of the formula (where it is not rendered). This will force PNG if the user is in "HTML if simple" mode, but not for "HTML if possible" mode.
You can also use \,\! (small space and negative space, which cancel out) anywhere inside the math tags. This does force PNG even in "HTML if possible" mode, unlike \,.
This could be useful to keep the rendering of formulae in a proof consistent, for example, or to fix formulae that render incorrectly in HTML (at one time, a^{2+2} rendered with an extra underscore), or to demonstrate how something is rendered when it would normally show up as HTML (as in the examples above).
For instance:
| Syntax | How it looks rendered |
|---|---|
| a^{c+2} | ac + 2 |
| a^{c+2} \, | ![]() |
| a^{\,\!c+2} | |
| a^{b^{c+2}} | (WRONG with option "HTML if possible or else PNG"!) |
| a^{b^{c+2}} \, | (WRONG with option "HTML if possible or else PNG"!) |
| a^{b^{c+2}}\approx 5 | (due to " " correctly displayed, no code "\,\!" needed) |
| a^{b^{\,\!c+2}} | ![]() |
| \int_{-N}^{N} e^x\, dx | ![]() |
| \int_{-N}^{N} e^x\, dx \, | ![]() |
| \int_{-N}^{N} e^x\, dx \,\! | ![]() |
This has been tested with most of the formulae on this page, and seems to work perfectly.
You might want to include a comment in the HTML so people don't "correct" the formula by removing it:
- <!-- The \,\! is to keep the formula rendered as PNG instead of HTML. Please don't remove it.-->
Images
The basic format for displaying an image inline is [[Image:Wiki.png|Caption text]].Available Styles
- thumbnail, thumb
- generates an automatically resized thumbnail image, normally on the right, with the caption text displayed directly underneath. An "enlarge"-icon is added. Example: [[Image:Wiki.png|thumbnail|Caption text]]
- frame
- The image will have a frame, regardless of whether it is a thumb, and the caption text will be included as a visible caption.
- right
- make the image right-aligned, can be used with and without specifying thumb
- left
- same as above, but left aligned.
- none
- The image will be rendered inline on the left, even if the thumbnail-option is set
- sizepx
- render a thumbnail version of the image that's [size] pixels wide (e.g. "150px"). Height is computed to keep aspect ratio (i.e. the shape of the image).
Vertical bars (the pipe "|" character) are used to separate options from each other and from the caption text. Unknown options are ignored and the final parameter is used as the caption text.
Variables
| Code | Effect |
|---|---|
| {{CURRENTMONTH}} | 09 |
| {{CURRENTMONTHNAME}} | September |
| {{CURRENTMONTHNAMEGEN}} | September |
| {{CURRENTDAY}} | 8 |
| {{CURRENTDAYNAME}} | Monday |
| {{CURRENTYEAR}} | 2008 |
| {{CURRENTTIME}} | 04:17 |
| {{NUMBEROFARTICLES}} | 279 |
| {{PAGENAME}} | Markup |
| {{NAMESPACE}} | Help |
| {{localurl:pagename}} | /index.php/Pagename |
| {{localurl:Wikipedia:Sandbox|action=edit}} | http://en.wikipedia.org/wiki/Sandbox |
| {{SERVER}} | http://wiki.4hv.org |
| {{ns:1}} | Talk |
| {{ns:2}} | User |
| {{ns:3}} | User_talk |
| {{ns:4}} | HvWiki |
| {{ns:5}} | HvWiki_talk |
| {{ns:6}} | Image |
| {{ns:7}} | Image_talk |
| {{ns:8}} | MediaWiki |
| {{ns:9}} | MediaWiki_talk |
| {{ns:10}} | Template |
| {{ns:11}} | Template_talk |
| {{ns:12}} | Help |
| {{ns:13}} | Help_talk |
| {{ns:14}} | Category |
| {{ns:15}} | Category_talk |
| {{SITENAME}} | HvWiki |
NUMBEROFARTICLES is the number of pages in the main namespace which contain a link and are not a redirect, i.e. number of articles, stubs containing a link, and disambiguation pages.
CURRENTMONTHNAMEGEN is the genitive (possessive) grammatical form of the month name, as used in some languages; CURRENTMONTHNAME is the nominative (subject) form, as usually seen in English.
In languages where it makes a difference, you can use constructs like {{grammar:case|word}} to convert a word from the nominative case to some other case. For example, {{grammar:genitive|{{CURRENTMONTHNAME}}}} means the same as {{CURRENTMONTHNAMEGEN}}.







![\sqrt[n]{x}](/images/math/5e4352778f3b156f05ef056f9793ec36.png)
































![\left [ A \right ]](/images/math/b85521eb6c1b3d94bc8af1ebced2e36a.png)













(WRONG with option "HTML if possible or else PNG"!)
(WRONG with option "HTML if possible or else PNG"!)
(due to "
" correctly displayed, no code "\,\!" needed)



