1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-18 22:41:49 +02:00

XeLaTeX interpration of LaTeX for localization

This commit is contained in:
Pomax
2017-02-26 22:27:36 -08:00
parent a889d16f36
commit ba54cc37f9
216 changed files with 477 additions and 404 deletions

View File

@@ -41,12 +41,8 @@ var options = {
if (!fs.existsSync(destination)) {
var cmdarg = new Buffer(latex).toString("base64");
var cmd = "npm run latex -- --hash " + hash + " --base64 " + cmdarg;
console.log(" generating " + hash + ".svg"); // from \n " + latex);
execSync(cmd);
var cmd = "npm run svgo -- " + filename;
console.log(" cleaning up SVG");
execSync(cmd);
console.log(" generating " + hash + ".svg");
execSync(cmd, { stdio: 'inherit' });
}
// Make sure we hardcode the size of this LaTeX SVG image, because we absolutely
@@ -55,10 +51,10 @@ var options = {
// these to "rem" instead, so that formulae are always sized the same, no matter
// the textsize around them.
var svg = fs.readFileSync(destination).toString();
var ex2rem = 0.45;
var w = parseFloat(svg.match(/width="([^"]+)"/)[1]) * ex2rem;
var h = parseFloat(svg.match(/height="([^"]+)"/)[1]) * ex2rem;
return `<img className="LaTeX SVG" src="${filename}" style={{width:"${w}rem", height:"${h}rem"}} />`;
var pt2rem = 0.1;
var w = parseFloat(svg.match(/width="([^"]+)"/)[1]) * pt2rem;
var h = parseFloat(svg.match(/height="([^"]+)"/)[1]) * pt2rem;
return `<img className="LaTeX SVG" src="${filename}" />`;
}
};