Cadabra
Computer algebra system for field theory problems
|
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< TeXRequest > | checkin (const std::string &, const std::string &startwrap, const std::string &endwrap) |
std::shared_ptr< TeXRequest > | modify (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 |
TeXEngine::TeXEngine | ( | ) |
TeXEngine::~TeXEngine | ( | ) |
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.
|
private |
|
private |
|
private |
|
private |
double TeXEngine::get_device_scale | ( | ) | const |
int TeXEngine::get_font_size | ( | ) | const |
int TeXEngine::get_geometry | ( | ) | const |
double TeXEngine::get_scale | ( | ) | 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 | total_scale, |
double | device_scale | ||
) |
|
private |
|
private |
|
private |
std::vector<std::string> cadabra::TeXEngine::latex_packages |
|
staticprivate |
|
private |
|
private |
|
private |