What is the most appropriate way of customizing the amount of padding that Mathjax produces for the \boxed{} envorinment? I know there is a \bbox[]{} alternative with such an option, but it is buggy for the CommonHTML output that I use (it excludes the punctuation symbols).
If it helps to answer the question, I am specifically using page2html from the mathjax-node package to pre-render all the math.
Related
Problem
I am developing a Rust program which has a GTK3 GUI using the given rust-gtk-binding.
The program should be cross-platform (at least Linux and Windows).
The GUI should be able to show custom plaintexts and small LaTeX-snippets to allow the use math environments (small means sizes of one formula as an element to display).
Therefore, I need a way to convert LaTeX-code into something which can be displayed by the GUI.
Ideas and their problems
I can see two approaches displaying LaTeX:
Compile the LaTeX-source into pdf and then into some image type. It should be possible to use Ghostscript to get the image. But I do not know how to generate the pdf in a way which is lightweight (does not include rather large packages like miktex) and cross-platform. This option could also be overkill as there is no need to dynamically download special packages, a good math support would be sufficient. The positive side is that rendering an image in GTK should be easy.
Use KaTeX which should be sufficient for math environments. I was able to install matching crates and generate HTML source from some formulas. But here it becomes difficult to render the result as GTK has no native way for displaying HTML. As it would be difficult to integrate a HTML-engine into the GUI it would be optimal to find a tool which is able to render HTML to an image type which then can be displayed.
Now I have two ways both using an intermediate step where for common LaTeX the first step is difficult and for KaTeX the second step displays a problem. For both approaches' difficult steps I could not find any feasible solution.
Are there any libraries or similar I could not find or are there any different approaches?
It would be perfectly sufficient to be able to render a single formula, I just want to avoid such massive and difficult overkills like using a complete LaTeX compiler or half a browser to render HTML.
After searching and evaluating many more approaches I got a solution which is kind of good while also having some major drawbacks:
First of all, I use TinyTex as LaTeX environment. I did not restrict the use of LaTeX to e.g. math environments. TinyTex offers support for major platforms while being lightweight and portable. Additional LaTeX packages have to be installed manually which allows me to decide which ones are being shipped with my application.
The negative side is that while TinyTex is lightweight for a LaTeX environment it still is rather big for its purpose here (about 250MB).
I installed the required packages to use \documentclass[preview]{standalone} to get an already cropped pdf.
Afterwards I use Ghostscript to get a png-image for the generated pdf. I did not use language bindings and instead just went std::process::Command.
The following lines should be sufficient to convert test.tex into test.png with the portable TinyTex installation and Ghostscripts gswin64c.exe present in subfolders of the project's directory under Windows: (As TinyTex and Ghostscript also exist for other OS the given example can easily be changed to work on other systems)
use std::process::Command;
fn main() {
let output = Command::new("TinyTex\\bin\\win32\\pdflatex.exe")
.args(&["test.tex"])
.output()
.expect("Some error message 1");
println!("{}", String::from_utf8(output.stdout).unwrap());
let output = Command::new("gs\\gswin64c.exe")
.args(&[
"-dNOPAUSE",
"-dBATCH",
"-sDEVICE=png16m",
"-r1000",
"-sOutputFile=test.png",
"test.pdf",
])
.output()
.expect("Some error message 2");
println!("{}", String::from_utf8(output.stdout).unwrap());
}
Of course this is no particulary good and useful code at this stage but it shows how to proceed with the given problem and I wanted to leave it here in case anyone with a similar problems finds this post.
I have a TCL code gist embedded in my own website. This page uses MathJax 2.7.5 configed with "TeX-MML-AM_CHTML". However, Mathjax strangely rendered the code between back-ticks in the comments of the code. For example, one line in the source code is (can be found here in gist):
# `testPrintFlag` : integer
The letters "int" were rendered by MathJax to a integration symbol (see here).
The gist code block appears like this., but the correct one should be like this. I'm wondering how I can fix this.
Thanks!
The configuration file TeX-MML-AM_CHTML includes the AsciiMath input processor, and AsciiMath uses back-ticks as its math delimiters. So all your back-tacks will cause AsciiMath to process their contents as math. If you aren't using AsciiMath input, you probably want to use a different configuration format, like just TeX-AMS_CHTML which only does TeX input (not MathML and AsciiMath, as in your original). That will be faster as well as it is a smaller file.
If you are using AsciiMath input, then you could configure it to use a different delimiter. See the documentation for details.
You could also configure MathJax to skip containers with certain class names (e.g., class="gist"). See the ignoreClass option for the asciimath2jax preprocessor at the link above. There is a similar one for the tex2jax preprocessor.
I'm trying to render math equations from user input server side using MathJax in Node.js. I'm using a separate library (mathjs) to turn the input into LaTeX, but after spending an hour looking at the MathJax docs I'm no closer to turning the LaTeX into MathML.
I'm assuming I'd be using the mathjax package on NPM, and then use the MathJax.InputJax and MathJax.OutputJax classes to do the processing, but I've got no idea how to put everything together.
(In case anyone is wondering, I'm using a CSS file to polyfill MathML, rather than load MathJax in the browser and cause a delay while the processing happens.)
You want to use MathJax-node for this. It is set up to run MathJax server-side. There are a number of example command-line tools in the bin directory. You could also hook up a web service to handle the conversion. Tim Arnold made one available as mathjax-server on npmjs.com.
My thesis is written in b5j documentclass style.
\documentclass[b5j,twoside,12pt]{report}
I have a paper that is appended at the end. However this is written in b5paper style as an article.
\documentclass[12pt,b5paper,twoside]{article}
How do I get the paper to follow the japanese style? Havent found any b5paperj options in the geometry package.. :-/
It is possible to build the paper that must be appended separately and input it in your document using pdfpages. This way you don't have to control both styles and the package provides enough flexibility to make it look like you want to.
I'm using the LaTeX-Beamer class for making presentations. Every once in a while I need to include screenshots. Those graphics are pixel-based, of course. I use includegraphics like this:
\begin{figure}
\includegraphics[width= \paperwidth]{img/analyzer.png}
\end{figure}
or usually something like this:
\begin{figure}
\includegraphics[width= 0.8\linewidth]{img/analyzer.png}
\end{figure}
This leads to pretty bad readibility of the contained text, so I'm asking for your best practices: How would you include screenshots containing text considering, that I will do the output PDF with pdflatex?
EDIT: I suppose I'm looking for something like an 1:1 presetation of the image within beamer. However, [scale = 1.0] doesn't achieve what I'm looking for.
Your best bet is to scale the image outside of Latex for inclusion, and include it in 1:1 ratio. The scaling done by graphics packages in Latex isn't going to be anywhere near as good as possible from other tools. Latex (Tex) has limited floating-point arithmetic capabilities, whereas an external tool can use sophisticated algorithms to get the scaling better.
Another option is to use only a part of the screenshot, the one you want to concentrate on.
Edit: If you can change the font size before taking the screenshot, that's another option—just increase the font size for the screenshots.
Of course, you can combine the two methods.
I have done exactly what you do and e.g defined
\newcommand{\screenshot}[1]{\centerline{%
\includegraphics[height=7.8cm,transparent]{#1}}} % 7.8in
which worked with whatever style I was using at the time. The files included with this macro were all PNGs created with one the usual Linux screen capture tools.
Edit: You may have to play with the size (height and width) of your input files. It came out rather nice for me (and this was from a presentation in 2006).
How about scaling it as follows:
\includegraphics[scale=0.5]{images/myimage.jpg}
This works for me.
Have you tried to convert the image to .eps or .pdf file and use this file in LaTeX?
Maybe try also latex, dvips and ps2pdf.
Problem might be in used viewer, in Linux I use Document viewer or ePDFViewer and output is much worse than in Adobe Reader or Acrobat, which I use in Windows...