This site is a showcase for using LatexRender for mathematics in WordPress

Using LaTeX in WordPress

Online LaTeX Update

Friday 23rd December 2011

Filed under: — Steve @ 4:56 pm

This is an updated version of Online LaTeX where I have checked all the links and removed any that no longer appear to exist.

A PDF version of this post is available here.

A. Images

Unfortunately not every host offers LaTeX but there are sites that can help generate the images that can be downloaded.

  1. CodeCogs LaTeX Equation Editor. This innovative editor has a symbol table for those who are not sure of the LaTeX code as well as allowing the code to be typed directly. It uses Ajax so that the page does not need to be refreshed to see the rendered image. The source code uses LatexRender. See also this post: CodeCogs Equation Editor.
    Hamline University Physics Department Latex Equation Editor is based on the same code, with some innovative additions. Editor Online de Ecuaciones Latex is a Spanish version.
  2. MimeTeX parses a LaTeX maths expression and immediately emits the corresponding gif image such as this c=\sqrt{a^2+b^2}
  3. MathTran is a project by the Open University that intends to “provide translation of mathematical content, from TeX to MathML and vice-versa, and to graphics formats, as a web service”. At the moment only Plain TeX (both text and mathematics) can be converted to an image.
    MathTran instant preview is a web-based TeX system, complete with a built-in help. It compiles Plain TeX code in real time. The source is available at mathtran-javascript.
    Enso TeX Anywhere makes use of MathTran to convert TeX to images in some Windows programs.
  4. Troy Henderson’s LaTeX Previewer makes it clear what is in the preamble when rendering the image and will preview SVG or PNG formats. Other formats such as EPS are available for download. Packages may be added. You can see the log for any errors.
    MetaPost Previewer and Function Grapher allow you to preview and download images and graphs made by MetaPost and which can then be downloaded in a number of formats.
  5. Roger’s Online Equation Editor offers a choice of image formats, background and text colours, resolution, transparency and anti-alias
  6. Texify uses mimeTeX to generate the mage. It can also be used to generate links such as http://texify.com/$E=mc^2$ to the image in text based systems such as email.
  7. mathTeX is as simple to use as mimeTeX but uses LaTeX to generate a higher quality image like this c=\sqrt{a^2+b^2}. If you have LaTeX installed you may prefer to install mathTeX as a cgi program on your system. See also mathTeX Helper, Embedding math with replacemath.js (the latter has a bookmarklet for inserting mathematical images in webmail) and How to Install Latex On Blogger/Blogspot.
  8. HotEqn is a AWT-based Java applet to view and display mathematical equations. Subtitled The IMGless Equation Viewer Applet it cannot be used to create images.
  9. jsTeXrender is a small JavaScript program which will convert LaTeX code inside pre tags to images. This makes it easy to embed mathematics in any HTML page or in PHP programs such as phpBB or WordPress. It is based on CodeCogs and LatexRender.
  10. mathurl is a mathematical version of TinyURL.com. It allows you to reference LaTeXed mathematical expressions using a short url. For example, http://mathurl.com/?5v4pjw will show \displaystyle \int_{-\infty }^{\infty }e^{-x^{2}}\;dx=\sqrt{\pi } which you can then edit. More details on mathurl’s help page
  11. LaTeX for Blogger is a JavaScript add-on for Firefox with Greasemonkey that enables the use of mimeTeX in Blogger posts.
  12. MathBin.net allows you to quickly post mathematics or physics problems in a forum for others to view and reply to and discuss. The posts are long-lived but not permanent.
  13. LaTeX word count provides a word count for complete LaTeX documents or for code fragments, with a number of options for parts of the document and whether or not to include mathematics.
  14. Equations 1.2.1 is an add-on for the email program Thunderbird, which converts LaTeX mathematics into graphics via a Convert button.
  15. Quick LaTeX is a Google gadget that can be added to the iGoogle homepage. It uses mimeTeX to produce the image but it would be quite simple to change the code to use mathTeX or CodeCogs.
  16. TeX2PNG Online converts LaTeX code into PNG, GIF, EPS, or JPEG.
  17. QuickLaTeX.com is a free service which converts LaTeX code to a URL of an image  along with meaningful error messages. More detail, support plus a WordPress plugin can be found at the author’s blog.
  18. jsMath is entitled A Method of Including  Mathematics in Web Pages and uses native fonts, which can be resized, rather than using images. It works best  (but not exclusively) with TeX fonts.
    WordPress and jsMath has instructions for using  jsMath in WordPress blogs.
    Math support in Sphinx can use both image rendering and jsMath for its document generator.
  19. MathJax is an open source, Ajax-based math display solution which can display MathML or TeX code or a     mix of both in the same page. It allows for MathML to be viewed in browsers such as Internet Explorer which don’t have native support and normally require a plug-in. It works with both HTML and XHTML pages. Previews can be found here.
  20. Google Chart Tools will also display LaTeX code. For example, \displaystyle\int_{-\infty}^{\infty}e^{-x^{2}}\;dx=\sqrt{\pi} is given by the URL http://chart.apis.google.com/chart?cht=tx&chl=\displaystyle\int_{-\infty}^{\infty}e^{-x^{2}}\;dx=\sqrt{\pi}
    Various image properties can also be set.
  21. Latex in Word provides macros for use in Microsoft Word which renders LaTeX code into images inserted into a document. The images can be rendered on the author’s remote server or on a local server.
  22. MathQuill is a script which allows maths to be added to a web page and will convert LaTeX code typed into a textbox.
  23. iTeX2Img will convert LaTeX code to a variety of image formats which allows for a choice of font sizes and colours.
  24. Interactive LaTeX Editor renders in near real-time using a choice of servers, CodeCogs, MathJax and Google Chart API. It can save the results between visits.

B. Complete Documents

Complete LaTeX documents can also be compiled online. Here are a few sites I have come across:

  1. LaTeX-Online-Compiler will compile LaTeX documents to postscript, PDF or DVI formats and will generate references. There’s a German language version of the page.
  2. ScienceSoft.at can compile a document to various image formats as well as PDF. The resolution can be adjusted and there are a number of templates. There’s a Flash applet version. Again there’s a German language version.
  3. TeX on Web converts LaTeX and plain TeX documents to Postscript and PDF. It has Czech language support. The instructions are in Czech but the site is still easy to use by non-Czech speakers.
  4. MonkeyTeX allows you to upload, store and convert LaTeX documents to PDF in your own account. This makes it possible to collaborate on documents and you can opt to make your PDF documents public and searchable. You can also upload style, bibtex and other files which you can use when compiling LaTeX documents.
  5. LaTeX Lab is an online version giving a full text editor and compiler complete with menus and toolbars.
    “On the Live environment an installation of MikTeX provides the LaTeX processes and packages. A simple C# class library provides an API for interfacing with the MikTeX tools (for tasks such as TeX-to-PDF conversion) as well as the LaTexLab application database which stores users and corresponding file systems. The C# class library is in turn exposed to the Web as an ASP.NET web service which is consumed via AJAX from the LaTexLab application.”
    The project is very much under development and the project site is at Google Code.
  6. ScribTeX is a free online collaborative LaTeX editor.
    “ScribTeX allows you to work on LaTeX documents from anywhere with internet access and share them with your friends and colleagues easily. Some of the many features of ScribTeX include:

    • Create and edit LaTeX documents and automatically render them to PDFs;
    • Full revision control of all your documents;
    • The choice to keep your documents private, allow people of your choosing to view or edit them, or publish them to world. A fine grained permissions system allows for flexible access control.”
  7. Verbosus is an online LaTeX editor which can”Create and manage your latex projects and generate .pdf files online, directly in your browser, with syntax highlighting.”Registration is required and the service is free for ‘small projects’ using a maximum of 4 resources, though I am uncertain as to the definition of resources.VerbTeX allows you to use Verbosus from an Android device.
  8. Tex Touch is an app for the iPad. It will edit tex documents and then compile them online using the TeX Cloud online compiling service.
  9. iLatex2Rtf/i2rtf attempts to convert tex documents to RTF. It will also accept a zip file containing tex, bbl, aux, images, etc. The site makes it clear that it only provides a ‘good starting editing point’.
  10. ShareLaTeX started in January 2012 and is designed for users to collaborate on documents with changes viewed in real time. It features a customisable editor, simplified error messages, one-click compilation and export of an entire project. It’s in beta at the moment and the site plans to offer a “fully featured free account”.
  11. blue.publications.li is a collaborative LaTeX editor which allows papers to be shared by using a URL. Changes are received by co-authors within 2 seconds.  Compiling using pdflatex or latex is supported.
  12. writeLaTeX is a free collaborative editor which doesn’t require registration. It has a real-time pdf preview, figures, classes and styles can be uploaded and all the document files can be exported in zip format.

