Jump to content

Download: ipbLatex


Cap'n Refsmmat

Recommended Posts

File Name: ipbLatex
File Submitter: Cap'n Refsmmat
File Submitted: 05 Oct 2010
File Category: Miscellaneous XML Files

ipbLatex enables the use of LaTeX mathematical typesetting on your forum, providing professional-looking equations with comparatively simple syntax. You can see some examples of the results at my forum -- click on the equations to see how they were created.

ipbLatex is fast, efficient, and easy to install. Features:

  • Normal display math — the $$ math $$ environment in LaTeX.
  • Inline math, as in the $math$ environment.
  • Typeset chemical equations, using mhchem.
  • PNG and GIF output, with customizable background colors and transparency.
  • 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
  • Caching of every equation
  • As many LaTeX packages as you want to use
  • There is experimental support for PGF, but it is not enabled and incomplete, so you’d have to finish it yourself.

Note there are some requirements:
  • A working distribution of LaTeX. This kind of goes without saying – if you’re using Linux, look into the TeXlive distribution.
  • You absolutely must have a copy of dvipng installed. This plugin will not work without it.
  • If you want GIF output, then dvipng must have GIF support compiled into it. Things may otherwise break. Versions supplied as a part of many distributions will have this support.
  • The mhchem package needs to be accessible by LaTeX; either put the mhchem.sty file in the tmp directory or install the package properly. It is not bundled with ipbLatex by default (although this may change in the future).
  • mogrify is recommended for prettier images. If you do not have mogrify, be sure to set ‘resample’ to FALSE as instructed in the configuration. You’ll want to change ‘density’ and ‘gamma’ to the recommended values in the comment above if you cannot use mogrify.

For installation instructions and more detailed information on support, features, and use, see my blog. Important note on support: I am a student. The blog post gives contact info, but I cannot guarantee a speedy reply, so please be careful. Install on a test board first, for safety -- LaTeX can be fickle.

Click here to download this file
Link to comment
  • 5 months later...

It works great! On my local laptop (Ubuntu) backup install. Really really cool.

I decided to do the same for my live version (Fedora).

I had to install Texlive on my VPS fedora, I have all of the other requirements, changed the config to the correct paths... but nothing.

I keep getting,

[LaTeX Error: Syntax error ]


I tried to look at the source code to look for debug clues, but I'm stumped.

Is there anything obvious you would try?

Thanks.

Link to comment

I tried to look at the source code to look for debug clues, but I'm stumped.



Is there anything obvious you would try?



Thanks.



Yes, you can get the LaTeX error output if necessary. Go to class.latex-vb.php in the custom BBCode directory and find:

   	function error($errorcode, $detail, $chdir=false)

    	{

            	$err = 'Error: ';

In that function, comment out this line:

                    	$this->cleanTmpDir();



Now you can go to the LaTeX base directory (configured at the top of class.latex-vb.php) and go into the tmp/ directory. The LaTeX output will be there, including the .log files that include the full error message and details.

Link to comment

Yes, you can get the LaTeX error output if necessary. Go to class.latex-vb.php in the custom BBCode directory and find:



   	function error($errorcode, $detail, $chdir=false)

    	{

            	$err = 'Error: ';

In that function, comment out this line:

                    	$this->cleanTmpDir();

Now you can go to the LaTeX base directory (configured at the top of class.latex-vb.php) and go into the tmp/ directory. The LaTeX output will be there, including the .log files that include the full error message and details.

Hi thank you for the quick response. I commented out that line, and for a simple [latex]\pi[/latex] i can see the following tex file contents generated.


\documentclass[18pt]{article}

\pagestyle{empty}

\usepackage{amsmath}

\usepackage{amsfonts}

\usepackage{amssymb}

\usepackage{color}

\usepackage{slashed}

\begin{document}

\[ \pi \]

\end{document}

It compiles from the command line when I do apply latex command to that file. On the error log, I'm not sure where you mean. Do you mean the base defined here,


var $path = array(

                // Applications

                'latex' =>      '/usr/bin/latex',

                'dvipng' =>     '/usr/bin/dvipng',

                'mogrify' =>    '/usr/bin/mogrify',





im not able to find a log file in /usr/bin/latex, is there somewhere else I can look?

Thanks.

Link to comment

There's just a .tex file? Interesting.

You should ensure that your webserver process (Apache or whatever) has permissions to read files in tmp and img, and that it has permissions to run LaTeX at all. Try using 'su' to become the webserver user, then run LaTeX manually on that output file. A syntax error will be thrown if the script can't read the output file or run LaTeX.

Link to comment

There's just a .tex file? Interesting.



Yup, only a .tex file.


You should ensure that your webserver process (Apache or whatever) has permissions to read files in tmp and img, and that it has permissions to run LaTeX at all.



Can I ask how I would check this?


Try using 'su' to become the webserver user, then run LaTeX manually on that output file. A syntax error will be thrown if the script can't read the output file or run LaTeX.




The latex code seemed to run ok.


This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010) (format=latex 2011.3.12)  12 MAR 2011 18:15

entering extended mode

 restricted \write18 enabled.

 %&-line parsing enabled.

**2efa5ec1bdb15fa7ebd52d41d581fcb6.tex

(./2efa5ec1bdb15fa7ebd52d41d581fcb6.tex

LaTeX2e <2009/09/24>

Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, ge

rman-x-2009-06-19, ngerman-x-2009-06-19, afrikaans, ancientgreek, ibycus, arabi

c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis

h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis

h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,

 icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or

iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,

 lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol

ish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, spani

sh, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded.

(/usr/local/texlive/2010/texmf-dist/tex/latex/base/article.cls

Document Class: article 2007/10/19 v1.4h Standard LaTeX document class

(/usr/local/texlive/2010/texmf-dist/tex/latex/base/size10.clo

File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)

)

\c@part=\count79

\c@section=\count80

\c@subsection=\count81

\c@subsubsection=\count82

\c@paragraph=\count83

\c@subparagraph=\count84

\c@figure=\count85

\c@table=\count86

\abovecaptionskip=\skip41

\belowcaptionskip=\skip42

\bibindent=\dimen102

)

(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsmath.sty

Package: amsmath 2000/07/18 v2.13 AMS math features

\@mathmargin=\skip43


For additional information on amsmath, use the `?' option.

(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amstext.sty

Package: amstext 2000/06/29 v2.01


(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsgen.sty

File: amsgen.sty 1999/11/30 v2.0

\@emptytoks=\toks14

\ex@=\dimen103

))

(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsbsy.sty

Package: amsbsy 1999/11/29 v1.2d

\pmbraise@=\dimen104

)

(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsopn.sty

Package: amsopn 1999/12/14 v2.01 operator names

)

\inf@bad=\count87

LaTeX Info: Redefining \frac on input line 211.

\uproot@=\count88

\leftroot@=\count89

LaTeX Info: Redefining \overline on input line 307.

\classnum@=\count90

\DOTSCASE@=\count91

LaTeX Info: Redefining \ldots on input line 379.

LaTeX Info: Redefining \dots on input line 382.

LaTeX Info: Redefining \cdots on input line 467.

\Mathstrutbox@=\box26

\strutbox@=\box27

\big@size=\dimen105

LaTeX Font Info:    Redeclaring font encoding OML on input line 567.

LaTeX Font Info:    Redeclaring font encoding OMS on input line 568.

\macc@depth=\count92

\c@MaxMatrixCols=\count93

\dotsspace@=\muskip10

\c@parentequation=\count94

\dspbrk@lvl=\count95

\tag@help=\toks15

\row@=\count96

\column@=\count97

\maxfields@=\count98

\andhelp@=\toks16

\eqnshift@=\dimen106

\alignsep@=\dimen107

\tagshift@=\dimen108

\tagwidth@=\dimen109

\totwidth@=\dimen110

\lineht@=\dimen111

\@envbody=\toks17

\multlinegap=\skip44

\multlinetaggap=\skip45

\mathdisplay@stack=\toks18

LaTeX Info: Redefining \[ on input line 2666.

LaTeX Info: Redefining \] on input line 2667.

)

(/usr/local/texlive/2010/texmf-dist/tex/latex/amsfonts/amsfonts.sty

Package: amsfonts 2009/06/22 v3.00 Basic AMSFonts support

\symAMSa=\mathgroup4

\symAMSb=\mathgroup5

LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'

(Font)                  U/euf/m/n --> U/euf/b/n on input line 96.

)

(/usr/local/texlive/2010/texmf-dist/tex/latex/amsfonts/amssymb.sty

Package: amssymb 2009/06/22 v3.00

)

(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/color.sty

Package: color 2005/11/14 v1.0j Standard LaTeX Color (DPC)


(/usr/local/texlive/2010/texmf-dist/tex/latex/latexconfig/color.cfg

File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive

)

Package color Info: Driver file: dvips.def on input line 130.


(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/dvips.def

File: dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)

)

(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/dvipsnam.def

File: dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)

))

(/usr/local/texlive/2010/texmf-dist/tex/latex/carlisle/slashed.sty

Package: slashed 1997/01/16 v0.01 Feynman Slashed Character Notation (DPC)

)


LaTeX Warning: Unused global option(s):

    [18pt].


No file 2efa5ec1bdb15fa7ebd52d41d581fcb6.aux.

\openout1 = `2efa5ec1bdb15fa7ebd52d41d581fcb6.aux'.


LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.

LaTeX Font Info:    ... okay on input line 8.

LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.

LaTeX Font Info:    ... okay on input line 8.

LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.

LaTeX Font Info:    ... okay on input line 8.

LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.

LaTeX Font Info:    ... okay on input line 8.

LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.

LaTeX Font Info:    ... okay on input line 8.

LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.

LaTeX Font Info:    ... okay on input line 8.

LaTeX Font Info:    Try loading font information for U+msa on input line 9.

(/usr/local/texlive/2010/texmf-dist/tex/latex/amsfonts/umsa.fd

File: umsa.fd 2009/06/22 v3.00 AMS symbols A

)

LaTeX Font Info:    Try loading font information for U+msb on input line 9.


(/usr/local/texlive/2010/texmf-dist/tex/latex/amsfonts/umsb.fd

File: umsb.fd 2009/06/22 v3.00 AMS symbols B

) [1


]

(./2efa5ec1bdb15fa7ebd52d41d581fcb6.aux) ) 

Here is how much of TeX's memory you used:

 1380 strings out of 493764

 16825 string characters out of 3144998

 61066 words of memory out of 3000000

 4715 multiletter control sequences out of 15000+200000

 5339 words of font info for 22 fonts, out of 3000000 for 9000

 715 hyphenation exceptions out of 8191

 27i,5n,22p,249b,112s stack positions out of 5000i,500n,10000p,200000b,50000s


Output written on 2efa5ec1bdb15fa7ebd52d41d581fcb6.dvi (1 page, 296 bytes).

Link to comment

Yup, only a .tex file.




Can I ask how I would check this?


Go into the latex directory (the one containing tmp and img) and run the command

ls -l



and post the results. Also, tell me what user the webserver runs as -- "nobody"? "www-data"? I'll be able to read the ls -l output and tell you if you need to change the permissions.

Link to comment

Go into the latex directory (the one containing tmp and img) and run the command


ls -l

and post the results. Also, tell me what user the webserver runs as -- "nobody"? "www-data"? I'll be able to read the ls -l output and tell you if you need to change the permissions.


root@vps11239 [/home/myusername/public_html/latex]# ls -l

total 16

drwxrwxrwx  4 myusername myusername 4096 Mar 12 16:42 ./

drwxr-x--- 41 myusername nobody   4096 Mar 12 16:39 ../

drwxrwxrwx  2 myusername myusername 4096 Mar 12 14:08 img/

drwxrwxrwx  2 myusername myusername 4096 Mar 12 19:31 tmp/

root@vps11239 [/home/myusername/public_html/latex]# 

webserver runs as nobody,


drwxr-x--- 41 myusername nobody    4096 Mar 12 16:39 public_html/





Is this any good?

Link to comment

Very strange. Are you absolutely certain you have dvipng and mogrify installed on your server?




They seem to be installed.


root@vps11239 [/home/myusername/public_html]# whereis dvipng

dvipng:

root@vps11239 [/home/myusername/public_html]# dvipng --help

This is dvipng 1.13 Copyright 2002-2010 Jan-Ake Larsson


Usage: dvipng [OPTION]... FILENAME[.dvi]

Options are chosen to be s


root@vps11239 [/home/myusername/public_html]# whereis mogrify

mogrify: /usr/bin/mogrify /usr/share/man/man1/mogrify.1.gz


Link to comment

Also latex


root@vps11239 [/home/myusername/public_html]# whereis latex

latex:

root@vps11239 [/home/myusername/public_html]# latex -help

Usage: pdftex [OPTION]... [TEXNAME[.tex]] [COMMANDS]

   or: pdftex [OPTION]... \FIRST-LINE

   or: pdftex [OPTION]... &FMT ARGS

  Run pdfTeX o



it seems whereis records for latex and dvipng dont exist, but somehow, you can see they are installed and give a response when called

Link to comment

Okay, that's good.

In class.latex-vb.php, find:

		$command = $path['latex']." --interaction=nonstopmode ".$this->tmp_filename.".tex && ".

		       	$path['dvipng']." -q -D ".$this->dvipng['density']." -T tight -gamma ".$this->dvipng['gamma']." -bg ".$this->dvipng['background']." -o $filename ".$this->tmp_filename.".dvi";

and add immediately afterward:

file_put_contents("/home/myusername/public_html/latex/tmp/testlog", $command);



Then run a few tests and go over to the "testlog" file and see what it contains. Take that command, switch into the webserver user ("su nobody") and try executing it in tmp. See what errors you get.

Link to comment

Okay, here is some more information. :)

My texlive installation is under /usr/local/texlive/2010/bin/x86_64-linux/ and thats where the binary is, not /usr/bin,
dvipng, mogrify are present in the /usr/bin/ directory.

I still get the [LaTeX Error: Syntax error ] :(


 'latex' =>      '/usr/local/texlive/2010/bin/x86_64-linux/latex',

                'dvipng' =>     '/usr/bin/dvipng',

                'mogrify' =>    '/usr/bin/mogrify',

Test file contents


/usr/local/texlive/2010/bin/x86_64-linux/latex --interaction=nonstopmode 2c6b49a08ef8164561f5186a6ef91699.tex && /usr/bin/dvipng -q -D 300 -T tight -gamma 2.0 -bg Transparent -o 4f08e3dba63dc6d40b22952c7a9dac6d-1.png 2c6b49a08ef8164561f5186a6ef91699.dvi

Link to comment

I could not run the command as nobody, as "account currently not available" it said. Ran it as root, found this.



Output written on 2c6b49a08ef8164561f5186a6ef91699.dvi (1 page, 296 bytes).


Transcript written on 2c6b49a08ef8164561f5186a6ef91699.log.


-bash: /usr/bin/dvipng: No such file or directory





Hmmm now im not sure where dvipng is on my system, take a look at this!
It is installed and I am able to call it, just don't know where it is.


root@vps11239 [/usr/bin]# whereis dvipng


dvipng:


root@vps11239 [/usr/bin]# ls dvi*


dvipdf*


root@vps11239 [/usr/bin]# dvipng -help


This is dvipng 1.13 Copyright 2002-2010 Jan-Ake Larsson



Usage: dvipng [OPTION]... FILENAME[.dvi]


Options a.....


Link to comment

FIXED.

IM SOOOOOO grateful for your help.

It works now,


var $path = array(


// Applications


'latex' => '/usr/local/texlive/2010/bin/x86_64-linux/latex',


'dvipng' => '/usr/local/texlive/2010/bin/x86_64-linux/dvipng',


'mogrify' => '/usr/bin/mogrify',






I'm not used to fedora, the lack of whereis on dvipng and latex threw me...and I assumed they were in /usr/bin/.


In my server, I had to download the texlive installation file, as i could not find it through YUM.

For anyone else in future who has the same problem, look in /usr/local/texlive/2010/bin/x86_64-linux

Thanks again!!!


:)

Great plugin!
Link to comment
  • 1 year later...
  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...