FreeMED.TeX

LaTeX rendering class.

Summary
LaTeX rendering class.
Prints a certain number of copies of the current TeX document.
Renders a TeX document with substitutions from a TeX template in the lib/tex/ directory.
Render to PDF and get file name of temporary file
Sets the printer and printer wrapper for this TeX document to use when printing.
Convert SGML/HTML formatted “rich text” to LaTeX-formatted rich text, while sanitizing.
Parse appropriate information from tag to convert into output data to be passed back to TeX.
Fix capitalization with what we think is “natural” capitalization.
Replace quotes with proper beginning and ending quotation marks, TeX-style.
Escapes offending TeX control sequences.

Functions

PrintTeX

function PrintTeX ($copies =  1,
$rendered =  false)

Prints a certain number of copies of the current TeX document.

Parameters

$copies(optional) Number of copies of the current TeX document to print.  Defaults to 1.
$rendered(optional) Passed to RenderToPDF.

RenderFromTemplate

function RenderFromTemplate ($template,
$rec)

Renders a TeX document with substitutions from a TeX template in the lib/tex/ directory.

Parameters

$templateName of the template to be used.  For lib/tex/rx.tex this would be ‘rx’;
$recAssociative array of primary record data.

Returns

TeX document (not rendered into a result format).

RenderToPDF

function RenderToPDF ($rendered =  false)

Render to PDF and get file name of temporary file

Parameters

$rendered(optional) Boolean.  Set to true if header and footer are to be supressed.

Returns

Name of temporary file.

SetPrinter

function SetPrinter ($wrapper,
$printer)

Sets the printer and printer wrapper for this TeX document to use when printing.

Parameters

$wrapperPHP.PrinterWrapper object
$printerText name of the printer to use

_HTMLToRichText

function _HTMLToRichText ($orig)

Convert SGML/HTML formatted “rich text” to LaTeX-formatted rich text, while sanitizing.

Parameters

$origOriginal marked up string

Returns

LaTeX-style rich text

_ParseTag

function _ParseTag ($rec,
$tag)

Parse appropriate information from tag to convert into output data to be passed back to TeX.

Parameters

$recAssociative array of data to be used for processing.
$tagText of the tag to be processed.

Returns

TeX formatted text.

_FixCase

function _FixCase ($string)

Fix capitalization with what we think is “natural” capitalization.

Parameters

$stringOriginal string

Returns

String with appropriate capitalization.

_ReplaceQuotes

function _ReplaceQuotes ($string)

Replace quotes with proper beginning and ending quotation marks, TeX-style.

Parameters

$stringString to be mucked with.

Returns

TeX-quoted string

_SanitizeText

function _SanitizeText ($text,  
$skip_html = false)

Escapes offending TeX control sequences.

Parameters

$textText to be sanitized
$skip_html(optional) Whether or not to skip HTML specific escape sequences.  This is useful if presenting rich text markup (which uses SGML/HTML tags) to the renderer.  Defaults to false.

Returns

Text that can be cleanly inserted into TeX code.

function PrintTeX ($copies =  1,
$rendered =  false)
Prints a certain number of copies of the current TeX document.
function RenderFromTemplate ($template,
$rec)
Renders a TeX document with substitutions from a TeX template in the lib/tex/ directory.
function RenderToPDF ($rendered =  false)
Render to PDF and get file name of temporary file
function SetPrinter ($wrapper,
$printer)
Sets the printer and printer wrapper for this TeX document to use when printing.
function _HTMLToRichText ($orig)
Convert SGML/HTML formatted “rich text” to LaTeX-formatted rich text, while sanitizing.
function _ParseTag ($rec,
$tag)
Parse appropriate information from tag to convert into output data to be passed back to TeX.
function _FixCase ($string)
Fix capitalization with what we think is “natural” capitalization.
function _ReplaceQuotes ($string)
Replace quotes with proper beginning and ending quotation marks, TeX-style.
function _SanitizeText ($text,  
$skip_html = false)
Escapes offending TeX control sequences.