C. Other sites

  1. LaTeX word count uses a Perl script to count text words in a LaTeX document and has some options to control the count. I’m not sure how useful a word count is for a typical LaTeX document, but this is an easy way to do so.
  2. WordPress.com offers free hosted blogs with LaTeX facilities similar to LatexRender. See LaTeX — Support — WordPress.com for details.
  3. LaTeX Symbols Converter will convert accented characters and HTML and XML characters into LaTeX code. For example,
    Schrödinger & his cat
    Schr\ödinger \&\#38; his cat

    will both be converted to
    Schr\"{o}dinger \& his cat.
  4. Detexify tries to work out the LaTeX code for any symbol that is mouse-drawn in a box. Thus drawing \sum should give a list of symbols including \sum, \Sigma and \Upsigma. The mode or possible packages required are also listed.
  5. LaTeX table editor and BibTeX editor generate the LaTeX code in real-time for tables and BibTeX.
  6. Pandoc is a converter between many markup formats including LaTeX. Try Pandoc! allows you to convert online small sections of text between these formats.
  7. Uniquation will search the net for simple TeX expressions.
  8. WebEquation recognises handwritten mathematics and translates it into LaTeX and mathML, showing the output . Best used with a tablet or digital stylus and requires a browser that supports HTML5.

Please let me know about similar sites that are worth including here.

LaTeX Web Hosting

Tuesday 23rd October 2007

Filed under: — Steve @ 9:48 am

It is quite difficult to find web hosts who are willing to install LaTeX, so it’s good to read one person’s experience of trying to find a shared host offering LaTeX. (Shared) hosting with LaTeX – An overview gives 7 hosts who gave a positive response.

Update
Following on from Mike Renfro’s comment below recommending A2 Hosting I contacted them to ask about their LaTeX hosting and this is their reply:

“Yes, we either have or can install the LaTeX packages upon request on any particular server. It’s not a problem as long as it does not become a server load issue. We are currently using the CentOS 5 latex package tetex-latex-3.0-33.1.el5 but if anybody wishes to install their own copy of LaTeX locally on their account they can always get the appropriate binary and do that also if they need a different version.

We would certainly be happy to have you point folks in our direction. We will go ahead and add a knowledge base article on the subject as well.”

Online LaTeX

Tuesday 24th April 2007

Filed under: — Steve @ 11:38 am

A more recent version of this post appears here.

Updated 15 July 2011

A PDF version of this post is available here

A. Images

Unfortunately not every host offers LaTeX but there are sites that can help generate the images that can be downloaded.

  1. LaTeX Equation Editor. This innovative editor has a symbol table for those who are not sure of the LaTeX code as well as allowing the code to be typed directly. It uses Ajax so that the page does not need to be refreshed to see the rendered image. The source code uses LatexRender. Update: see CodeCogs Equation Editor.
    Hamline University Physics Department Latex Equation Editor is based on the same code, with some innovative additions. Editor Online de Ecuaciones Latex is a Spanish version. Online LaTeX Equation Editor has modified the code to use mimeTeX.
    (thanks to umustbe and thornahawk for the links).
  2. Bruno Gonçalves – Latex Rendering also has a symbol table and direct typing. It uses mimeTeX for a very useful instant preview and LatexRender for the final high-quality image. Discussion is at Professional looking equations by rendering LaTeX online.
  3. MimeTeX parses a LaTeX maths expression and immediately emits the corresponding gif image such as this c=\sqrt{a^2+b^2}
  4. Troy Henderson’s LaTeX Previewer makes it clear what is in the preamble when rendering the image.
    MetaPost Previewer allows you to preview and download images made by MetaPost in a number of formats. You can see the log for any errors.
  5. MathTran is a new project by the Open University that intends to “provide translation of mathematical content, from TeX to MathML and vice-versa, and to graphics formats, as a web service”. At the moment only Plain TeX (both text and mathematics) can be converted to an image.
    MathTran instant preview is a web-based TeX system, complete with a built-in help. It compiles Plain TeX code in real time. The source is available at mathtran-javascript.
    Enso TeX Anywhere makes use of MathTran to convert TeX to images in some Windows programs.
  6. Roger’s Online Equation Editor offers a choice of image formats, background and text colours, resolution, transparency and anti-alias
  7. Sitmo LaTeX Equation Editor uses realtime rendering. It is a Google gadget so can be added to your website.
  8. Texify uses mimeTeX to generate the mage. It can also be used to generate links such as http://texify.com/$E=mc^2$ to the image in text based systems such as email.
  9. mathTeX is as simple to use as mimeTeX but uses LaTeX to generate a higher quality image like this c=\sqrt{a^2+b^2}. If you have LaTeX installed you may prefer to install mathTeX as a cgi program on your system. See also mathTeX Helper, Embedding math with replacemath.js and How to Install Latex On Blogger/Blogspot.
  10. HotEqn is a AWT-based Java applet to view and display mathematical equations. Subtitled The IMGless Equation Viewer Applet it cannot be used to create images.
  11. Tex2Im is a JavaScript equation editor written by Sergej Zerr which is a web interface to tex2im – the latex to pixmap converter on the server and creates a JPEG image.
  12. jsTeXrender is a small JavaScript program which will convert LaTeX code inside pre tags to images. This makes it easy to embed mathematics in any HTML page or in PHP programs such as phpBB or WordPress. It is based on CodeCogs and LatexRender. An example page can be found at Online JavaScript TeX/LaTeX equation render and documentation at YourEquations.com.
  13. mathurl is a mathematical version of TinyURL.com. It allows you to reference LaTeXed mathematical expressions using a short url. For example, http://mathurl.com/?5v4pjw will show \displaystyle \int_{-\infty }^{\infty }e^{-x^{2}}\;dx=\sqrt{\pi } which you can then edit. More details on mathurl’s help page
  14. LaTeX for Blogger is a JavaScript add-on for Firefox with Greasemonkey that enables the use of mimeTeX in Blogger posts.
  15. MathBin.net allows you to quickly post mathematics or physics problems in a forum for others to view and reply to and discuss. The posts are long-lived but not permanent.
  16. LaTeX word count provides a word count for complete LaTeX documents or for code fragments, with a number of options for parts of the document and whether or not to include mathematics.
  17. Equations 1.2.1 is an add-on for the email program Thunderbird, which converts LaTeX mathematics into graphics via a Convert button.
  18. Quick LaTeX is a Google gadget that can be added to the iGoogle homepage. It uses mimeTeX to produce the image but it would be quite simple to change the code to use mathTeX or CodeCogs.
  19. Latex2png converts LaTeX code into various image formats PNG, GIF, EPS, or JPEG. It includes a menu for inserting code.
  20. QuickLaTeX.com is a free service which converts LaTeX code to a URL of an image  along with meaningful error messages. More detail, support plus a WordPress plugin can be found at the author’s blog.
  21. jsMath is entitled A Method of Including  Mathematics in Web Pages and uses native fonts, which can be resized, rather than using images. It works best  (but not exclusively) with TeX fonts.
    WordPress and jsMath has instructions for using  jsMath in WordPress blogs.
    Math support in Sphinx can use both image rendering and jsMath for its document generator.
    (thanks to Andreas Maier for the links).
  22. LaTeX Composer is an experimental add-on for Firefox. It allows you to see a preview image of LaTeX code before copying the code to a LaTeX-enabled site (the image cannot be copied). Strictly speaking, it isn’t an online application as it installs mimeTeX to the Firefox directory but does offer a simple way of using mimeTeX offline. The program is run inside Firefox and is started using a small icon in the status bar.
  23. MathJax is an open source, Ajax-based math display solution which can display MathML or TeX code or a     mix of both in the same page. It allows for MathML to be viewed in browsers such as Internet Explorer which don’t have native support and normally require a plug-in. It works with both HTML and XHTML pages. Previews can be found here.
  24. Google Chart Tools will also display LaTeX code. For example, \displaystyle\int_{-\infty}^{\infty}e^{-x^{2}}\;dx=\sqrt{\pi} is given by the URL http://chart.apis.google.com/chart?cht=tx&chl=\displaystyle\int_{-\infty}^{\infty}e^{-x^{2}}\;dx=\sqrt{\pi}
    Various image properties can also be set.
  25. Latex in Word provides macros for use in Microsoft Word which renders LaTeX code into images inserted into a document. The images can be rendered on the author’s remote server or on a local server.

B. Complete Documents

Complete LaTeX documents can also be compiled online. Here are a few sites I have come across:

  1. LaTeX-Online-Compiler will compile LaTeX documents to postscript, PDF or DVI formats and will generate references. There’s a German language version of the page.
  2. ScienceSoft.at can compile a document to various image formats as well as PDF. The resolution can be adjusted and there are a number of templates. There’s a Flash applet version. Again there’s a German language version.
  3. LaTeX to PDF uses MiKTeX to convert LaTeX documents to PDF and allows uploading of classes, style files and images.
  4. TeX on Web converts LaTeX and plain TeX documents to Postscript and PDF. It has Czech language support. The instructions are in Czech but the site is still easy to use by non-Czech speakers.
  5. MonkeyTeX allows you to upload, store and convert LaTeX documents to PDF in your own account. This makes it possible to collaborate on documents and you can opt to make your PDF documents public and searchable. You can also upload style, bibtex and other files which you can use when compiling LaTeX documents.
  6. LaTeX Lab is an online version giving a full text editor and compiler complete with menus and toolbars.

    “On the Live environment an installation of MikTeX provides the LaTeX processes and packages. A simple C# class library provides an API for interfacing with the MikTeX tools (for tasks such as TeX-to-PDF conversion) as well as the LaTexLab application database which stores users and corresponding file systems. The C# class library is in turn exposed to the Web as an ASP.NET web service which is consumed via AJAX from the LaTexLab application.”

The project is very much under development and the project site is at Google Code.

  1. ScribTeX is a free online collaborative LaTeX editor.

    “ScribTeX allows you to work on LaTeX documents from anywhere with internet access and share them with your friends and colleagues easily. Some of the many features of ScribTeX include:

    • Create and edit LaTeX documents and automatically render them to PDFs;
    • Full revision control of all your documents;
    • The choice to keep your documents private, allow people of your choosing to view or edit them, or publish them to world. A fine grained permissions system allows for flexible access control.”
  2. Verbosus is an online LaTeX editor which can

    Create and manage your latex projects and generate .pdf files online, directly in your browser, with syntax highlighting.

Registration is required and the service is free for ‘small projects’ using a maximum of 4 resources, though I am uncertain as to the definition of resources.

VerbTeX allows you to use Verbosus from an Android device.

  1. Tex Touch is an app for the iPad. It will edit tex documents and then compile them online using the TeX Cloud online compiling service.

C. Other sites

  1. LaTeX word count uses a Perl script to count text words in a LaTeX document and has some options to control the count. I’m not sure how useful a word count is for a typical LaTeX document, but this is an easy way to do so.
  2. WordPress.com offers free hosted blogs with LaTeX facilities similar to LatexRender. See Can I put Math or Equations in my Posts? for details.
  3. LaTeX Symbols Converter will convert accented characters and HTML and XML characters into LaTeX code. For example,
    Schrödinger & his cat
    Schr\ödinger \&\#38; his cat

    will both be converted to Schr\"{o}dinger \& his cat.
  4. Detexify tries to work out the LaTeX code for any symbol that is mouse-drawn in a box. Thus drawing \sum should give a list of symbols including \sum, \Sigma and \Upsigma. The mode or possible packages required are also listed. The drawing box is not available in Internet Explorer.

Please let me know about similar sites that are worth including here.

Asymptote Support

Sunday 8th April 2007

Filed under: — Steve @ 10:52 pm

Asymptote is a vector graphics language which creates mathematical diagrams and figures and is designed to be used with LaTeX. Hui Chen has adapted LatexRender code to produce an Asymptote plugin for WordPress.

Image Transparency Bug

Saturday 17th March 2007

Filed under: — Steve @ 4:14 pm

Some versions of ImageMagick fail to process the transparency command properly. If you find that this is causing problems for you then in class.latexrender.php remove the transparency command

-transparent "#FFFFFF"

so

// imagemagick convert ps to image and trim picture
$command = $this->_convert_path." -density ".$this->_formula_density." -trim -transparent "#FFFFFF" ".$this->_tmp_filename.".ps ".$this->_tmp_filename.".".$this->_image_format;

becomes

// imagemagick convert ps to image and trim picture
$command = $this->_convert_path." -density ".$this->_formula_density." -trim ".$this->_tmp_filename.".ps ".$this->_tmp_filename.".".$this->_image_format;

Thanks to Kevin Knuth for pointing out this workaround.

Automated Script for LatexRender

Saturday 20th January 2007

Filed under: — Steve @ 9:00 pm

Gunnlaugur Þór Briem has written a bash script which simplifies the installation of the LatexRender plugin for WordPress. It means that you shouldn’t have to worry about those pesky paths which are so easy to trip over. You will find the instructions and script at LaTeX in WordPress.

Vertical Alignment of Images

Friday 22nd September 2006

Filed under: — Steve @ 3:34 pm

The wp-latexrender.zip download now includes an optional offset beta directory. These contain files that implement Mike Boyle’s Inline Offset improvement to the vertical alignment of images. Users may wish to experiment with this and details of the code changes are given in the offset beta/readme_offset.txt file.

Mac Tiger

Monday 5th September 2005

Filed under: — Steve @ 5:48 pm

If you wish to install LatexRender for WordPress on the Mac Tiger operating system, then you will find NeverEndingBooks instructions very helpful.

Odd effects

Thursday 21st July 2005

Filed under: — Steve @ 10:33 am

WordPress is very flexible allowing you to choose various text filters. Unfortunately they can filter the mathematical text as well before it gets converted to an image. The most common effect you see is in matrices (or arrays, tables) where you get

    \begin{pmatrix}
a & 038;b & 038;c & 038;d & 038;e \\
x & 038;\hdotsfor{3} & 038;z
\end{pmatrix}

instead of

    \begin{pmatrix}
a & b & c & d & e \\
x & \hdotsfor{3} & z
\end{pmatrix}

This is because the ampersand has been converted to the equivalent HTML code.

You can solve this problem by changing one line in latex.php. In
// $latex_formula = str_replace("& #38;","&",$latex_formula);
remove the comment // and change 38 to 038 so that the line reads
$latex_formula = str_replace("& #038;","&",$latex_formula);
Please note: In order to show the code here I have had to introduce a space between & and #. That space should not be there in latex.php

