Help:Wikitext formatting

From Scholarpedia
Jump to: navigation, search

    This help page was designed as a guide for Scholarpedia authors who have no knowledge in Wikitext formatting. In it, the reader will find:

    • An introduction to Scholarwiki, the dialect of the Wikitext markup language used in Scholarpedia, and
    • An introduction to some elementary actions that authors of Scholarpedia articles should master.

    Remarks

    • This is a help page. Do not use it as an example of an encyclopedic article.
    • This page was written using advanced Scholarwiki features. The beginner is not advised to read its source code.
    • Advanced sections that can be skipped in a first read-through are marked by (*)
    • Please correct misprints or signal them to help@scholarpedia.org.

    Contents

    Introduction to Scholarwiki

    Wikitext is a markup language that was designed to be much simpler than LaTeX or HTML. Web pages in Scholarpedia, including articles, are written in a dialect of Wikitext called Scholarwiki. This dialect is similar to Mediawiki, the Wikitext dialect used in Wikipedia, and is run using open-source software that is a development branch of a version of Mediawiki. Scholarwiki and Mediawiki are not identical; some advanced features of Scholarwiki are absent in Mediawiki, and vice versa.

    To implement Scholarwiki in your article, do one or more of the following:

    1. Open an existing Scholarpedia article, e.g., Bursting, and click edit at the upper right. Inspect the article's source text (but do not click save unless you have made useful revisions to the article), and apply any relevant markups to your article.
    2. Take a look at Article Template. To use the template, just click edit and then copy and paste the source content into your article. Once you have applied the template to your article, you can change the text to suit your needs (for example, add more tags for sections, bullet points, etc., as explained below).
    3. Read the sections and subsections below that are relevant to your article.

    (Note: If you would like to use LaTeX, you can find a simple LaTeX to Wikitext converter here. It uses context replacement to change LaTeX math environments to <math>...</math> brackets, but see also Including math below.)

    Text formatting

    Sections and subsections

    • To create a section title, type == Section title == in a new line.
    • To create a subsection title, type === Subsection title === in a new line.
    • To create a subsubsection title, type ==== Subsubsection title ==== in a new line.

    Use sentence-style capitalization for section and subsection titles. Separate paragraphs within each section with a white line.

    For articles containing three or more sections, a table of contents will be generated automatically.

    Further reading: http://www.mediawiki.org/wiki/Help:Formatting.

    Paragraphs, white space and indentation

    • New paragraphs are not indented by default. To indent a new paragraph, start it with :, ::, or :::, depending on the desired indentation.
    • If the first character of a new paragraph is a white space, you get a colored box useful for source code. Be careful. Starting a new paragraph with an unwanted white space is a common error.
    This line started with a space. Note the different font and background color.
    
    • A source code box can also be obtained by using the <pre> tag. For example, if you type <pre> a=1; b+=a;</pre>, you get
     a=1; b+=a;
    • Paragraphs and other structures are separated by white lines. Contrary to LaTeX, the more white lines you leave, the more vertical space is skipped.
    • To force a line break without leaving a white line, type </br>.
    • White space within a line is not semantically relevant: you type a b c you get a b c
    • To add a comment in your wikitext that should not be shown, type <!-- --> with your comment between the two sets of dashes.

    Bulleted lists

    To create a bulleted list, insert an asterisk (*) at the start of each line. For indented bullets, insert two, three, etc. asterisks at the start of each line. For example:

    You get... When you type...
    • one
    • two
    • three
      • three.one
      • three.two
      • three.three
        • three.three.one
        • three.three.two
        • three.three.three

    this is the end of the list

    * one
    * two
    * three
    ** three.one
    ** three.two
    ** three.three
    *** three.three.one
    *** three.three.two
    *** three.three.three
    this is the end of the list
    

    Further reading: http://meta.wikimedia.org/wiki/Help:List.

    Numbered lists

    To create a numbered list, insert a number sign (#) at the start of each line. For subitems, insert two, three, etc. number signs at the start of the line. For example:

    You get... When you type...
    1. one
    2. two
    3. three
      1. three.one
      2. three.two
      3. three.three
        1. three.three.one
        2. three.three.two
        3. three.three.three

    this is the end of the list

    # one
    # two
    # three
    ## three.one
    ## three.two
    ## three.three
    ### three.three.one
    ### three.three.two
    ### three.three.three
    this is the end of the list
    

    Further reading: http://meta.wikimedia.org/wiki/Help:List.

    Bold and italics

    • To produce bold text, type either '''bold text''' or <b>bold text</b>.
    • To produce italic text, type either ''italic text'' or <i>italic text</i>.
    • To produce bold+italic text, type either '''''bold+italic text''''' or <b><i>bold+italic text</i></b>.

    Use bold for definitions and italics for emphasis. For example, "... Washington, DC is the capital of the USA. Do not confuse it with the state of Washington..."

    Use <strong>...</strong> brackets at the top of the article when you define your main topic. This improves your article’s classification in Google PageRank and its placement in Google (and other search engine) results.

    Further reading: http://www.mediawiki.org/wiki/Help:Formatting.

    Subscripts and superscripts

    • To make text appear as subscript, use the <sub> </sub> brackets. For example, I<sub>Ca</sub> appears as ICa.
    • To make text appear as superscript, use the <sup> </sup> brackets. For example, Ca<sup>2+</sup> appears as Ca2+.

    Links

    A link is a tool used to redirect the reader's browser elsewhere in Scholarpedia (internal link) or to a web page external to Scholarpedia (external link). The link is usually designated by underlined blue text, which the reader must click in order to be redirected.

    In Scholarwiki, there are three main types of links: automatic internal links, user-defined internal links, and external links.

    Automatic internal links

    If you write a sequence of words that matches the title of an existing Scholarpedia article, the autolinker tool will create an automatic internal link to that article. The autolinker tries to match the longest title first. For example, the phrase "using attractor reconstruction method" will result in an autolink to the article on attractor reconstruction rather than to the article on attractor.

    The autolinking feature can be very useful, but in some cases it could redirect to an existing article that has nothing to do with your subject. If this happens, please inform your editor, and he will create a disambiguation page to deal with the conflicting topics.

    You can control the autolinking process by inserting the following text anywhere in the article:

    __AUTOLINKER{n|title to exclude 1|title to exclude 2|...|title to exclude N} 
    

    The first argument, a non-negative integer n, limits the number of autolinks to any particular title. The other arguments, separated by the pipe "|", are the titles of the articles that should be excluded from the autolinking process. Using this code will create links for all first matches of titles apart from "title to exclude 1," "title to exclude 2," etc. This code may be useful in an article on, for example, gamma ray bursts, where autolinks to neuronal bursting would not be desirable.

    To turn off the autolinker, place the following line anywhere in the article:

    __AUTOLINKER{0}
    

    The default state is __AUTOLINKER{1}, i.e., only the first match for any title is converted to a link to this title.

    User-defined internal links

    • Only make internal links on the first reference to a term in a paragraph, as if to provide, or remind your readers of, the definition of the term.
    • If the target page exists, the text is shown in blue or violet. If the page does not exists, the text is rendered in red (broken link).
    • If when writing your article you feel that some correlated articles are necessary but do not exist, create a user-defined link to each article you need. The editors will see the broken links and try to invite authors for those articles.
    • A link to the section "my section" of some page is obtained by using: [[Title of the target page#my section| text to be shown]] or [[Title of the target pagee#my section]]. If the section does not exist, the link is to the top of the page.
    • An in-page link to "my section" is obtained by [[#my section| text to be shown]] or by [[#my section]].


    You get... When you type...

    Nice reference: here.

    Nice reference: [[Main page| here]].

    Nice reference: Main page.

    Nice reference: [[Main page]].

    Nice reference: Main poge.

    Nice reference: [[Main poge]].

    Nice reference: here.

    Nice reference: [[Main page#Curatorship| here]].

    Nice reference: Main page#Curatorship.

    Nice reference: [[Main page#Curatorship]].

    In-page link to section figures.

    [[#Figures | In-page link to section figures]]

    In-page link to section figures: #Figures.

    In-page link to section figures: [[#Figures]].

    External links

    It is often helpful to provide relevant external links at the end of your article. To create an external link, use one of the following syntaxes:

    You get... When you type...

    The best reference is Scholarpedia.

    The best reference is [http://www.scholarpedia.org Scholarpedia].

    The best reference is [1].

    The best reference is [http://www.scholarpedia.org].

    The best reference is http://www.scholarpedia.org.

    The best reference is http://www.scholarpedia.org.

    User-defined anchors (*)

    The code <span id="mylabel">blabla</span>, resulting in blabla , creates an invisible "anchor" with label "mylabel" in correspondence of the text "blabla" (i.e. the text "blabla" becomes linkable). You can can create a link to an anchor with label "mylabel" in some Scholarpedia page named "mypage" by using the code [[mypage#mylabel| some text]]. The code [[#mylabel| some text here]] creates a link towards an anchor with label "mylabel" in the same page. Coming back to previous example, the code [[#mylabel| link to blabla ]] gives link to blabla .

    When creating a reference with the Scholarwiki template Bibitem, see the section #Writing references, the parameter label=mylabel automatically inserts in the reference an anchor with label "mylabel".

    Math formulae

    To include math formulae, write your LaTeX expression and surround it with the beginning and ending markers as described below.

    Do not use HTML tags for math equations, even simple ones. In the future, Scholarpedia will feature a Wikitext->LaTeX->pdf converter, so formatting all equations in LaTeX will result in more consistent texts.

    Inline math

    For inline math, you can use

    • \( ... \) , or
    • <math> ... </math>

    Thus \( \frac{3}{2} < 2\lambda \), and can be inserted

    • \(\frac{3}{2} < 2\lambda\) , or
    • <math> \frac{3}{2} < 2\lambda </math>

    Display math

    "Display", or centered, math can be wrapped using:

    • \[ ... \], or
    • :<math> ... </math>

    Thus

    \[ f(x) = \lim_{T \rightarrow \infty} \frac{1}{T} \int_0^T g(x, t) \, dt \]
    

    and

    :<math>f(x) = \lim_{T \rightarrow \infty} \frac{1}{T} \int_0^T g(x, t) \, dt</math>
    

    both result in \[ f(x) = \lim_{T \rightarrow \infty} \frac{1}{T} \int_0^T g(x, t) \, dt \]

    Adding a text label for your equation within the math tag, numbers the equation and makes it easier to reference in your text. For example,

    \[ \label{mass_energy} e=mc^2 \]
    

    results in a number on the left of the equation: \[ \tag{1} E=mc^2 \]

    To refer to equation (1), write "equation \eqref{mass_energy} ".

    Because Scholarpedia uses the insanely powerful MathJax, nearly all Plain TeX Math macros are supported. For more details, visit the MathJax \(\TeX\) documentation

    For short bits of text, you can use an online LaTeX to Wikitext converter. To preview your Wikitext (without saving the draft copy), open your article for editing, copy and paste your text, and then click preview. Save your text only after removing the extra LaTeX commands.

    Mathematics, Latex and Scholarwiki

    Because Scholarpedia uses the insanely powerful MathJax, nearly all Plain TeX Math macros are supported. Many ---but not all--- LaTeX and AMSLaTeX features are supported, see [2] for detailed list. For more details, visit the MathJax \(\TeX\) documentation.

    Standard Latex code for a formula should be inserted in a <math> tag.

    You Get You Type

    An in-line formula\[ \partial_z x^{2 y} \], end of the phrase. Another in-line formula: \( \partial_z x^{2 y} \), end of the phrase.

    An in-line formula: <math> \partial_z x^{2 y}  </math> , end of the phrase.
    Another in-line formula: \( \partial_z x^{2 y}  \), end of the phrase.

    A displayed equation\[ \partial_z x^{2 y}, \]

    end of paragraph.

    A displayed equation:
    
    <math> \partial_z x^{2 y}, </math>
    
    end of paragraph.
    

    An indented displayed equation:

    \[ \partial_z x^{2 y}. \]

    Use ::,::: to have more indentantion.

    An indented displayed equation:
    
    :<math> \partial_z x^{2 y}.  </math>
    
    Use ::,::: to have more indentantion.
    

    An indented displayed equation:

    \[\partial_z x^{2 y}.\]

    Use ::,::: to have more indentantion.

    An indented displayed equation:
    
    \[\partial_z x^{2 y}.\]
    

    An indented numbered equation:

    \[ \tag{2} \partial_z x^{2 y}. \]

    Equation (2).

    An indented numbered equation:
    
    \[ \label{mynicelabel} \partial_z x^{2 y}. \]
    
    Equation \eqref{Mynicelabel}.<!-- FIX to show \eqref{mynicelabel} needed --->
    


    To get a group of vertically aligned unlabeled equations (or a multi-line unlabeled equation) use the LaTeX array environment inside the usual <math> environment or simply the AMSMath align environment. Add labels to get numbered equations like (3), (4), (5).

    You get You Type

    \( \begin{array}{lcl} f(n+1) & = & (n+1)^2 \\ & = & n^2 + 2n + 1 \end{array} \)

    :<math>
    \begin{array}{lcl}
     f(n+1) & = & (n+1)^2 \\
     & = & n^2 + 2n + 1 
    \end{array}
    </math>
    

    \begin{align} e^{\mathrm{i} z} &= \cos(z)+\mathrm{i}\sin(z) \\ \sin(z) &= \int_0^z\!\mathrm{d}x \cos(x) \end{align}

    \begin{align} 
    e^{\mathrm{i} z} &= \cos(z)+\mathrm{i}\sin(z) \\ 
    \sin(z) &= \int_0^z\!\mathrm{d}x \cos(x)  
    \end{align}
    

    \begin{align} e^{\mathrm{i} z} &= \cos(z)+\mathrm{i}\sin(z) \tag{3}\\ \sin(z) &= \int_0^z\!\mathrm{d}x \cos(x) \tag{4} \end{align}

    \begin{align} 
    e^{\mathrm{i} z} &= \cos(z)+\mathrm{i}\sin(z) \label{exp}\\ 
    \sin(z) &= \int_0^z\!\mathrm{d}x \cos(x)  \label{sin}
    \end{align}
    

    \begin{align} x^2&= f'''(z)\tag{5}\\ &= \frac{\mathrm{d}}{\mathrm{d}t}\left(x^{y^{z^t}}\right)\\ &= \sin(f(z))+J(z) \end{align}

    \begin{align}
    x^2&= f'''(z)\label{fun}\\ 
       &= \frac{\mathrm{d}}{\mathrm{d}t}\left(x^{y^{z^t}}\right)\\ 
       &= \sin(f(z))+J(z)
    \end{align}
    

    Further reading: http://www.scholarpedia.org/article/Help:Math.

    Figures

    Step 1. To include a figure in an article, type the placeholder [[Image:filename.ext]] in the text where you want the figure to appear (Here, filename.ext is the name of your image file). Use a unique name for your image filename, consisting of the title of your article and some other text to avoid overwriting someone else's figure. Keep in mind that if you later want to create an internal reference to the figure/image you must not include any spaces in the filename (so "Bursting Examples.gif" becomes "Bursting_Examples.gif").

    Accepted file formats include gif, jpg, and png, with a file size of 2MB or less (the figure below is only 12K). To convert images, see next section.

    Step 2. After you save your text, a red link appears (where you put your placeholder [[Image:...]]). Clicking the link prompts you to upload the figure file. Click the link and follow the on-screen instructions to upload your image.

    Step 3. Figures in Scholarpedia are numbered automatically; if you need to refer to them, you can create a label, see below.

    Avoid complicated figures with sub-figures and long captions. The following format is probably the most common for figures; It is used to include the figure below.

    [[Image:Bursting_Examples.gif|thumb|400px|right|This figure is less than 12K]]
    
    Figure 1: This figure is less than 12K

    The Wikitext above creates a smaller version of the image (size 400px), frames it, puts it on the right-hand side and places a brief caption beneath it. The remainder of the text flows nicely around the frame. See Wikipedia picture tutorial for more information. To cite/refer to Figure 1 in the text, write:

    <figref>Bursting_Examples.gif</figref>

    If you reproduce a figure from an article in a journal, it is probably protected by the copyright. You need to obtain permission to reproduce the figure from that journal. (Note: Permission is required even when reproducing a copyrighted figure on your website.)



    You can insert figures as follows.

    You Get You Type

    aaaa aaa aaa.

    Figure 2: Upload the file and replace this figure. See Upload page

    bbb bbb bbb.

    ccc ccc ccc.

    ddd ddd ddd.

    eee eee eee.

    fff fff fff.

    ggg ggg ggg.

    hhh hhh hhh.

    iii iii iii.

    jjj jjj jjj.

    kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk.

    aaaa aaa aaa.
    
    [[Image:Your_article_title_Main_figure.gif|thumb|300px|right|
         Upload the file and replace this figure. 
         See [http://www.scholarpedia.org/article/Special:Upload Upload page]]]
    
    bbb bbb bbb.
    
    ccc ccc ccc.
    
    ddd ddd ddd.
    
    eee eee eee.
    
    fff fff fff.
    
    ggg ggg ggg.
    
    hhh hhh hhh.
    
    iii iii iii.
    
    jjj jjj jjj.
    
    kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk kkk.
    

    Remarks:

    • You can cite figure Figure 2 by writing <figref>Your_article_title_Main_figure.gif</figref>. (I.e. figures are labeled by the corresponding file name.)
    • The figure is vertically aligned to the text that follows it.
    • If the file is not uploaded, Scholarpedia will create a red link directing you to the upload page.

    Further reading: http://www.mediawiki.org/wiki/Help:Images and http://en.wikipedia.org/wiki/Wikipedia:Extended_image_syntax.

    Converting image formats

    You may need to convert your images into another format. PNG is the recommended file format for static images, although JPEG and GIFs are also accepted, among some others. Postscript and PDF files are not accepted formats for images.

    ImageMagick is helpful for converting images. You can use a command such as:

    mogrify -density 200 -flatten -format png *.ps
    

    Tables (*)

    Compare, learn and generalize.

    Table 123: International system of units (SI)
    Fundamental units
    Physical quantity Name Symbol
    length meter m
    time second s
    mass kilogram Kg
    electric current ampere A
    luminous intensity candela cd
    mass kilogram Kg
    amount of substance mole mol
    temperature kelvin K


    {| align="center"
       width="100%"
       border="5" 
       frame="hsides" 
       rules="all" 
       cellpadding="10" 
       cellspacing="10" 
       style="caption-side:bottom;"
    |+ style="font-style: italic" | <span id="Table_123_label">Table 123:</span> International system of units (SI)
    |-
    ! colspan="3" | '''Fundamental units'''
    |-
    ! Physical quantity
    ! Name
    ! Symbol
    |-
    | length
    | meter
    | m
    |-
    | time
    | second
    | s
    |-
    | mass
    | kilogram
    | Kg
    |-
    | electric current
    | ampere
    | A
    |-
    | luminous intensity
    | candela
    | cd
    |-
    | mass
    | kilogram
    | Kg
    |-
    | amount of substance
    | mole
    | mol
    |-
    | temperature
    | kelvin
    | K
    |}
    

    The same table can be obtained by using XHTML.

    Table 124: International system of units (SI)
    Fundamental units
    Physical quantity Name Symbol
    length meter m
    time second s
    mass kilogram Kg
    electric current ampere A
    luminous intensity candela cd
    amount of substance mole mol
    temperature kelvin K
    <table width="100%" 
           border="5" 
           frame="hsides" 
           rules="all" 
           cellpadding="10" 
           cellspacing="10" 
           style="caption-side:bottom;">
    <caption style="font-style:italic">  <span id="Table_124_label">Table 124:</span> International system of units (SI) </caption>
    <tr>  <th colspan="3"> '''Fundamental units''' </th>                           </tr> 
    <tr>  <th>Physical quantity</th>      <th>Name</th>           <th>Symbol</th>  </tr>
    <tr>  <td> length </td>               <td>meter</td>          <td>m</td>       </tr>
    <tr>  <td> time </td>                 <td>second</td>         <td>s</td>       </tr>
    <tr>  <td> mass </td>                 <td>kilogram</td>       <td>Kg</td>      </tr>
    <tr>  <td> electric current </td>     <td>ampere </td>         <td>A</td>      </tr>
    <tr>  <td> luminous intensity </td>   <td>candela</td>        <td>cd</td>      </tr>
    <tr>  <td> amount of substance </td>  <td>mole</td>           <td>mol</td>     </tr>
    <tr>  <td> temperature </td>          <td>kelvin</td>         <td>K  </td>     </tr>
    </table>
    


    Cite Table 123 by writing [[#Table_123_label|Table 123]], and cite Table 124 by writing [[#Table_124_label|Table 124]].

    Further reading: http://www.mediawiki.org/wiki/Help:Tables.

    Please read Wikipedia help to learn how to produce tables in Wikitext.


    Other media

    Movies

    The best way to include a movie is to make an animated .gif file, as in Synchronization. Such an animation does not require readers to install any additional software for viewing and even runs on cell phones and iPods. Other (less desirable) supported movie formats include avi, mpeg, mpg, mov. Please keep movie files to less than 1 MB.

    Note: Animated .gif files are included in the same manner as normal .gif files (i.e., [[Image:Animation.gif|thumb|400px|right|F2|This figure is animated]]).

    To include a movie file in your article, type:

    [[Media:myvideofile.avi]]

    To include flash movies, type:

    <flash>file=PinnaIllusion3.swf|width=500|height=500|quality=best</flash>

    which produces:

    mp3 files

    To include an mp3 file into your article, type:

    [[Media:myaudiofile.mp3]]

    which produces:

    Media:myaudiofile.mp3

    If the file is not already uploaded, Scholarpedia will create a red link in the text. Clicking on this link will take you through the process of uploading the file for inclusion in your article.

    Java applets

    See detailed instructions on how to include Java applets.


    Mediawiki syntax (*)

    Mediawiki and Scholarwiki markup languages are quite rich. They admit:

    • MediaWiki tokens: i.e. symbols like =,----,=#...Their meaning is position dependent.
    • MediaWiki "magic words": like __NOTOC__.
    • MediaWiki links: like [[Instructions for authors|text]].
    • MediaWiki templates: like {{templateName|p1|p2|p3}} where templateName is the name of the template and p1,p2,p3 its parameters,separated by the pipe "|" .
    • MediaWiki variables: like {{templateName}} are templates with no arguments
    • MediaWiki parser functionslike {{functionName:variable}}
    • XHTML symbols like &SymbolName; with SymbolName=hearts (♥),Psi (Ψ), euro (€), amp (&)...
    • XML tags like <Tag> ... </Tag> with Tag=nowiki,math,...
    Personal tools
    Namespaces

    Variants
    Actions
    Navigation
    Focal areas
    Activity
    Tools