-
Notifications
You must be signed in to change notification settings - Fork 10
/
example.cxx
41 lines (31 loc) · 907 Bytes
/
example.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <texcaller.h>
#include <iostream>
int main()
{
//
// Generate a PDF document
//
std::string latex =
"\\documentclass{article}"
"\\begin{document}"
"Hello world!"
"\\end{document}";
try {
std::string pdf;
std::string info;
texcaller::convert(pdf, info, latex, "LaTeX", "PDF", 5);
std::cout << "Generated PDF of " << pdf.size() << " bytes.";
std::cout << " Details:" << std::endl << std::endl << info;
} catch (std::domain_error &e) {
std::cout << "Error: " << e.what() << std::endl;
}
//
// Escape a string for LaTeX
//
const std::string s =
"Téxt → \"with\" $peciäl <characters>";
std::cout << std::endl;
std::cout << "Original: " << s << std::endl;
std::cout << "Escaped: " << texcaller::escape_latex(s) << std::endl;
return 0;
}