Labs/Lab Commands

From J Wiki
Jump to navigation Jump to search
Labs | Basic Usage | The lab Verb | Script Layout | Lab Commands | Deprecated Commands | Migration

Lines of the form NB.labCMD:ARG are lab commands, where CMD is the command name and is followed by a colon, and ARG is an optional argument.

Commands are:

  • hr    displays a horizontal rule
  • html    displays the rest of the line as html (where possible)
  • latex    displays the rest of the line as LaTeX (where possible)
  • chapter    starts a new chapter

In addtion, there are two deprecated commands:

  • prepare    indicates a prepare code block
  • script    indicates a script block

For example, the following:

NB.labhr:
NB.labhtml:<div><font style="color:red;font-style:italic;">html, latex, and plots can be included</font></div>
NB.lablatex:\frac{1+\sin(x)}{x^3}

will generate output:


html, latex, and plots can be included

Note that the html and latex commands are currently supported only in JHS.

Chapters

A chapter is indicated by a chapter command followed by a name:

NB.labchapter:install

These are displayed as you step through the lab, but you can also jump to a section:

   lab ':'             NB. list sections
lab':intro'
lab':install'
lab':usage'

   lab':install'       NB. run one of the above lines to jump to the section
Chapter: install