class-LatexRender

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.
Overview

Classes

Interfaces

Exceptions

Functions

Class LatexRender

Package: com\tecnick\tcexam\shared
Authors: Benjamin Zeiss, Nicola Asuni
Class:

LatexRender This is a PHP5 class for generating images from LaTeX Formulas. This class is based on the following: LaTeX Rendering Class v0.8 (Licensed under GPL 2) Copyright (C) 2003 Benjamin Zeiss zeiss@math.uni-goettingen.de Currently the project is maintained by Steve Mayer. Please check the following Website to obtain the original source code: http://www.mayer.dial.pipex.com/tex.htm


Located at shared/code/tce_latexrender.php
Methods summary
public
# __construct( )

Class Constructor.

public
# __destruct( )

Default destructor.

public
# setPathToPicturesDir( $picture_path )

Set the absolute path to images directory.

public
# setPathToPicturesDirHttpd( $picture_path_httpd )

Set relative path to images directory.

public
# setPathToTempDir( $tmp_dir )

Set path to temporary directory.

public
# setPathToLatex( $latex_path )

Set path to LATEX.

public
# setPathToDvips( $dvips_path )

Set path to DVIPS.

public
# setPathToImageMagicConvert( $convert_path )

Set path to ImageMagick convert.

public
# setPathToImageMagicIdentify( $identify_path )

Set path to ImageMagick identify.

public
# setFormulaDensity( $formula_density )

Set formula density (used by ImageMagick)

public
# setMaxWidth( $width_limit )

Set image width limit in pixels.

public
# setMaxHeight( $height_limit )

Set image height limit in pixels.

public
# setMaxLenght( $string_length_limit )

Set size limit for input string.

public
# setFontSize( $font_size )

Set font size.

public
# setLatexClass( $latexclass )

Set LaTeX class. Install extarticle class if you wish to have smaller font sizes.

public
# setFilenamePrefix( $img_prefix )

Set filename prefix for chached images.

public
# setImageFormat( $image_format )

Set the image format (default = PNG).

public
# setLatexBlackList( $latex_tags_blacklist )

Set the list of unauthorized LaTeX commands.

public
# getFormulaURL( $latex_formula )

Tries to match the LaTeX Formula given as argument against the formula cache. If the picture has not been rendered before, it'll try to render the formula and drop it in the picture cache directory.

public
# getImageWidth( )

Returns Image width

public
# getImageHeight( )

Returns Image height

public
# getErrorCode( )

Returns the error code

private
# getFilename( $latex_formula )

Wraps a minimalistic LaTeX document around the formula and returns a string containing the whole document as string. Customize if you want other fonts for example.

private
# wrapFormula( $latex_formula )

Wraps a minimalistic LaTeX document around the formula and returns a string containing the whole document as string. Customize if you want other fonts for example.

private
# cleanTemporaryDirectory( $current_dir, $error_code = 0 )

Removes temporary files.

private
# checkImageDimensions( $filename )

Check the dimensions of a picture file using 'identify' of the ImageMagick tools.

private
# renderLatex( $latex_formula )

Renders a LaTeX formula by the using the following method: - write the formula into a wrapped tex-file in a temporary directory and change to it - Create a DVI file using latex (tetex) - Convert DVI file to Postscript (PS) using dvips (tetex) - convert, trim and add transparancy by using 'convert' from the ImageMagick package. - Save the resulting image to the picture cache directory using an md5 hash as filename. Already rendered formulas can be found directly this way.

Properties summary
protected $picture_path

Absolute path to images directory.

# K_LATEX_PATH_PICTURE
protected $picture_path_httpd

Relative path to images directory.

# K_LATEX_PATH_PICTURE_HTTPD
protected $tmp_dir

Path to temporary directory.

# K_LATEX_TMP_DIR
protected $latex_path

Path to LATEX.

# K_LATEX_PATH_LATEX
protected $dvips_path

Path to DVIPS.

# K_LATEX_PATH_DVIPS
protected $convert_path

Path to ImageMagick convert.

# K_LATEX_PATH_CONVERT
protected $identify_path

Path to ImageMagick identify.

# K_LATEX_PATH_IDENTIFY
protected $formula_density

Formula density (used by ImageMagick)

# K_LATEX_FORMULA_DENSITY
protected $width_limit

Image width limit in pixels.

# K_LATEX_MAX_WIDTH
protected $height_limit

Image height limit in pixels.

# K_LATEX_MAX_HEIGHT
protected $string_length_limit

Size limit for input string.

# K_LATEX_MAX_LENGHT
protected $font_size

Font size.

# K_LATEX_FONT_SIZE
protected $latexclass

LaTeX class.

# K_LATEX_CLASS
protected $img_prefix

Filename prefix for chached images.

# K_LATEX_IMG_PREFIX
protected $image_format

Image format (default = PNG).

# K_LATEX_IMG_FORMAT
protected array $latex_tags_blacklist

List of unauthorized LaTeX commands.

# array('include', 'def', 'command', 'loop', 'repeat', 'open', 'toks', 'output', 'input', 'catcode', 'name', '^^', '\every', '\errhelp', '\errorstopmode', '\scrollmode', '\nonstopmode', '\batchmode', '\read', '\write', 'csname', '\newhelp', '\uppercase', '\lowercase', '\relax', '\aftergroup', '\afterassignment', '\expandafter', '\noexpand', '\special')
private integer $errorcode

Error code.

# 0
private string $tmp_filename

Temporary filename.

# ''
private string $latex_formula

Latex formula.

# ''
private integer $img_width

Image width.

# 0
private integer $img_height

Image height.

# 0
 

© 2004-2018 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy