Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

(no description)

File Size: 185 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

latex:: (2 methods):
  __construct()
  latex()

name:: (5 methods):
  supported()
  construct_latex_document()
  execute()
  render()
  clean_up()


Class: latex  - X-Ref

__construct()   X-Ref
Constructor - create temporary directories and build paths to
external 'helper' binaries.
Other platforms could/should be added


latex()   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

supported()   X-Ref
Accessor function for support_platform field.

return: boolean value of supported_platform

construct_latex_document($formula, $fontsize = 12)   X-Ref
Turn the bit of TeX into a valid latex document

param: string $forumula the TeX formula
param: int $fontsize the font size
return: string the latex document

execute( $command, $log=null )   X-Ref
execute an external command, with optional logging

param: string $command command to execute
param: file $log valid open file handle - log info will be written to this file
return: return code from execution of command

render( $formula, $filename, $fontsize=12, $density=240, $background='', $log=null )   X-Ref
Render TeX string into gif/png

param: string $formula TeX formula
param: string $filename filename for output (including extension)
param: int $fontsize font size
param: int $density density value for .ps to .gif/.png conversion
param: string $background background color (e.g, #FFFFFF).
param: file $log valid open file handle for optional logging (debugging only)
return: bool true if successful

clean_up( $filename )   X-Ref
Delete files created in temporary area
Don't forget to copy the final gif/png before calling this

param: string $filename file base (no extension)