Qs: Quickscript

What is Quickscript?

Qs (Quickscript) is a PostScript text formatting and typesetting program. Its main use now is to assist in preparing PDF documents. Originally it was intended to execute within a PostScript printer where it interpreted explicit layout marks to control the appearance of the printed output, independent of the source of the document. Now it is used with a PostScript interpreter such as Ghostscript which is capable of creating a PDF file, by reading Qs and the document file as a single stream of input.

Qs uses explicit layout marks in a similar way to web pages using HTML layout marks, but with a different instruction set. The marks give good precision of control over output. It is possible to create documents that modify the Quickscript program during execution, and it is very easy to include other PostScript programs or fragments with Quickscript. It is possible to use any PostScript fonts or include graphics generated from a variety of sources. It can be convenient to use Qs in web scripts for formatting output from a web database into PDF documents for distribution and to allow customers to store web output.

To use Quickscript, create a file containing text and explicit layout marks as described in the instruction manual. Concatenate Qs with your document and process this with Ghostscript, either to view on your computer, or to convert to PDF with ps2pdf. Ghostscript can be obtained from ghostscript.com.

Where is Quickscript found?

Quickscript is a remarkably short PostScript program. It is described in an instruction manual. There are other PostScript fragments that are useful with it, and a C program, all of which are described in the next section. They are all packaged into a tar file or a zip file.

If you need to make changes to Quickscript, there is a brief description of how Quickscript works.

What are the individual files?

The following files are provided in the Qse.jar file, Quickscript.tar.gz, Quickscript.zip, and individually in the qsdir directory:
Quickscript program (PostScript)

The instruction manual.

The PostScript fragment to modify Quickscript to rotate every page by 90 degrees, with the page length and height interchanged. The effect will usually be to convert portrait output into landscape mode.

Similar to rotate.qs, this will rotate the page by -90 degrees, ie. in the opposite direction to rotate.qs, again exchanging the page height and length values. It is possible to use this to undo a previous rotation.

Example PostScript routine to modify Quickscript adding a border to each page.

The PostScript fragment to modify the character encodings of the standard PostScript fonts so that western European characters are available using the correct ISO character codes. This differs from the standard ISOLatin1Encoding in that typesetting characters like ellipsis, trademark, florin, dagger, bullet which are not included in the ISO set are also provided.

The PostScript fragment to modify the character encodings of the standard PostScript fonts so that they use an ISO-Latin-2 encoding vector. Composite characters are created from the accent marks and the base characters.

A PostScript fragment to modify the character encodings so that Celtic characters can be drawn. Contributed by Derek McKay, and modified by G. Freeman.

The PostScript routine to change the Quickscript behaviour to alternate page numbering from left to right side of page.

The PostScript routine to change the position of page numbers so that they will be centred at the top of the page.

2col.qs, 3col.qs
Print the document on a landscape page in two or three columns, suitable for producing a simple leaflet.

Print the document in two columns suitable for folding as a simple leaflet. The paper will need to be trimmed at the trim marks.

Print the document on a portrait page in three narrow columns, using Courier font and No-Fill mode, printing the text exactly as it is in the file.

2p.qs, 2pend
Print the document two pages per sheet, side-by-side. File "2pend" should be concatenated to the end of the document to ensure that nothing is missing from the last page.

Example of how macros can be used with catex. This example shows how to set up a structured document containing sections, dot-lists, and hanging first line lists which can be embedded.

A version of the UNIX "cat" command that concatenates several files into one and writes it to standard output. This version examines the content of every file, looking for the string "%include file-name%". The file ("file-name" in this example) will be included at the point it is referred to. This file may itself have references to other files which must be included. The file-name is interpreted as a path relative to the path of the file which referred to it, so will be in the same directory unless it is given as an absolute path (beginning with '/') or begins with '../', which will be interpreted in the UNIX fashion.

This is a useful tool with Quickscript since it removes the necessity for including the above PostScript pieces explicitly in every document that uses them. It also enables PostScript drawing instructions for externally prepared diagrams to be held as separate files, rather than being embedded within the document where they will ultimately appear. If the included file is modified, the whole document will automatically reflect the change when next printed.

An alphabetical list of the Quickscript layout marks.

A categorized list of the Quickscript layout marks.

A description of how Quickscript works, which would be useful if you wanted to make changes to Quickscript.

The codes needed to output some special characters, such as from non-English languages or symbols commonly found in fonts.

Quickscript has always been free for personal use, with a licence available from the author for commercial use. Since the October 2005 release, it may now be used freely by anyone. No payment is expected, and although every effort has been made to remove errors, no legal liability is taken for any loss or damage that may be incurred from its use. Qs may be freely modified as long as the copyright notice within is retained intact.

Graham Freeman
20 October 2016