# Style Guide

### J Wiki Style Guide

The following are guidelines for styling J wiki pages.

1. Definitions and executed examples should be in <pre></pre> tags.

If the example is just a list of definitions, they should written as in a script, and usually flushed left. Otherwise, definitions and sentences executed should be indented 3 spaces, and output shown as in the terminal. Where possible, align comments vertically for greater readability. Examples:

rnd=: ?@#&0             NB. random numbers in range (0,1)
cumwts=: +/\ % +/       NB. cumulative weights

   rnd=: ?@#&0
rnd 5
0.5377 0.06353 0.7059 0.5188 0.8832


2. J code and names in ordinary text should be wrapped in <tt></tt> tags. If the J code has wiki markup, then also use the nowiki tag, i.e. wrap in the pair of tags:

<tt><nowiki></nowiki></tt>.

Do not use the <tt></tt> tags for non-J code, as this can be confusing. In particular, mathematical expressions should be written in plain ascii or in Latex. For example, the following sentence has mathematical and J expressions:

The J equivalent of cos(x) + i sin (x) is (cos x) + i * sin x.

3. In text, words being defined may be italicized, but otherwise avoid highlighting text with italics, bold and underscore. The Wiki is more readable without fussy formatting.

4. Use wiki markup wherever appropriate (e.g. for lists and tables), rather than raw html or inventing your own. Tables are best in wikitable style, e.g.

{| class="wikitable"
|-
| cell11
| cell12
|-
| cell21
| cell22
|}


becomes:

cell11 cell12
cell21 cell22

5. A colon at the beginning of a line indents it, otherwise use &nbsp; for spacing:

: <tt>?</tt> (deal) &nbsp; <tt>{:</tt> (take) &nbsp; <tt>#</tt> (copy) &nbsp; <tt>I.</tt> (interval index)

becomes:

? (deal)   {: (take)   # (copy)   I. (interval index)

6. With LaTeX, where appropriate use a math display style of inline or block, i.e. <math display="inline"> or <math display="block">, for example:

This expression uses the inline style: ${\textstyle \sum _{i=0}^{\infty }2^{-i}}$

This uses the block style:

${\displaystyle \sum _{i=0}^{\infty }2^{-i}}$