Closed dhermes closed 6 years ago
Made some progress with the standalone class
\documentclass{standalone}
\begin{document}
$\displaystyle F(V, T) = E(V) + D(T)$
\end{document}
but had some hiccups because inline math mode is not supported there. Found some helpful posts along the way.
It seems that
pdftocairo -svg {name}.pdf {name}.svg
does slightly better.
Currently comes out the wrong size / density.
UPDATE: As can be seen, they are essentially the same size 107x10
while the png
generated by make_png_from_latex.convert_equation
is 240x27
.
These are 3 fairly different width / height ratios:
UPDATE: pdfcrop
may also be useful.
For an actual example
\documentclass{standalone}
\begin{document}
$\displaystyle \left( \begin{array}{cc} 1 & 1 \\ 1 & 0 \end{array} \right)^{n} \left( \begin{array}{c} 1 \\ 0 \end{array} \right) = \left( \begin{array}{cc} 1 & 1 \\ 1 & 0 \end{array} \right)^{n} \left( \begin{array}{c} F_1 \\ F_0 \end{array} \right) = \left(\begin{array}{c} F_{n + 1} \\ F_n \end{array} \right)$
\end{document}
Unfortunately this is 323x34
instead of the png
which is 675x72
, so we use
<blockquote style="text-align: center;">
<img style="transform: scale(2.0898); text-align: center; vertical-align: middle; border:none; box-shadow: none;" src="/images/test.pdftocairo.svg"></img>
</blockquote>
using scale.
Some more examples:
\documentclass{standalone}
\DeclareMathAlphabet\mathbb{U}{msb}{m}{n}
\begin{document}
$\mathbb{F}_p$
\end{document}
gave 29x27
as a png
vs the svg
size of 15x14
.
To make the align
LaTeX environment work, it was a PITA (but maybe a simpler way forward):
\documentclass{article}
\thispagestyle{empty}
\usepackage{amsthm,amssymb,amsmath}
\begin{document}
\begin{align*}
\widetilde{\alpha} = \frac{P - \sqrt{D}}{Q} &< 0 \leq X - 1 \\
\Rightarrow Q &< \sqrt{D} + (QX - P) \\
\Rightarrow Q(\sqrt{D} - (QX - P))&< D - (QX - P)^2 \\
\Rightarrow -\widetilde{\alpha}' =
\frac{\sqrt{D} - (QX - P)}{\frac{1}{Q}\left(D - (QX - P)^2\right)} &< 1
\end{align*}
\end{document}
followed by
$ pdflatex test.tex
$ pdfcrop test.pdf
$ pdftocairo -svg test-crop.pdf test-crop.pdftocairo.svg
No longer relevant since LaTeX images are no more.
It's possible to make them via
and to embed via
My first attempt at this resulted in a non-transparent background, so the flags need some tweaking.
Some other possibilities