Cadabra
Computer algebra system for field theory problems
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
cadabra::TeXEngine Class Reference

Description

TeXEngine is used to convert LaTeX strings into PNG images.

This is a two-stage process: you first 'check in' a string into the system, in exchange for a pointer to a TeXRequest object. When you are ready to retrieve the image, call 'get_pixbuf'.

If you need to generate images for more than one string, simply check them all in and then call 'convert_all' before retrieving the pixbufs. This requires only one round-trip through latex/dvipng.

#include <TeXEngine.hh>

Classes

class  TeXException
 
class  TeXRequest
 

Public Member Functions

 TeXEngine ()
 
 ~TeXEngine ()
 
void set_geometry (int horizontal_pixels)
 
int get_geometry () const
 
void set_scale (double total_scale, double device_scale)
 
double get_scale () const
 
double get_device_scale () const
 
void set_font_size (int font_size)
 
int get_font_size () const
 
std::shared_ptr< TeXRequestcheckin (const std::string &, const std::string &startwrap, const std::string &endwrap)
 
std::shared_ptr< TeXRequestmodify (std::shared_ptr< TeXRequest >, const std::string &)
 
void convert_all ()
 Generate images for all TeXRequests which are labelled as needing conversion. More...
 
void invalidate_all ()
 Mark all TeXRequests as needing re-generating. More...
 
void checkout (std::shared_ptr< TeXRequest >)
 Mark a TeXRequest as no longer being needed. More...
 
void checkout_all ()
 

Public Attributes

std::vector< std::string > latex_packages
 

Private Member Functions

std::string convert_unicode_to_tex (const std::string &) const
 
void erase_file (const std::string &) const
 
void convert_one (std::shared_ptr< TeXRequest >)
 
void convert_set (std::set< std::shared_ptr< TeXRequest > > &)
 
std::string handle_latex_errors (const std::string &, int exit_code) const
 

Private Attributes

std::set< std::shared_ptr< TeXRequest > > requests
 
std::string preamble_string
 
int horizontal_pixels_
 
int font_size_
 
double total_scale_
 
double device_scale_
 

Static Private Attributes

static double millimeter_per_inch = 25.4
 

Constructor & Destructor Documentation

◆ TeXEngine()

TeXEngine::TeXEngine ( )

◆ ~TeXEngine()

TeXEngine::~TeXEngine ( )

Member Function Documentation

◆ checkin()

std::shared_ptr< TeXEngine::TeXRequest > TeXEngine::checkin ( const std::string &  txt,
const std::string &  startwrap,
const std::string &  endwrap 
)

◆ checkout()

void TeXEngine::checkout ( std::shared_ptr< TeXRequest req)

Mark a TeXRequest as no longer being needed.

◆ checkout_all()

void TeXEngine::checkout_all ( )

◆ convert_all()

void TeXEngine::convert_all ( )

Generate images for all TeXRequests which are labelled as needing conversion.

◆ convert_one()

void TeXEngine::convert_one ( std::shared_ptr< TeXRequest req)
private

◆ convert_set()

void TeXEngine::convert_set ( std::set< std::shared_ptr< TeXRequest > > &  reqs)
private

◆ convert_unicode_to_tex()

std::string TeXEngine::convert_unicode_to_tex ( const std::string &  orig) const
private

◆ erase_file()

void TeXEngine::erase_file ( const std::string &  nm) const
private

◆ get_device_scale()

double TeXEngine::get_device_scale ( ) const

◆ get_font_size()

int TeXEngine::get_font_size ( ) const

◆ get_geometry()

int TeXEngine::get_geometry ( ) const

◆ get_scale()

double TeXEngine::get_scale ( ) const

◆ handle_latex_errors()

std::string TeXEngine::handle_latex_errors ( const std::string &  result,
int  exit_code 
) const
private

◆ invalidate_all()

void TeXEngine::invalidate_all ( )

Mark all TeXRequests as needing re-generating.

Use this e.g. when changing font size for the entire notebook: first invalidate_all, then convert_all.

◆ modify()

std::shared_ptr< TeXEngine::TeXRequest > TeXEngine::modify ( std::shared_ptr< TeXRequest req,
const std::string &  txt 
)

◆ set_font_size()

void TeXEngine::set_font_size ( int  font_size)

◆ set_geometry()

void TeXEngine::set_geometry ( int  horizontal_pixels)

◆ set_scale()

void TeXEngine::set_scale ( double  total_scale,
double  device_scale 
)

Member Data Documentation

◆ device_scale_

double cadabra::TeXEngine::device_scale_
private

◆ font_size_

int cadabra::TeXEngine::font_size_
private

◆ horizontal_pixels_

int cadabra::TeXEngine::horizontal_pixels_
private

◆ latex_packages

std::vector<std::string> cadabra::TeXEngine::latex_packages

◆ millimeter_per_inch

double TeXEngine::millimeter_per_inch = 25.4
staticprivate

◆ preamble_string

std::string cadabra::TeXEngine::preamble_string
private

◆ requests

std::set<std::shared_ptr<TeXRequest> > cadabra::TeXEngine::requests
private

◆ total_scale_

double cadabra::TeXEngine::total_scale_
private

The documentation for this class was generated from the following files: