# TeX Live 2010 and Thunderbird add-on LaTeXIt! don't cooperate

I am using the Thunderbird email client on Windows and I have TeX Live 2010. I have tried the Thunderbird add-on LaTeXIt! (to insert equations as images in emails). (This is not the Mac tool LaTeXiT, just to avoid confusion.)

However, the developer seems only to support MiKTeX and not TeX Live. When trying to use it in Thunderbird, e.g. putting in a simple $a^2$, I get an error message. The message below is from the LaTeXIt! tool:

LatexIt! run report...

*** Found expression $a^2$

$PATH is My computer path (I have deleted the info here) *** Generating LaTeX expression: \documentclass{article} \usepackage[latin1]{inputenx} \usepackage[T1]{fontenc} \begin{document}$a^2\$ %this is where your LaTeX expression goes
\end{document}

I ran C:\texlive\2010\bin\win32\latex.exe -output-directory=C:\DOCUME~1\yogcal\LOCALS~1\Temp -interaction=batchmode C:\DOCUME~1\yogcal\LOCALS~1\Temp\tblatex-1.tex error code 1

LaTeX process returned 1
Proceeding anyway...
Severe error. Missing package?
We left the .tex file there: C:\DOCUME~1\yogcal\LOCALS~1\Temp\tblatex-1.tex, try to run latex on it by yourself...
--> Failed, not inserting

And here is the log file

This is pdfTeX, Version 3.1415926-1.40.11 (Web2C 2010) (format=latex 2011.2.28)  18 JUL 2011 08:26
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**C:/DOCUME~1/yogcal/LOCALS~1/Temp/tblatex-1.tex
! Emergency stop.

\protect
C:/DOCUME~
1/yogcal/LOCALS~1/Temp/tblatex-1.tex
*** (job aborted, file error in nonstop mode)

Here is how much of TeX's memory you used: (info deleted here)

Of course, I can compile the LaTeX file tblatex-1.tex generated in the temp folder very well with TeX Live 2010 without any problems but LaTeXIt! apparently cannot.

I am posting this question here as maybe someone can provide me with useful information on what is happening during the compilation process.

Any suggestions?

Update:

This is what I get when running the command as LaTeXIt! did:

 C:\texlive\2010\bin\win32>latex.exe -output-directory=C:\DOCUME~1\yogcal\LOCALS~1\Temp -interaction=batchmode C:\DOCUME~1\yogcal\LOCALS~1\Temp\tblatex-1.tex
This is pdfTeX, Version 3.1415926-1.40.11 (Web2C 2010)
restricted \write18 enabled.
entering extended mode
C:\texlive\2010\bin\win32>

And there is no compilation.

If I move the file tblatex-1.tex to C:\, then compilation is fine. I believe that the error is due to the location where the file tblatex-1.tex is placed by LaTeXIt! i.e. in

C:\Documents and Settings\yogcal\Local Settings\Temp

Maybe the spacing in the folder names is creating this problem. And there is not way to change this in the option of LaTeXIt! to C:\

-
There's a trobleshooting section at the author's Github. Also, when you compiled the .tex file manually, did you use the same command line as the addon? That is, did you start a command prompt, then run c:\texlive\2010\bin\win32\latex.exe -output-directory=... as shown in the debug output? – Mike Renfro Jul 18 '11 at 11:23
Thanks. I have updated my post with new information and possibly what is causing this behaviour. 1 vote up. – yCalleecharan Jul 19 '11 at 5:30
The effort this addon is making to ensure no spaces in the folders may be unnecessary. I don't have an XP system at the moment to test on, but on one Win7 system, a command like latex -output-directory="c:\users\me\desktop\1 2" -interaction=batchmode "c:\users\me\desktop\1 2\foo.tex" works fine. There should be a reasonably easy fix to test in the addon code, but I'll have to look for it later. – Mike Renfro Jul 19 '11 at 13:16
I am trying to solve the same problem but I have got extension install problem like this: Thunderbird n'a pas pu installer le fichier situé à file:///C:/MARTIN/FTP/latex_it-0.6.xpi raison : Script d'installation non trouvé -204 – user8435 Oct 7 '11 at 20:30
The file that I have is tblatex.xpi and now it doesn't work with the latest thunderbird version 7.0.1 – yCalleecharan Oct 17 '11 at 12:04

