From J Wiki
Jump to navigation Jump to search
Publish | Overview | Markup Summary Markup Detail | Styles | Images Tables | Examples


Publish generates a PDF report, from source in plain text files in a markup language much like html.

The markup language supports calling J expressions, for example, to allow data to be read in from various sources. Apart from this, reports can be customized without knowledge of J.


A report is generated from one or more files. Since there are typically several files, each report should have its own directory. One of the files is the report master, and contains all the information needed to build the report. This file is given in the argument to the verb report, and would normally be called master.txt.

The J call would be something like:

   load 'format/publish'
   publish 'c:\mydocs\myreport\master.txt'

A desktop icon can be created that will call report with this argument. Clicking the icon will build the report.

File types are text, style, script and image:

  • text files contain the report source, and have file extension .txt. A report may be built from any number of text files, for example, one file per section. One file is included in another with the <include> tag. The master file can be simply a list of <include> tags.
  • style files contain style definitions, and have file extension .sty. For example, this might define fonts for section headers, and normal paragraphs. There is a standard set of style definitions, so that style files need only define differences from the standard.
  • scripts are normal J script files. They define J programs that can be called within the text files, inside <j></j> tags.
  • image files are bitmap, jpeg or J plot files.

Normally, the end user will work with the text and style files, and the J programmer with the script files.

File names are relative to the directory which has the master file, e.g. a file name with no path is assumed to be in the same directory as the master file.

If the directory contains a style file called master.sty or a script file called master.ijs, these are automatically loaded. This makes it easy to build and test a report from several text files, without each text file having to explicitly include any required styles or scripts.

J Programming

Since all source is plain text, it could be generated by a J program. However, text and style files would normally be created using a text editor.

In text files, J programs can be called in <j> </j> tags. The result is a character string that is inserted in the document. For example:

  <col>one two three four</col>
  <row>alpha beta</row>
  <data>2 3 5 7 ... </data>

could be coded as:

<j>gettable 'mytable.dat'</j>

where the J expression returns the required information:

   gettable 'mytable.dat'
  <col>one two three four</col>
  <row>alpha beta</row>
  <data>2 3 5 7 ... </data>

Note that the spacing and indentation shown here is for illustration only. Whitespace characters (blanks, tabs, linefeeds) are ignored when parsing the file.


In text paragraphs, bold and italic are set using <b> and <i> tags.

Hypenation is suggested using the HYPHEN character, default ~. If this is present, then a line is hyphenated on that character, if appropriate. The HYPHEN character itself is not shown in output.

Text may be wrapped in a <para> tag. This is not necessary, as text by itself is treated as paragraphs. However, <para> can be used to set a style, for example:

<para align=center>
Some text here...

Links to external files may be given as URLs in a <link> tag, for example:

For more information, see <link></link>.

Character Set

Source files are assumed to be utf-8. PDF output is in ANSI.