Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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)
 
void set_scale (double)
 
void set_font_size (int font_size)
 
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 scale_
 

Static Private Attributes

static double millimeter_per_inch = 25.4
 

Constructor & Destructor Documentation

TeXEngine::TeXEngine ( )
TeXEngine::~TeXEngine ( )

Member Function Documentation

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

Mark a TeXRequest as no longer being needed.

void TeXEngine::checkout_all ( )
void TeXEngine::convert_all ( )

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

void TeXEngine::convert_one ( std::shared_ptr< TeXRequest req)
private
void TeXEngine::convert_set ( std::set< std::shared_ptr< TeXRequest > > &  reqs)
private
std::string TeXEngine::convert_unicode_to_tex ( const std::string &  orig) const
private
void TeXEngine::erase_file ( const std::string &  nm) const
private
std::string TeXEngine::handle_latex_errors ( const std::string &  result,
int  exit_code 
) const
private
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.

std::shared_ptr< TeXEngine::TeXRequest > TeXEngine::modify ( std::shared_ptr< TeXRequest req,
const std::string &  txt 
)
void TeXEngine::set_font_size ( int  font_size)
void TeXEngine::set_geometry ( int  horizontal_pixels)
void TeXEngine::set_scale ( double  scale)

Member Data Documentation

int cadabra::TeXEngine::font_size_
private
int cadabra::TeXEngine::horizontal_pixels_
private
std::vector<std::string> cadabra::TeXEngine::latex_packages
double TeXEngine::millimeter_per_inch = 25.4
staticprivate
std::string cadabra::TeXEngine::preamble_string
private
std::set<std::shared_ptr<TeXRequest> > cadabra::TeXEngine::requests
private
double cadabra::TeXEngine::scale_
private

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