Difference between revisions of "Comment formatting"

From Lesswrongwiki
Jump to: navigation, search
m (Embedding images)
Line 49: Line 49:
 
==Embedding images==
 
==Embedding images==
  
To embed the Less Wrong logo:
+
For example, the following code embeds the Less Wrong logo:
  
 
<pre>![](http://lesswrong.com/static/logo_trans.png)</pre>
 
<pre>![](http://lesswrong.com/static/logo_trans.png)</pre>

Revision as of 03:00, 24 March 2012

This page describes some of the formatting options while commenting on Less Wrong. For a complete description, see Markdown syntax. Here are two sandboxes you can use to experiment.

(For the Wiki formatting rules, see Help:Formatting at MediaWiki and Help:Style_Guide#Formatting.)

Basic

  • *italics* gives italics
  • **bold** gives bold
  • [Less Wrong](http://www.lesswrong.com) gives Less Wrong

Lists are as such:

* item 1

* item 2

* item 3	

Quoted text is prefaced with an '>':

> quoted text

Putting two extra spaces at the end of a line allows to create a newline without starting a new paragraph (spaces are represented by symbol '_'):

line 1__
next line is directly below

Escaping special symbols

Special symbols, such as closing brackets or stars, may interfere with Markdown syntax. These symbols need to be escaped, that is preceded by the escape character backslash '\'.

For example, linking to the wikipedia article Bias (statistics) with the code

[bias](http://en.wikipedia.org/wiki/Bias_(statistics))

will result in incorrect rendering. This can be fixed by placing backslash '\' before the closing bracket in URL:

[bias](http://en.wikipedia.org/wiki/Bias_(statistics\))

Below is the list of all characters that may need to be escaped:

\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark

Embedding images

For example, the following code embeds the Less Wrong logo:

![](http://lesswrong.com/static/logo_trans.png)

Using LaTeX to render mathematics

LaTeX (pronounced lay-tek) is a popular interface for writing technical documents, in part because of its elegant syntax for recording mathematical equations. It's possible to use LaTeX for rendering formulas in Less Wrong comments.

Let's say, you need to render this formula: Latex example.png

First, you need to construct LaTeX code representing the formula. This can be done either by hand (Wikimedia has a guide), or using an online editor (for example, CodeCogs, mathURL). LaTeX code for the formula is as follows:

\int_a^b\frac{1}{\sqrt{x}}dx

After LaTeX code is prepared, it needs to be converted into Less Wrong comment syntax using this web app or by manually escaping special symbols (see below). The resulting code for inserting in your Less Wrong comment is as follows:

![](http://www.codecogs.com/png.latex?\int_a^b\frac{1}{\sqrt{x}}dx)

Links

LaTeX by hand

Markdown syntax, as implemented on Less Wrong, interferes with URLs for automatically generated LaTeX images given by online services (e.g. CodeCogs). LW LaTeX converter automatically takes care of this. This section describes the sources of interference, in case you are interested in the details.

Watch out for the special symbols in the above section while writing LaTeX code. For example, rendering f(x) using the following code is incorrect:

![](http://www.codecogs.com/png.latex?f(x))

The correct version is this one:

![](http://www.codecogs.com/png.latex?f(x\))

Additionally some characters (such as " " and "^") need to be URI encoded. For example, the URI encoding of " " is "%20".

\Delta t

needs

![](http://www.codecogs.com/png.latex?\\Delta%20t)