{"id":176,"date":"2010-08-26T22:14:41","date_gmt":"2010-08-27T03:14:41","guid":{"rendered":"http:\/\/blogs.scienceforums.net\/capn\/?p=176"},"modified":"2010-08-26T22:14:41","modified_gmt":"2010-08-27T03:14:41","slug":"releasing-ipblatex","status":"publish","type":"post","link":"http:\/\/blogs.scienceforums.net\/capn\/2010\/08\/26\/releasing-ipblatex\/","title":{"rendered":"Releasing ipbLatex"},"content":{"rendered":"<p>At SFN, we use a custom LaTeX solution to render LaTeX equations in Invision&#8217;s IP.Board. The implementation is based on Dave&#8217;s <a title=\"vbLatex\" href=\"http:\/\/xyloid.org\/projects\/vblatex\/\">vbLatex<\/a>, which produces incredibly nice-looking equations so long as you have LaTeX installed. It also supports inline chemical equations using the mhchem package.<\/p>\n<p>Since we moved to IPB over vBulletin, I&#8217;ve adapted vbLatex to IPB, given it a few shiny new features, and now I&#8217;m releasing it under the LGPL as Dave has done with his earlier work.<\/p>\n<p>You can see examples of ipbLatex at work in our <a href=\"http:\/\/www.scienceforums.net\/topic\/3751-quick-latex-tutorial\/\">LaTeX tutorial<\/a>; click the equations for the fancy pop-up effect.<\/p>\n<p><!--more--><strong>Disclaimer<\/strong><\/p>\n<p>The only testing this has received has been on SFN, and so I cannot guarantee it will work everywhere. I have only tested it on IPB 3.1. <strong>This may break your board<\/strong> or cause other weird problems, including possibly data loss. You&#8217;ve been warned.<\/p>\n<hr \/>\n<p><strong>Features<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Lots! ipbLatex supports:<\/p>\n<ul>\n<li>Normal display math &#8212; the $$ math $$ environment in LaTeX.<\/li>\n<li>Inline math, as in the $math$ environment.<\/li>\n<li>Chemistry, using mhchem.<\/li>\n<li>PNG and GIF output.<\/li>\n<li>A popup showing the raw LaTeX code upon clicking on an image, allowing users to find out how a LaTeX equation was made so they can type their own<\/li>\n<li>Caching of every equation<\/li>\n<li>As many LaTeX packages as you want to use<\/li>\n<\/ul>\n<ul>\n<li>There is experimental support for PGF, but it is not enabled and incomplete, so you&#8217;d have to finish it yourself.<\/li>\n<\/ul>\n<hr \/>\n<p><strong>Requirements<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Stolen from Dave&#8217;s vbLatex documentation:<\/p>\n<ul>\n<li>A working distribution of LaTeX. This kind of goes without saying \u2013 if you\u2019re using Linux, look into the TeXlive distribution.<\/li>\n<li>You absolutely <strong>must<\/strong> have a copy of <a href=\"http:\/\/savannah.nongnu.org\/projects\/dvipng\/\">dvipng<\/a> installed. This plugin <strong>will not work<\/strong> without it.<\/li>\n<li>If you want GIF output, then dvipng <strong>must<\/strong> have GIF  support compiled into it. Things may otherwise break. Versions supplied  as a part of many distributions will have this support.<\/li>\n<li>The <a href=\"http:\/\/www.ctan.org\/tex-archive\/help\/Catalogue\/entries\/mhchem.html\">mhchem<\/a> package needs to be accessible by LaTeX; either put the <em>mhchem.sty<\/em> file in the <em>tmp<\/em> directory (see below) or install the package properly. It is <strong>not<\/strong> bundled with ipbLatex by default (although this may change in the future).<\/li>\n<li>mogrify is recommended for prettier images. If you do not have mogrify, be sure to set &#8216;resample&#8217; to FALSE as instructed in the configuration. You&#8217;ll want to change &#8216;density&#8217; and &#8216;gamma&#8217; to the recommended values in the comment above if you cannot use mogrify.<\/li>\n<\/ul>\n<hr \/>\n<p><strong>Download It<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The .tar.gz is available <a href=\"http:\/\/www.scienceforums.net\/etc\/ipbLatex.tar.gz\">here<\/a>, under the LGPLv2. License terms are included in the download.<\/p>\n<p>The source is hosted on <a href=\"https:\/\/github.com\/capnrefsmmat\/ipbLatex\">GitHub<\/a> as well, if you&#8217;d like to submit patches or browse through.<\/p>\n<hr \/>\n<p><strong>Installation<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>(Again, partially stolen from Dave&#8217;s documentation.)<\/p>\n<ol>\n<li>Create a folder somewhere web-accessible to hold all of your generated images. You need to create two sub-directories called <em>tmp<\/em> and <em>img<\/em> inside this folder, and make them <strong>both<\/strong> world-writable.<\/li>\n<li>Extract the archived ZIP file somewhere. Carefully read through the configuration in <em>class.latex-vb.php<\/em> (at the beginning of the file) and fill in all required sections. <strong>Make sure your paths are correct and agree with step 1<\/strong>.<\/li>\n<li>Upload the <em>class.latex.php<\/em> and <em>ipbLatex.php<\/em> files to the <em>\/admin\/sources\/classes\/bbcode\/custom<\/em> directory of your IP.Board installation.<\/li>\n<li>Open <em>templates.txt<\/em>. To enable the LaTeX popup feature, which allows your users to see the LaTeX code that generated a formula by clicking it, you need to edit your default templates. You&#8217;ll have to do this for every style you have installed. Simply follow the directions in <em>templates.txt<\/em>.<\/li>\n<li>Head to your administration panel, to Look &amp; Feel -&gt; BBCode Management. Scroll to the bottom, at Import New BBCodes. Browse and select the <em>bbcode.xml<\/em> file that came with the plugin. Install it.<\/li>\n<li>That&#8217;s it!<\/li>\n<\/ol>\n<p>By default, the plugin uses the [latex] and [math] tags as synonyms, with [imath] and [ce] representing inline math and chemical equations, respectively. You can add additional synonyms as aliases in IPB&#8217;s BBCode editor, but note that [imath] and [ce] are hardcoded, and they won&#8217;t work if you change the aliases for those.<\/p>\n<p>With ipbLatex installed, you should be able to use LaTeX anywhere that BBCode can be used &#8212; personal messages, in the forums, and wherever. All images are stored in the <em>img<\/em> directory you create for all time, so you may wish to periodically cull that directory. (If a user previews their post, then changes an equation before posting it, the old equation will remain for all time.) At SFN we commonly see an <em>img<\/em> directory of over 20,000 images, so be careful opening it in your FTP client or you may cause it to hang. If images are deleted, never fear, ipbLatex will merely recreate once the posts are viewed.<\/p>\n<p>If you need extra LaTeX packages for additional features, you can always add more to the &#8216;extrapackages&#8217; list in the configuration. By default, the AMS math packages are loaded, as well as color and slashed.<\/p>\n<hr \/>\n<p><strong>Support?<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>I&#8217;m a student, so I don&#8217;t have the time to officially support this. However, you&#8217;re free to leave a comment here, using your email address (which is not publicly shared) and I&#8217;ll get back to you if I can. Alternately, email me at alex at scienceforums dot net, and I&#8217;ll try to get back to you. No guarantees &#8212; I have a finite amount of spare time.<\/p>\n<p>Remember: The <em>img<\/em> and <em>tmp<\/em> directories you create in step 1 <strong>must<\/strong> be writable by your webserver. You <strong>must<\/strong> have dvipng.<\/p>\n<p>Finally, thanks to Dave for the excellent software that this has been based on, and the support and bugfixes as I have developed ipbLatex. And thanks to everyone at SFN for tolerating me as I break things, fix them, and break them again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At SFN, we use a custom LaTeX solution to render LaTeX equations in Invision&#8217;s IP.Board. The implementation is based on Dave&#8217;s vbLatex, which produces incredibly nice-looking equations so long as you have LaTeX installed. It also supports inline chemical equations using the mhchem package. Since we moved to IPB over vBulletin, I&#8217;ve adapted vbLatex to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":0,"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"wp:attachment":[{"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blogs.scienceforums.net\/capn\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}