Common Lisp Package: LATEX-TABLE

README:

FUNCTION

Public

EXPAND-TO-VECTOR (LENGTH POSITION-VALUE-PAIRS &OPTIONAL INITIAL-ELEMENT)

Construct a vector of given LENTH from (position . value) pairs. Negative positions are counted from the end of the vector (eg -1 is for the last element), while a position T sets all elements.

LABELED-VERTICAL (LABELS VALUES &KEY (LABELS-COLUMN LEFT) (VALUES-COLUMN RIGHT) HEADER?)

Create a table labeling a vector as a vertical column. When HEADER? is set, the top cells are treated as headers and centered, except when HEADER? is 'MULTICOLUMN, which centers it across the two columns.

TABLE (CELLS &KEY (COLUMN-TYPES RIGHT) (RULES '((0 . TOP) (-1 . BOTTOM))))

Construct a table with the given CELLS, COLUMN-TYPES and RULES. CELLS may be a 2D array or a sequence of sequences, converted to a 2D array. RULES and COLUMN-TYPES may be lists of pairs, in which case they are passed on to EXPAND-TO-VECTOR. Values which are neither vectors nor lists are recycled to give a vector of the desired length.

Undocumented

ALIGN (ALIGNMENT CONTENT)

MULTICOLUMN (ALIGNMENT CONTENT NUMBER)

NUMPRINT (DIGITS-AFTER-DECIMAL &OPTIONAL (DIGITS-BEFORE-DECIMAL *DIGITS-BEFORE-DECIMAL*))

Private

ALIGNED-ALIGNMENT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

ALIGNED-CONTENT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

ALIGNF (CELLS ROW-INDEX COL-INDEX &OPTIONAL (ALIGNMENT CENTER))

Wrap cell at indexes as aligned.

ASCII-ABSOLUTE-POSITIONS (COLUMN-WIDTHS SEPARATOR-WIDTH)

Return two values: the first a vector containing the absolute positions in the format (LIST START END &OPTIONAL OFFSET) where offset is the width of the part before the decimal dot; the second value the total width of the table.

ASCII-BUFFER-WRITE (BUFFER START END STRING OFFSET)

Write STRING in BUFFER as if STRING started at (+ START OFFSET) but not modifying any other elements except the ones between START and END.

ASCII-BUFFER-WRITE-ALIGNED (BUFFER START END STRING ALIGNMENT)

Like ASCII-BUFFER-WRITE, but also accepting alignment keywords and automatically aligning string.

ASCII-COLUMN-WIDTHS (RAW-TABLE)

Traverse columns and calculate the column widths, returned as a vector. Each column with is either an integer or a cons of two integers, the first the column width, the second the width of the first part (before the decimal dot).

ASCII-ROW (ABSOLUTE-POSITIONS TOTAL-WIDTH COLUMN-TYPES ROW)

Render ROW in ASCII.

ASCII-RULE (ABSOLUTE-POSITIONS TOTAL-WIDTH RULE)

Expand rule into a string.

CHECK-TABLE-CONSISTENCY (CELLS COLUMN-TYPES RULES)

Check that the dimensions of the table definition are consistent.

DECIMAL-POSITION (STRING)

Return the position of the decimal dot in STRING. If no decimal dot is present, return the length of the string, which implies that the string will be aligned left of the decimal dot in numprint columns.

DUMP (STRING)

Write STRING to output.

ENSURE-MATRIX (OBJECT)

Return OBJECT as a 2D array if possible, otherwise signal an error.

ENSURE-VECTOR (LENGTH OBJECT &OPTIONAL INITIAL-ELEMENT)

Return OBJECT as a VECTOR of length, constructing it using EXPAND-TO-VECTOR if necessary, using the given INITIAL-ELEMENT. For internal use only, not exported.

FRESH

Fresh line in output.

LATEX-COLUMN-TYPE-STRING (COLUMN-TYPE)

Return the LaTeX fragment designating a given column type, as a string.

LATEX-MULTICOLUMN (NUMBER COLUMN-TYPE STRING)

Write a LaTeX \multicolumn fragment.

LATEX-RULE (RULE)

Return LaTeX code representing rule as a string.

MULTICOLUMN-ALIGNMENT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MULTICOLUMN-CONTENT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MULTICOLUMN-NUMBER (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MULTICOLUMNF (CELLS ROW-INDEX COL-INDEX NUMBER &OPTIONAL (ALIGNMENT CENTER))

Wrap cell at indexes as multicolumn.

NUMPRINT-DIGITS-AFTER-DECIMAL (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

NUMPRINT-DIGITS-BEFORE-DECIMAL (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

NUMPRINT-WIDTHS (CELL)

Break the contents of cell into two parts around the decimal dot, return the length of each as a cons.

TABLE-TO-RAW (TABLE)

Convert table to the `raw' format. Users should not use the raw format as it may change without notice, tables should only be constructed using TABLE. Not exported, for internal use only.

Undocumented

SETFALIGNED-ALIGNMENT (NEW-VALUE INSTANCE)

SETFALIGNED-CONTENT (NEW-VALUE INSTANCE)

ALIGNED-P (OBJECT)

COPY-ALIGNED (INSTANCE)

COPY-MULTICOLUMN (INSTANCE)

COPY-NUMPRINT (INSTANCE)

FORMAT-FLOAT (NUMBER &KEY (DIGITS-BEFORE-DECIMAL *DIGITS-BEFORE-DECIMAL*) (DIGITS-AFTER-DECIMAL *DIGITS-AFTER-DECIMAL*))

SETFMULTICOLUMN-ALIGNMENT (NEW-VALUE INSTANCE)

SETFMULTICOLUMN-CONTENT (NEW-VALUE INSTANCE)

SETFMULTICOLUMN-NUMBER (NEW-VALUE INSTANCE)

MULTICOLUMN-P (OBJECT)

SETFNUMPRINT-DIGITS-AFTER-DECIMAL (NEW-VALUE INSTANCE)

SETFNUMPRINT-DIGITS-BEFORE-DECIMAL (NEW-VALUE INSTANCE)

NUMPRINT-P (OBJECT)

MACRO

Private

&ALIGNED (&WHOLE WHOLE35 ALIGNMENT CONTENT)

LET+ form for slots of the structure ALIGNED.

&ALIGNED-R/O (&WHOLE WHOLE77 ALIGNMENT CONTENT)

LET+ form for slots of the structure ALIGNED. Read-only.

&MULTICOLUMN (&WHOLE WHOLE157 ALIGNMENT CONTENT NUMBER)

LET+ form for slots of the structure MULTICOLUMN.

&MULTICOLUMN-R/O (&WHOLE WHOLE201 ALIGNMENT CONTENT NUMBER)

LET+ form for slots of the structure MULTICOLUMN. Read-only.

&NUMPRINT (&WHOLE WHOLE267 DIGITS-BEFORE-DECIMAL DIGITS-AFTER-DECIMAL)

LET+ form for slots of the structure NUMPRINT.

&NUMPRINT-R/O (&WHOLE WHOLE309 DIGITS-BEFORE-DECIMAL DIGITS-AFTER-DECIMAL)

LET+ form for slots of the structure NUMPRINT. Read-only.

WITH-OUTPUT ((FILESPEC-OR-STREAM) &BODY BODY)

Make output commands write to the given target for the scope of BODY. Filespecs are opened, streams are used as is.

GENERIC-FUNCTION

Public

FORMAT-CONTENT (CONTENT)

Return a string.

WRITE-LATEX (FILESPEC-OR-STREAM TABLE)

Write TABLE to FILESPEC-OR-STREAM for LaTeX.

Undocumented

WRITE-ASCII (FILESPEC-OR-STREAM TABLE &KEY COLUMN-SEPARATOR (COLUMN-SEPARATOR *ASCII-COLUMN-SEPARATOR*))

Private

LATEX-CELL (CELL)

Write a cell in LaTeX format.

Undocumented

FORMAT-CELL (CELL COLUMN-TYPE)

VARIABLE

Public

*ASCII-COLUMN-SEPARATOR*

The default separator for columns in ASCII output.

*DIGITS-AFTER-DECIMAL*

Default number of digits after the decimal point.

*DIGITS-BEFORE-DECIMAL*

Default number of digits before the decimal point.

Private

*OUTPUT*

Variable holding the stream output commands write to.

CLASS

Public

ALIGNED

Wrapper structure for aligned content.

MULTICOLUMN (ALIGNMENT CONTENT NUMBER)

Wrapper structure for multicolumn content, spanning NUMBER of columns, aligned according to ALIGNMENT.

NUMPRINT (DIGITS-AFTER-DECIMAL &OPTIONAL (DIGITS-BEFORE-DECIMAL *DIGITS-BEFORE-DECIMAL*))

Numprint n{before}{after} column type.

TABLE (CELLS &KEY (COLUMN-TYPES RIGHT) (RULES '((0 . TOP) (-1 . BOTTOM))))

User-constructed representation of a table. Cells are formatted and their alignment is resolved according to the column types. Contents of cells that coincide with multicolumn tables are ignored.

Private

RAW-TABLE

Internal representation of a table. CELLS may only contain - strings, - ALIGNED elements with string content, - MULTICOLUMN elements with string content, - the appropriate number of NILs after MULTICOLUMN, which are skipped. This format is for internal use only, and RAW-TABLE is not exported.

TABLE-MIXIN

Mixin class for table of values, stored in CELLS. COLUMN-TYPES specify the column types, and RULES the rules (you one more than the rows in CELLS)