Other odd effects can be dealt with similarly.
If you see a8217; instead of a’ then either
1. use ^\prime in your LaTeX code and/or
2. add the line (removing the space between & and #)
$latex_formula = str_replace("& #8217;","'",$latex_formula);
in the same place as the previous one in latex.php

Both alterations appear in the latest download.

Note: If you want to regenerate older images then you will either have to remove them from the cache or change the code slightly eg by putting in an extra space which \LaTeX will ignore

Using cosec

Saturday 2nd April 2005

Filed under: — Steve @ 10:49 pm

British (and who else?)1 prefer to use \cosec x for \frac{1}{\sin x} but \LaTeX doesn’t recognise \cosec as a command. You could use \mathrm{cosec} which produces \mathrm{cosec} or even use Babel, but a very simple method would be to add a line in class.latexrender.php Just after
$string .= "\begin{document}\n";
add the line
$string .= "\newcommand{\cosec}{\operatorname{cosec}}\n";
and then you’ll be able to use \cosec wherever you want eg \cosec^2x=1+\cot^2x

You can find a whole lot more newcommands at Birmingham (UK) University Maths Postgrad Committee’s Latex Commands page

1. Russian Babel has the \cosec command; so who else uses cosec rather than csc?

Chemistry

Saturday 5th March 2005

Filed under: — Steve @ 11:56 pm

Chemists do make use of \LaTeX but they have different typesetting conventions from mathematicians. For example the chemical \cf{H2O} is quite different from the mathematical H_2O . Martin Hensel’s mhchem package allows the easy typing of chemical symbols. Here are some examples taken from mhchem’s documentation. Needless to say, not being a chemist, they don’t mean much to me 🙂

Hover over, or click on a formula, to see the underlying latex code.

\cf{(NH4)2S}

\cf{^{227}_{90}Th+}

\cf{Fe`{III}[Fe`{III}Fe`{II}(CN)6]3}

\cf{2H+,{(aq)}}

\cf{[Cd\{SC(NH2)2\}2].[Cr(SCN)4(NH3)2]2}

\ce{SO4^2- + Ba^2+ -> BaSO4 v}

\ce{Zn^2+
<=>[\ce{+ 2OH-}][\ce{+ 2H+}]
{\underset{\text{amphoteres Hydroxid}}{\ce{Zn(OH)2 v}}} %group!
<=>[\ce{+ 2OH-}][\ce{+ 2H+}]
{\underset{\text{Hydroxozikat}}{\cf{[Zn(OH)4]^2-}}}% group!
}

\ce{{{x\,}} Na(NH4)HPO4 ->[\Delta]
(NaPO3)_{{x}} + {{x\,}} NH3 ^ + {{x\,}} H2O}

Improved Output

Saturday 22nd January 2005

Filed under: — Steve @ 11:09 pm

Benjamin Schwartz has adapted class.latexrender.php to improve the quality of the output. He has used “the PNG format’s support for true alpha blending to make those jagged edges (on non-white background) disappear”. The text colour for both PNG and GIF are customizable as is the background colour for GIFs. The original settings are still available.

You can download the file here and view its effect at Digital Diary of Ben Schwartz. The enhancement works best on dark backgrounds so, if you are using Firefox or Opera then try switching the stylesheet to ‘Dark Fire’ on that page.

Some things to be aware of:

  • the improved output may have a small speed penalty
  • the system will only work with recent versions of ImageMagick (such as 6.1.2)
  • Internet Explorer on Windows does not show PNGs as transparent

Path Problems in Linux

Friday 14th January 2005

Filed under: — Steve @ 3:32 pm

If you can’t get LatexRender to work then comment out the 6 unlink lines in class.latexrender.php with // so that they look like this:
// unlink($this->_tmp_dir."/".$this->_tmp_filename.".tex");
// unlink($this->_tmp_dir."/".$this->_tmp_filename.".aux");
// unlink($this->_tmp_dir."/".$this->_tmp_filename.".log");
// unlink($this->_tmp_dir."/".$this->_tmp_filename.".dvi");
// unlink($this->_tmp_dir."/".$this->_tmp_filename.".ps");
// unlink($this->_tmp_dir."/".$this->_tmp_filename.".".$this->_image_format);

Then look in the /tmp folder you have created and see what files have been created. If there’s a .ps file but no .gif or .png file then it may be because ImageMagick can’t find Ghostscript as detailed in Latexrender for WordPress under Mac OS X.

This is because in Linux, Imagemagick expects to find the gs file (Ghostscript’s binary) in /usr/bin. In fact, it may be in /usr/local/bin or somewhere else. You can either
1. reinstall Ghostscript into /usr/bin
or
2. change the path in Imagemagick’s file to tell it where to look. The file you want is delegates.mgk and might be found in /usr/share/ImageMagick, though this can vary. In this text file just alter /usr/bin/gs to the correct path – there may be 8 of these to change.
or
3. This is probably the simplest method. Make a symbolic link from /usr/bin/gs to /usr/local/bin/gs or wherever gs resides. How do I create a symbolic link?
or
4. See Marcin Gomulka’s comment below. This is great if you don’t have access to the server

Please let me know if this works for your installation.

LatexRender for the Mac OS X

Tuesday 31st August 2004

Filed under: — Steve @ 2:54 pm

Installation of LatexRender using the Mac OS X can be a little tricky. Fortunately, lieven le bruyn has written instructions on how to install it at Latexrender for WordPress under Mac OS X

Make LatexRender XHTML-compliant

Saturday 14th August 2004

Filed under: — Steve @ 10:48 pm

You can ensure LatexRender is XHTML-compliant if you make the small changes here (thanks to d)

LatexRender as a plugin

Monday 9th August 2004

Filed under: — Steve @ 6:02 pm

I have now managed to make LatexRender as a plugin (download files here) which means that it won’t be necessary to edit WordPress files. Before you get too excited this assumes

  1. You are using at least WordPress 1.2 (which uses plugins)
  2. You have the latest files which don’t eat backslashes (detailed on page 2)

If not, you can still use the method in 5th August’s post. Also you will need to put some information about where to find files in the latexrender files.

1. You need to have \LaTeX and ImageMagick installed on your server. If this is not possible, then try mimeTeX (see page 2)

2. latexrender-plugin.php
Ensure that
include_once('/home/path_to/wordpress/latexrender/latex.php');
contains the correct path to where you have put latex.php

3. latex.php
Ensure that
$latexrender_path = "/home/domain_name/public_html/path_to/latexrender";
and
$latexrender_path_http = "/path_to/latexrender";
contain the correct path to where your latexrender files are to go

4. class.latexrender.php
Ensure that
var $_latex_path = "/usr/bin/latex";
var $_dvips_path = "/usr/bin/dvips";
var $_convert_path = "/usr/bin/convert";
var $_identify_path = "/usr/bin/identify";

point to the right places.

For Windows the paths in class.latexrender.php must use \ or / not just a single \
For example
var $_latex_path = "C:\texmf\miktex\bin\latex.exe";
or
var $_latex_path = "C:/texmf/miktex/bin/latex.exe";

5. Create a new latexrender folder in your WordPress folder, with sub folders tmp and pictures. These 2 folders must be chmod to 777. Upload latex.php and class.latexrender.php to the latexrender folder

6. If you are happy to let commenters use LaTeX (but beware spammers) then in latexrender-plugin.php remove // from the line:
// add_filter(‘comment_text’, ‘addlatex’);

7. Upload latexrender-plugin.php to WordPress’s plug-in folder (/wp-content/plugins) and activate it in the Plugins menu

\LaTeX should now be enabled! Use [tex ] and [/tex ] (without the space) to surround your maths. There’s a tex button to do this for you.

Using LaTeX in WordPress

Thursday 5th August 2004

Filed under: — Steve @ 6:59 pm

This is how you can use LatexRender in WordPress. Assuming you have \LaTeX and Imagemagick setup on your server and have downloaded latexrender.zip then:
1. In the download folder, otherPHP/latexrender you just need the 2 files
latex.php and class.latexrender.php
a) in latex.php ensure that
$latexrender_path = "/home/domain_name/public_html/path_to/latexrender";
contains the correct path to where your latexrender files are to go
Change
$latexrender_path_http = "/latexrender";
so it says
$latexrender_path_http = "/path_to/latexrender";

(more…)


 

This site is a showcase for using LatexRender for mathematics in WordPress