Goto Chapter: Top 1 2 3 4 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

1 Introduction
 1.1 Core Framework Functions
 1.2 Core Operations
 1.3 Constants and Utility Functions

1 Introduction

1.1 Core Framework Functions

typeset is a package that implements a typesetting framework that can be implemented for numerous typesetting languages as a standardised way to generate renderable strings.

At it's core, it implements the function Typeset (1.1-2) which makes use of typesetting language-specific functions to generate format strings. These strings are then populated with a list of the semantic features of the GAP objects they represent, which is obtained from the operation GenArgs (1.2-1).

An example implementation of this framework is also provided by this package for LaTeX typesetting within chapter 2.

Guidelines for extending the framework to support more types, or for implementing the framework for another typesetting language can be found within the contributing guidelines in the GitHub repository.

1.1-1 InfoTypeset
‣ InfoTypeset( info class )

Info class for the typeset package. Set this to the following levels for different levels of information:

Set this using, for example SetInfoLevel(InfoTypeset, 1). Default value is 2.

1.1-2 Typeset
‣ Typeset( obj[, options] )( function )

Returns: A String, if ReturnStr option is set to true

Generates a mark-up string representing the object obj in the given mark-up language. GAP options can also be added to modify the result:

gap> Typeset([[1, 2], [2, 1]] : LDelim := "[", ReturnStr := true);
"\\left[\\begin{array}{rr}\n1 & 2 \\\\\n2 & 1 \\\\\n\\end{array}\\right)\n"

or wrapping them in a record under an options GAP option, like:

gap> Typeset([[1, 2], [2, 1]] : options := rec(LDelim := "[", ReturnStr := true));
"\\left[\\begin{array}{rr}\n1 & 2 \\\\\n2 & 1 \\\\\n\\end{array}\\right)\n"

or even simply passing a record object as the optional second argument:

gap> Typeset([[1, 2], [2, 1]], rec(LDelim := "[", ReturnStr := true));
"\\left[\\begin{array}{rr}\n1 & 2 \\\\\n2 & 1 \\\\\n\\end{array}\\right)\n"

1.1-3 TypesetInternal
‣ TypesetInternal( obj )( function )

Returns: A String

Generates a string representation of a passed GAP object obj that can be rendered by a typesetter. Called from the top-level method Typeset (1.1-2), which also passes a constructed options record as the options GAP option.

1.2 Core Operations

1.2-1 GenArgs
‣ GenArgs( obj )( operation )

Returns: A List of Strings

Generates the arguments describing the semantic definition of the passed GAP object obj. This returns a list that can be used to populate a format string in any mark-up language. If no method is installed for a type, it will fallback to returning the list [ ViewString(obj) ].

1.3 Constants and Utility Functions

1.3-1 MergeSubOptions
‣ MergeSubOptions( opts )( function )

Returns: A Record

Merges the passed options record opts to change any values that are set in the GAP option SubCallOpts. If this option is not false (default), it can contain a record of any GAP options that can be passed to Typeset (1.1-2) which should differ for sub-calls.

For example, to alter the delimiters for nested objects so that the outer object is delimited by square braces and the inner object by parentheses, the following can be set:

gap> MergeSubOptions(rec(ReturnStr := false, Lang := "latex", DigraphOut := "dot", RDelim := "]", LDelim := "[", SubCallOpts := rec(RDelim := ")", LDelim := "(")));
rec(ReturnStr := false, Lang := "latex", DigraphOut := "dot", RDelim := ")", LDelim := "(", SubCallOpts := false)

It should be noted that SubCallOpts only changes the options for one level of recursion (i.e. it is set back to the default of false once this function is called). To change options for more recursion levels, the SubCallOpts option can be nested as many times as necessary.

‣ DEFAULT_TYPESET_OPTIONS( global variable )

Default options record passed to Typeset (1.1-2). Merged with user-provided options to ensure correct construction of options for sub-calls, whilst also allowing option-less calls to the method.

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 Ind

generated by GAPDoc2HTML