Compatible with DokuWiki
This plugin uses LaTeX+ImageMagick to render mathematical formulae embedded within a DokuWiki page. This gives a professional look to equations, and the syntax allows almost copy-paste conversion between DokuWiki and LaTeX manuscripts. For example, you may simply type $ a + b = c $ into your wiki code and it will automatically be shown as
.1)
Follow the usual plugin installation instructions to download and install the plugin.
External requirements: This plugin requires the following software to be installed on the server hosting your wiki. If you do not have root access, contact your administrator.2)
latex and dvips binaries.
This plugin will not work in PHP safe mode. - unless your server administrator has specifically allowed access to the software this plugin needs.
Variously out-dated but quite in-depth installation instructions can be found on E-razor's wiki. You might also consult the similar instructions for math in MediaWiki (but note that DokuWiki's plugin does not need texvc, OCaml, etc.). Here is a summary
apt-get install texlive-latex-base imagemagick ghostscript
yum install tetex-latex ImageMagick
pacman -S texlive-most texlive-lang
to install latex, read the latex article in the archwiki for more options
“C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex”.convert binary has the same name as a Microsoft-supplied program.| wiki code | result |
|---|---|
$ a + b = c $ | |
<latex> I am \LaTeXe! </latex> | |
\begin{eqnarray*}
& & \frac{3}{4 \pi} \sqrt{4 \cdot x^2 12}\\
& & \lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}\\
& & {\it f}(x) = \frac{1}{\sqrt{x} x^2}\\
& & e^{i \pi} + 1 = 0\;
\end{eqnarray*}
| |
from here:<latex>\setlength{\unitlength}{1mm}
\begin{picture}(93,46)
\put( 0,14){\vector(1,0){60}}
\put(61,13){$x$}
\put(20,4){\vector(0,1){37}}
\put(19,43){$y$}
\put(50,34){\circle*{2}}
\put(52,35){$P$}
\multiput(20,34)(4,0){8}{\line(1,0){2}}
\put(14.5,33.5){$y_P$}
\multiput(50,14)(0,4){5}{\line(0,1){2}}
\put(48,11){$x_P$}
\put( 2,8){\vector(3,1){56}}
\put(59,26.5){$x'$}
\multiput(50,34)(1.9,-5.7){2}
{\line(1,-3){1.2}}
\put(52,22){$x_P'$}
\multiput(50,34)(-5.8,-1.933){6}
{\line(-3,-1){3.6}}
\put(12,21){$y_P'$}
\put(22,8){\vector(-1,3){10.5}}
\put(10,41){$y'$}
\end{picture}</latex>
| |
The following syntax is recognized by the LaTeX plugin at the moment. For the most part, the recognized syntax is inserted as-is into a small LaTeX template (which can be changed in the Configuration Manager), then compiled:
$…$ syntax is rendered in-line, just as in LaTeX$$…$$ syntax is rendered on its own line, just as in LaTeX\begin{displaymath}…\end{displaymath} syntax\begin{eqnarray}…\end{eqnarray} syntax\begin{eqnarray*}…\end{eqnarray*} syntax\begin{equation}…\end{equation} syntax\begin{equation*}…\end{equation*} syntax<latex>…</latex> syntax is rendered in-line in non-math-mode. This is useful to enter environments such as picture, etc.\setcounter{equation}{5}, which will reset the equation counter to start at 5.%%$%% instead in wiki text.$ L_{\rm name} $ will show as
because “name” is blacklisted (I am not sure why, but I'm keeping the old blacklist just in case –Mark). The image title tag (tooltip) will indicate that this is the case, emulated here:
.From the Configuration Manager, you can modify the following settings:
:wiki:latex).png.latex, dvips, convert, and identify programs.convert program, to control image size, transparency.\usepackage{} statements here, change color, etc.There is an admin plugin included for ease in managing the LaTeX image cache, which can easily grow to thousands of equations in size. This can be accessed through the administration actions panel.
The admin plugin also allows you to troubleshoot problems in the rendering process.
instead of the image. The image will have a tooltip (html title tag) indicating the particular error.latex, dvips, convert, and identify binaries..log file from LaTeX compilation.texvc.inputenc package from the preamble, but this is not the preferred method since Dokuwiki uses UTF-8.Missing latex.fmt. This is a bug found in CentOS 5, due to the packages failing to update the proper files. Quite confusingly, normal users are able to use LaTeX with no problems but all web-invoked LaTeX will fail (the apache user cannot write to its home directory /var/www/.). You can either:latex.fmt in your home directory, then copy that latex.fmt into your temporary directory where the DokuWiki LaTeX plugin can find it.6) You can find the file at $HOME/.texmf-var/web2c/latex.fmt. You may want to relocate the temporary folder to be inside your Dokuwiki installation, so that latex.fmt is not wiped out by a temporary files cleaner.Invalid drive specification. This error appears in the troubleshooter's program versions test in Windows. The plugin attempts to call convert but it gets Microsoft's program rather than the ImageMagick one. Adjust your PATH environment variable or configure the plugin to use an absolute path.This plugin was originally written by Alexander 'E-razor' Krause based on class.latexrender.php by Benjamin Zeiss then extended by Michael Boyle, and is now maintained on github by Mark Lundeberg.
If the embedded imgages aren't perfectly aligned, you can gain more controll bei adding 'media_latex' zu the class in syntax.php lines 91 and 96. After that create an style.css with 'img.media_latex{ … }'.
I'm not sure if that applies for the current plugin (there's no syntax.php), and anyway there are already two CSS styles declared inplugins/latex/all.css: The first styleimg.latex_displayedis for equations on their own line such as$$ G(x) = 2 $$, which have a slight indent. The second styleimg.latex_inlinesets vertical alignment to middle for in-line latex such as$a + b = c$. -Mark
Why does the new latex plugin display formulas in red color ?Ok I just found the answer myself Nice work !
Maybe a stupid question but how can I display the Dollars symbol ($) on the page ? The plugin replace all my $ by the message “Latex render failed” It's not very easy to use%%$%%!
Yes, that's an unfortunate side effect of the plugin. If you don't mind losing the $ a+b $ syntax entirely, you can deleteplugins/latex/syntax/dollar.php. Another way you could consider is to add a space to dollar.php line 14, changing the trigger pattern from$this->Lexer->addEntryPattern('\$(?=.*\$)',$mode,'plugin_latex_dollar');to
$this->Lexer->addEntryPattern('\$ (?=.*\$)',$mode,'plugin_latex_dollar');That way, the plugin would only activate on text like ”
the sum $ a+b $” where the $ is followed by a space, and would not activate on text like ”projected total cost of $2000”. -Mark
Well, why don't you try <nowiki>? -Di
If i give the group @ALL an “Read”-Permission to read the page, they can access and read the normal Text…but the Latex-Image are not there! What to do?Solved! Need to give “Read”-Permission to “wiki:latex:*”