Update: 2012-01:
The standalone
class now has a varwidth
option, so with the current release, one would simply use the [varwidth]
package option:
\ifdefined\formula
\else
\def\formula{E = m c^2}
\fi
\documentclass[border=2pt,varwidth]{standalone}
\usepackage{standalone}
\usepackage{amsmath}
\begin{document}
\[ \formula \]
\end{document}
Save the following as formula.tex
:
\ifdefined\formula
\else
\def\formula{E = m c^2}
\fi
\documentclass[border=2pt]{standalone}
\usepackage{amsmath}
\usepackage{varwidth}
\begin{document}
\begin{varwidth}{\linewidth}
\[ \formula \]
\end{varwidth}
\end{document}
The standalone
class is used for cropping. The varwidth
environment is similar to the minipage
environment, but sets its width to match the narrower natural width based on the content.
The ifdefined...\fi
is only necessary so that this file can be compiled by itself, which is useful to test to ensure that there are no errors in it, in case you decide to make changes to it.
Then you can process this file as:
pdflatex "\def\formula{E=\frac{m_1v^2}{2}}\input{formula.tex}"
convert -density 300 formula.pdf -quality 90 formula.png
where convert
is part of ImageMagick. This yields the following PNG file:
I have not used it, but the current development version of standalone
can generate the PNG directly if you use
\documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone}
Alternatively you could also use GIMP
as per this link from Wikibooks.
Lot of the things that are on your list are already implemented:
tex4ht
can produce xhtml with mathml
tex4ht
can produce SVG figures from tikz/pgf figures
- METAPOST already outputs SVG out of the box
- Linking to parts of your documents is done by the
hyperref
package, for pdf and html/xhtml.
Connecting to Wolfram|Alpha is surely not a "web standard", and may be difficult, since math in TeX is mostly described in a "presentation", rather than semantic way. On the other hand, it should be possible to do it for each individual equation using the hyperref
package. I do not really see any way to do it automatically.
I know it is possible to produce tooltips and include animations in a pdf document, I am not sure how would that work when converting to html.
Best Answer
Mathpix Snip: Scanner App for Math and Science
https://www.mathpix.com/
Available for MacOS, Windows, Linux (Snap), iOS, and Android,
N.B.: Using this to copy equations from Wikipedia is 100% pointless, because you can also just select the equation with your mouse and press CtrlC, which will put the LaTeX source of that equation in your clipboard.