The problem line appears to be in content/main.js, line 144 (line number accurate as of 2011/07/22, may be different in the future). Try the following steps:

1. Find the LaTeX-It xpi file. It's actually a renamed .zip file, so you'll need to uncompress it to edit its files. 7-Zip will extract the file without renaming, but worst case, you can rename the .xpi file to a .zip extension and then uncompress it into its own folder.

2. In the file content/main.js, replace lines 144-147 with var temp_dir="c:\\temp"; temp_file = init_file(temp_dir); where the first statement refers to any writable temporary folder with a simple path. Make sure to double any backslashes in the path, since Javascript uses the backslash character to escape things like newlines, tabs, etc.

3. Recompress the extracted folder into a .zip, then rename it to have a .xpi extension. Replace the old .xpi file with your updated one.

4. At the author's GitHub site, post a bug report asking for better support of tildes in paths, or a feature request asking for the ability to override the default temporary folder with one of your choosing.

-
Thanks for your suggestions. This can work. However I do not know where to find the file main.js for the LaTeX-It plugin. 1vote up in the meantime. All there is about this plug-in is an .xpi file – yCalleecharan Jul 20 '11 at 6:08
A .xpi file is just a .zip file. Rename it if necessary (7-Zip doesn't care if you do), extract its files, make the changes, re-zip the modified contents, and rename it back to a .xpi extension if needed. – Mike Renfro Jul 20 '11 at 16:23
Thanks. With your first option, LaTeX-it can find the math expression but no compilation is done. Should there be a dot after "C\\temp"? The second option doesn't work---I get the same output as in my post. – yCalleecharan Jul 21 '11 at 5:36
There should at least be a semicolon after the assignment, which I'm adding to my answer now. Keep in mind I'm talking about setting the var temp_dir to a literal (and short) string, so lines 145-146 on the original are going to be removed entirely. So the next line would be temp_file = init_file(temp_dir);, and everything else would be untouched. – Mike Renfro Jul 21 '11 at 13:12
I have tried your first option. And it works. I presume that I need to try either your first option or your second one and NOT both. – yCalleecharan Jul 22 '11 at 6:57

I'm the author. Both changes seem valid:

• allowing to customize the TEMP path,
• changing the default template.

If you guys could send me a pull request on GitHub (or at least send me an email with a full-fledged path), that would be fantastic.

-
Also if there's a way I can figure out whether I'm dealing with Miktex or Texlive, I'd like to hear about it. It would be great for that (that being setting the TEMP directory to c:\temp) to happen automatically. – Jonathan Protzenko Aug 4 '11 at 18:07
Welcome to TeX.sx! If you ask a new separate question, you'll be more likely to get an answer. – Caramdir Aug 4 '11 at 20:53

When running the fixed code from @Mike, I could notice that LaTeX-it was returning a full page. It doesn't seem right to have say just one line of LaTeX code on a full empty page. Here is a way to fix the problem: Change the pre-existing template in LaTeX-it "options" to the following instead:

 \documentclass[12pt]{article}
\pagestyle{empty}
\parindent=0pt
\usepackage[latin1]{inputenx}
\usepackage[T1]{fontenc}
\begin{document}
__REPLACEME__ %this is where your LaTeX expression goes
\end{document}


This template will give a cropped page size tightly wrapped about the LaTeX expression.

Note: This is not an answer to my original question but this issue has come up after LaTeX-it began working thanks to the solution of @Mike. And I have accepted his solution.

-