[#10227] Support LaTeX Rendering
Summary Support LaTeX Rendering
Queue IMP
Queue Version Git master
Type Enhancement
State Accepted
Priority 1. Low
Owners
Requester r_reitzi@cs.uni-kl.de
Created 2011-06-10 (3100 days ago)
Due
Updated 2011-07-26 (3054 days ago)
Assigned
Resolved
Milestone
Patch No

Comments
r_reitzi@cs.uni-kl.de 2011-06-10 18:22:49
I send and receive lots of emails containing formulae, most of the 
time set in (pseudo) LaTeX for sake of mutual understanding. 
Obviously, reading plain LaTeX code is not optimal.

Horde could easily render LaTeX in mails (notes, ...). If it were to 
use MathJax, including one Javascript file in appropriate places would 
be sufficient.

(Supporting mathy mails might make Horde even more attractive to techy 
folk than it already is. While you are at it, think about syntax 
highlighting, too. ;))

Michael Slusarz <slusarz@horde.org> 2011-06-14 18:03:11
> I send and receive lots of emails containing formulae, most of the 
> time set in (pseudo) LaTeX for sake of mutual understanding. 
> Obviously, reading plain LaTeX code is not optimal.
>
> Horde could easily render LaTeX in mails (notes, ...). If it were to 
> use MathJax, including one Javascript file in appropriate places 
> would be sufficient.

This can easily be accomplished by creating a Horde_Mime_Viewer driver.

> (Supporting mathy mails might make Horde even more attractive to 
> techy folk than it already is. While you are at it, think about 
> syntax highlighting, too. ;))

We already support syntax highlighting.  See the syntaxhighlighter 
driver (horde/config/mime_drivers.php).

r_reitzi@cs.uni-kl.de 2011-06-20 20:21:35
> This can easily be accomplished by creating a Horde_Mime_Viewer driver.
If I understand correctly what a Mime driver is, this would enable 
Horde to display entire LaTeX files. Or do you mean one could write an 
alternative for the standard plain driver to handle LaTeX?

To be clear: I was thinking of parsing standard math environments like 
$...$ or \[...\] using some backend.

> We already support syntax highlighting.  See the syntaxhighlighter 
> driver (horde/config/mime_drivers.php).
Indeed, thanks for the pointer. But again, it "only" highlights syntax 
in attached files, doesn't it?

Michael Slusarz <slusarz@horde.org> 2011-06-22 04:57:55
>> This can easily be accomplished by creating a Horde_Mime_Viewer driver.
> If I understand correctly what a Mime driver is, this would enable 
> Horde to display entire LaTeX files. Or do you mean one could write 
> an alternative for the standard plain driver to handle LaTeX?
>
> To be clear: I was thinking of parsing standard math environments 
> like $...$ or \[...\] using some backend.

A Mime Driver takes input data, and outputs a (normally) text/html 
representation of the contents.

>> We already support syntax highlighting.  See the syntaxhighlighter
>> driver (horde/config/mime_drivers.php).
> Indeed, thanks for the pointer. But again, it "only" highlights 
> syntax in attached files, doesn't it?

Yes.  But that's what you asked for in the original ticket posting.  A 
syntax highlighter is not supposed to do anything else (e.g. render 
the data).

r_reitzi@cs.uni-kl.de 2011-07-25 20:04:22
> A Mime Driver takes input data, and outputs a (normally) text/html 
> representation of the contents.
For attached files but not the text part, right? If so, that is not 
the point of this ticket (see above).

> Yes.  But that's what you asked for in the original ticket posting.   
> A syntax highlighter is not supposed to do anything else (e.g. 
> render the data).
No, this is never what I wanted to propose (although my wishes might 
have been ambiguous wrt syntax highlighting).

Michael Slusarz <slusarz@horde.org> 2011-07-26 18:00:24
>> A Mime Driver takes input data, and outputs a (normally) text/html
>> representation of the contents.
> For attached files but not the text part, right?

Wrong.  A Mime Driver takes any input data and outputs a text/html 
representation of contents.

There is no difference between "attached files" and text parts.  They 
are all the same.  Every part is an attachment, and every attachment 
is a message part.

Essentially, there are two ways to handle a message part - allow a 
user to download the raw data to be handled by their local computer, 
or to attempt to parse this data and produce some sort of useful 
output.  The former is essentially the download button, the latter is 
what a Mime Viewer does.

>> Yes.  But that's what you asked for in the original ticket posting.
>> A syntax highlighter is not supposed to do anything else (e.g. render
>> the data).
> No, this is never what I wanted to propose (although my wishes might 
> have been ambiguous wrt syntax highlighting).

I guess I have no idea what you are talking about then.  If you are 
talking about syntax highlighting the rendered data inside of a Latex 
file, this is not syntax highlighting as the term is commonly used.   
Syntax highlighting refers to marking up source code based on the 
language's grammar - which we (should) already support for latex files.

r_reitzi@cs.uni-kl.de 2011-07-26 18:13:31
> Wrong.  A Mime Driver takes any input data and outputs a text/html 
> representation of contents.
>
> There is no difference between "attached files" and text parts.   
> They are all the same.  Every part is an attachment, and every 
> attachment is a message part.
I see now, thanks. Yes, a MIME driver could solve the problem.

It is a lot easier, though, if you use MathJax: if you include their 
JS, it automatically parses all LaTeX it can find. See 
http://www.mathjax.org/docs/1.1/start.html#mathjax-cdn
I was just not able to find the place where I had to include the 
script tag because apparently code that creates a "simple" mail 
viewing frame is scattered over dozens of files (in Imp 4.3.4; was not 
able to install the newest version yet.)

> I guess I have no idea what you are talking about then.  If you are 
> talking about syntax highlighting the rendered data inside of a 
> Latex file, this is not syntax highlighting as the term is commonly 
> used.  Syntax highlighting refers to marking up source code based on 
> the language's grammar - which we (should) already support for latex 
> files.
Syntax Highlighting was not mentioned wrt LaTeX. Let's forget I 
brought this up at all because it is not important for this ticket.