This site is supported by donations to The OEIS Foundation.

Template:Nl

From OeisWiki
Jump to: navigation, search

The {{nl}} (newline) typographical template inserts newlines.

Usage

To get a single new line:

{{nl}} or {{nl|htm}} (default)

or

{{nl|tex}}

where the parameter is taken from

  • htm (default): to get the HTML+CSS <br /> (line break);
  • tex: to get the TeX/LaTeX \\ command (you may use this template within the {{math}} template, but not within the <math>...</math> element).

To get a specified number of new lines:

{{nl|real number}} or {{nl|real number|htm}} (default)

or

{{nl|nonnegative integer|tex}}

where the first parameter (real number for HTM+CSS; only nonnegative integer for LaTeX) is the number of new lines wanted; and the second parameter is taken from

  • htm (default): to get the HTML+CSS <br /> (line break);
  • tex: to get the TeX/LaTeX \\ command (you may use this template within the {{math}} template, but not within the <math>...</math> element).

Tests

Comparison test
The code
<span style="background: #f2f2f2;">Read on {{nl|1.5}}{{nl|1.5}} 3 lines below.</span>
yields
Read on

3 lines below.
The code
<span style="background: #f2f2f2;">Read on {{nl|3}} 3 lines below.</span>
yields
Read on


3 lines below.

Examples

Examples with nonnegative number of new lines

The code

<span style="background: transparent;">0000000000{{nl|0}}XXXXXXXXXX</span>

yields (equivalent to CR without LF)

0000000000
XXXXXXXXXX

The code

<span style="background: #f2f2f2;">Read on{{nl}}the next line.</span>

yields

Read on
the next line.

The code

<span style="background: #f2f2f2;">Read on{{nl|htm}}the next line.</span>

yields

Read on
the next line.

The code

<span style="background: #f2f2f2;">Read on{{nl|1|htm}}the next line.</span>

yields

Read on
the next line.

The code

<span style="background: #f2f2f2;">Read on{{nl|1}}the next line.</span>

yields

Read on
the next line.

The code

<span style="background: #f2f2f2;">Read on{{nl|1.5}}1.5 lines below.</span>

yields

Read on
1.5 lines below.

The code

<span style="background: #f2f2f2;">Read on{{nl|2}}2 lines below.</span>

yields

Read on

2 lines below.

The code

<span style="background: #f2f2f2;">Read on{{nl|1.5}}{{nl|1.5}}3 lines below.</span>

yields

Read on

3 lines below.

The code

<span style="background: #f2f2f2;">Read on{{nl|3}}3 lines below.</span>

yields

Read on


3 lines below.

The code

<span style="background: #f2f2f2;">Read on{{nl|4}}4 lines below.</span>

yields

Read on



4 lines below.

The code

: {{math|

\sgn(x) {{sym|def|tex}}
\begin{cases}
  -1 & \text{if } x < 0, {{nl|tex}}
   0 & \text{if } x {{=}} 0, {{nl|tex}}
  +1 & \text{if } x > 0. 
\end{cases}

|$$}}

yields

The code

: {{math|

\sgn(x) {{sym|def|tex}}
\begin{cases}
  -1 & \text{if } x < 0, {{nl|2|tex}}
   0 & \text{if } x {{=}} 0, {{nl|2|tex}}
  +1 & \text{if } x > 0. 
\end{cases}

|$$}}

yields

Examples with negative number of new lines

The code

<span style="background: #f2f2f2;">{{nl}}Read on {{nl|-1}} -1 lines below.{{nl|2}}</span>

yields


Read on
-1 lines below.

The code

<span style="background: #f2f2f2;">{{nl|1.5}}Read on {{nl|-1.5}} -1.5 lines below.{{nl|2.5}}</span>

yields


Read on
-1.5 lines below.

The code

<span style="background: #f2f2f2;">{{nl|2}}Read on {{nl|-2}} -2 lines below.{{nl|3}}</span>

yields



Read on
-2 lines below.


Examples with invalid input

The code

<span style="background: #f2f2f2;">Read on {{nl|four}} four lines below.</span>

yields

Read on Expression error: Unrecognized word "four".Expression error: Unrecognized word "four".Expression error: Unrecognized word "four". four lines below.

See also

  • {{nbsp}} (6 mu no-break space, i.e. 6/18 of a quad space, or 1/3 em ≈ 0.33333em) (formally known as: non-breaking space)
  • {{thinsp}} (3mu space, i.e. 3/18 of a quad space, or 1/6 em ≈ 0.16667em)
  • {{sp}} (to get a space of a specified width)


  • {{nl}} (new line)