Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /home4/starstu4/public_html/cgi-bin/subhrajit.net/wiki/cookbook/TrueLatex/truelatex.php on line 144

Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /home4/starstu4/public_html/cgi-bin/subhrajit.net/wiki/cookbook/TrueLatex/truelatex.php on line 144

Warning: Cannot modify header information - headers already sent by (output started at /home4/starstu4/public_html/cgi-bin/subhrajit.net/wiki/cookbook/TrueLatex/truelatex.php:144) in /home4/starstu4/public_html/cgi-bin/subhrajit.net/wiki/pmwiki.php on line 1319
Main / Latex In PmWiki - Personal Wiki of Subhrajit Bhattacharya
You are viewing this site in administrative mode. Click here to view in regular mode.
print Short URL for this page:[close]

Press Ctrl+C to copy
bookmark feedback/comment

Subhrajit's Blog >>
Latex In PmWiki
Dec 29, 2009


[Read the full article here . . .]


I just finished creating a module for PmWiki for rendering latex commands. It makes use of PDF-LaTeX and ImageMagick utilities installed on the server to enable interpretation and rendering of LaTeX commands in PmWiki and display them as images. Also, the module makes use of a cache, thus avoiding the expensive task of re-rendering every time a LaTeX snippet is requested. CMS like Drupal (and I guess MediaWiki as well) already have similar modules. So now we also have it for PmWiki as well!

I have released the module under GNU-GPL. You can download the latest release from here:
http://www.pmwiki.org/wiki/Cookbook/TrueLatex

Some demonstrations:

1.

 Einstein said (:latex:)$R_{\mu \nu} - {1 \over 2}g_{\mu \nu}\,R + g_{\mu \nu} \Lambda = 
 {8 \pi G \over c^4} T_{\mu \nu}$, where $R$ is the Ricci scalar(:latexend:). This is
 known as the "Einstein field equation". 

Produces:

Einstein said . This is known as the "Einstein field equation".


2.

 (:latex:)
 \begin{eqnarray}
   10xy^2+15x^2y-5xy & = & 5\left(2xy^2+3x^2y-xy\right) \nonumber \\
    & = & 5x\left(2y^2+3xy-y\right) \nonumber \\
    & = & 5xy\left(2y+3x-1\right)
 \end{eqnarray}
 (:latexend:)

Produces:


3.

 (:latex verbose=true:)
  \[
    i\hbar\frac{\partial}{\partial t} \Psi(\mathbf{r},\,t) =
    -\frac{\hbar^2}{2m}\nabla^2 \Psi(\mathbf{r},\,t) + V(\mathbf{r})\Psi(\mathbf{r},\,t)
  \]
 (:latexend:)

Produces:



TrueLatex:
Using image file from cache. You may want to set ForceRender=true for debugging.


4.

 (:latex displaycode+=true verbose=true forcerender=true paperwidth='5' ::eqncounter++:)
 \begin{equation}
    \prod_{n=2}^N\frac{n}{n-1} =  N
 \end{equation}
 (:latexend:)

Produces: [:Example4 :]


\begin{equation}
   \prod_{n=p}^N\frac{n}{n-1} =  \frac{N}{p-1}
\end{equation}


TrueLatex:
Parsing LaTeX: This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex) restricted \write18 enabled. kpathsea: Running mktexfmt pdflatex.fmt mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order): mktexfmt: /usr/share/texlive/texmf-dist/web2c/fmtutil.cnf mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes: mktexfmt: ./.texlive2020/texmf-config/web2c/fmtutil.cnf mktexfmt [INFO]: writing formats under /home4/starstu4/public_html/cgi-bin/subhrajit.net/wiki/pub/latexcache/.texlive2020/texmf-var/web2c mktexfmt [INFO]: --- remaking pdflatex with pdftex mktexfmt: running `pdftex -ini -jobname=pdflatex -progname=pdflatex -translate-file=cp227.tcx *pdflatex.ini' ... This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (INITEX) restricted \write18 enabled. (/usr/share/texlive/texmf-dist/web2c/cp227.tcx) entering extended mode (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/pdflatex.ini (/usr/share/texlive/texmf-dist/tex/generic/tex-ini-files/pdftexconfig.tex) (/usr/share/texlive/texmf-dist/tex/latex/base/latex.ltx (/usr/share/texlive/texmf-dist/tex/latex/base/texsys.cfg) ./texsys.aux found \@currdir set to: ./. Assuming \openin and \input have the same search path. Defining UNIX/DOS style filename parser. catcodes, registers, parameters, LaTeX2e <2020-10-01> patch level 4 ! LaTeX requires expl3. \errmessage {LaTeX requires expl3} \batchmode \read -1 to \reserve... l.1063 } mktexfmt [INFO]: log file copied to: /home4/starstu4/public_html/cgi-bin/subhrajit.net/wiki/pub/latexcache/.texlive2020/texmf-var/web2c/pdftex/pdflatex.log mktexfmt [ERROR]: running `pdftex -ini -jobname=pdflatex -progname=pdflatex -translate-file=cp227.tcx *pdflatex.ini >&2 Extracting image: convert: unable to open image `temp-1.pdf': No such file or directory @ error/blob.c/OpenBlob/3071. convert: no images defined `92b512a7b663c1c925de8080a75e1ee2.png' @ error/convert.c/ConvertImageCommand/3234. ERROR in extracting image!

[:/Example4:]
5.

 (:latex DisplayCode+=true:)\[ f^{ (n) }(a) = {n! \over 2\pi i} \oint_\gamma {f(z) \over
 (z-a)^{n+1}}\, dz \](:latexend:)

Produces:

\[ f^{ (n) }(a) = {n! \over 2\pi i} \oint_\gamma {f(z) \over (z-a)^{n+1}}\, dz \]


6.

 (:div style="background-color:#aaccff":)
 (:latex fontsize=Huge:)
 \[\left(\!\!
   \begin{array}{c}
     n \\
     r
   \end{array}
   \!\!\right) = {^n}C_r = \frac{n!}{r!(n-r)!}
 \]
 (:latexend:) &nbsp;&nbsp;... This formula is displayed on a non-white background.
(:divend:)

Produces:

  ... This formula is displayed on a non-white background.



PmWiki PHP LaTeX

Page last modified on February 18, 2010, at 08:46 AM EST.
(cc) Subhrajit Bhattacharya