## Feature #1994

### LaTEX support in Wiki, Forums and Issues

Status:NewStart date:2008-10-06
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Wiki
Target version:-
Resolution:

Description

Latex support could be included especially in Wiki pages, so that Latex expressions could be displayed as images in Wiki. Specifically, I want to use Redmine Wiki as means of documentation tool for mathematical methods that are used within a multi-precision library. I could not find a way to display equations in Wiki (Textile does not support mathematical expressions as far as I know)

### History

#### #1 Updated by Thomas Lecavelierover 12 years ago

A new point for a redmine made of modules: since only few users could have need of LaTeX in redmine, it would be marvelous that redmine admins has choice between different plugin to act as wiki.

#### #2 Updated by Murat Ozkanover 12 years ago

That would work I think. Another option may be a plugin which enables LaTeX if such a thing is needed. (such as TracMathPlugin)

#### #3 Updated by Luiz Carlos Juniorabout 12 years ago

I am also interested in this functionality. For the implementation of mathematical models, it is essential to have Math/LaTeX support in Wiki.

#### #4 Updated by Anh Kỳ Huỳnhabout 12 years ago

Luiz Carlos Junior wrote:

For the implementation of mathematical models, it is essential to have Math/LaTeX support in Wiki.

I agree.

For one who will write the plugin please look at jsMath. It's fun and simple

#### #5 Updated by Michael Ayeabout 12 years ago

+1 for general use of Latex
+1 for choosability as a switch-on/switch-off plugin (but previous +1 is more important. hehe :)

+1 for Latex.

#### #7 Updated by Carlos de la Torreabout 11 years ago

+1 to LaTeX support.

I'm new to Redmine and I really need this kind of feature. I cannot have Nisrael's redmine-wiki_latex_plugin to work.

Anyone knows if there's an important update in this sense?

+1 for Latex.

#### #9 Updated by Andrzej Giniewiczabout 11 years ago

Anh Kỳ Huỳnh wrote:

Luiz Carlos Junior wrote:

For the implementation of mathematical models, it is essential to have Math/LaTeX support in Wiki.

I agree.

For one who will write the plugin please look at jsMath. It's fun and simple

I also think that jsMath is way to go!

#### #10 Updated by Brian Schimmelover 10 years ago

There already seems to be a redmine plugin which implements this, see http://www.redmine.org/boards/3/topics/4987

I did not test it yet, but wanted to report it now in case I forget to do so after testing.

#### #11 Updated by Peter Lawrenceover 10 years ago

Regarding note 10. I've developed a plugin using jsmath and mathjax see http://github.com/PeterLawrence/redmine_jsequation_macros
Even thought this renders equations well in wiki pages and issues, it does not function for preview, pdf or atom feeds. It's only really a solution for when you have problems installing the latex plugin, for example on a windows based system.

#### #12 Updated by Ling Lialmost 10 years ago

I like Peter's plugin that uses MathJax (note-11). With MathJax, the displayed equations are beautiful and scalable. I also made changes regarding points raised in note-1 and note-2.

The new plugin (attached as a single file) defines a macro that enables the LaTeX math support via MathJax on a page-by-page basis. For example,

{{EnableLaTeXMath}}
This is a math equation: $x_{1,2} = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$
The first line enables math on the page; after that one is free to write LaTeX equations.

Compared to the suggestions in note-10 and note-11, I think this
• is simpler to use (no {{latex(...)}} or {{mathjax(...)}} every time an equation is needed),
• doesn't have problems with line breaks or curly brackets in the equations, and
• naturally supports both inline-style and display-style equations.

And I believe it works for preview too.

#### #13 Updated by Phil Rutschmanalmost 10 years ago

I successfully used Ling Li's plugin. While it does correctly working during preview the first time, subsequent previews do not. This appears to be because MathJax's onload handler is only invoked during initial configuration. Subsequent previews are running within the same DOM, and MathJax does not reconfigure itself.

I was able to work around this by explicitly enqueuing a typeset operation from within the script to dynamically load MathJax. This operation will fail (silently) in the usual case that MathJax is being loaded for the first time. There may well be a more elegant way to handle this, but it seems to work.

--- vendor/plugins/latex_math/init.rb    2011-04-11 00:48:43.000000000 -0700
+++ vendor/plugins/latex_math_preview_hack/init.rb    2011-04-11 00:48:29.000000000 -0700
@@ -48,6 +48,7 @@
else {script.text = config}

+  try { MathJax.Hub.Queue([\"Typeset\",MathJax.Hub]); } catch (err) {};
})();
//]]>
</script>"

#### #14 Updated by Marton Danoczyover 9 years ago

I tried Ling's plugin with Phil's patch and it works absolutely great, thanks! What about packaging it up, publishing it on http://www.redmine.org/plugins and closing this ticket?

#### #15 Updated by Marton Danoczyover 9 years ago

Btw, is it possible to enable MathJax by default in every page, i.e. without having to type {{EnableLaTeXMath}} each time?

#### #16 Updated by Michael Boratkoabout 9 years ago

I have created a simple plugin which enabled MathJax for all pages (without typing {{EnableLaTeXMath}}) and also works on previews.

https://github.com/process91/redmine_latex_mathjax

It is admittedly fairly crude in the way that it updates previews; essentially there is a jQuery function which watches the preview div for changes and makes a call to MathJax when it is changed. The inclusion of jQuery could be avoided, I'm only using it for this one purpose, but the bigger performance hit (though it's really theoretical, I don't notice any actual decrease in performance) is that jQuery has to poll repeatedly for changes to the preview box.

Notes about the plugin / things you can modify:
+                $('#preview').contentChange(function() { try { MathJax.Hub.Typeset(); } catch (err) {}} ); Now it works fine. Thanks for the plugin, Michael. #### #28 Updated by Michael Boratkoover 8 years ago Thanks for the updated code, Carsten. I have applied your changes to the repo. #### #29 Updated by Billy Tover 8 years ago Michael Boratko wrote: Thanks for the updated code, Carsten. I have applied your changes to the repo. Is this plugin working on 2.x? #### #30 Updated by Michael Boratkoover 8 years ago Billy T wrote: Is this plugin working on 2.x? Unfortunately I don't have the time to test it out. I imagine it would be, but I don't have a 2.x setup right now. Perhaps you could try it and let us know? #### #31 Updated by hannes waderabout 8 years ago ## Using MathJax¶ The most easy way to integrate Latex with Redmine is to integrate MathJax You just need to paste these two lines into the file app/layouts/base.html.erb <script type="text/x-mathjax-config"> MathJax.Hub.Config({tex2jax: {inlineMath: [['$','\$'], ['\$','\$']]}});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

and it works perfectly!

I am not familiar with Plugin development, but if its possible to extend the main layout this way, that it would be a very nice, simple and small plugin. :)

#### #32 Updated by Michael Boratkoabout 8 years ago

Billy T wrote:

Is this plugin working on 2.x?

It now works on 2.x https://github.com/holidayworking/redmine_latex_mathjax

#### #33 Updated by C Tibirnaabout 8 years ago

Michael Boratko wrote:

Billy T wrote:

Is this plugin working on 2.x?

It now works on 2.x https://github.com/holidayworking/redmine_latex_mathjax

No, it doesn't. The original source is still https://github.com/process91/redmine_latex_mathjax , but it was not updated to 2.x. It only needs

(09:52:38) [tibirnao@walter]:redmine_latex_mathjax> git diff
diff --git a/init.rb b/init.rb
index d19303c..f3d5be1 100644
--- a/init.rb
+++ b/init.rb
@@ -1,5 +1,5 @@
require 'redmine'

+::Rails.logger.info 'Redmine LaTeX MathJax'

Redmine::Plugin.register :redmine_latex_mathjax do
name 'Redmine Latex MathJax'

I sent a pull request.

#### #34 Updated by Michael Boratkoabout 8 years ago

Thank you, merged.

#### #35 Updated by C Tibirnaover 7 years ago

And all of a sudden, MathJax stopped working on Redmine 2.3.1.

Other versions: Ruby 1.8.7, Rails 3.2.13, redmine_latex_mathjax 0.1.0.

I didn't notice immediately that it doesn't work anymore. It might be due to one of the updates in the last 7 months. There is no error in the redmine log, nor anywhere else I could look at.

Does anybody use MathJax successfully with Redmine 2.3.1?

#### #36 Updated by C Tibirnaover 7 years ago

And all of a sudden, MathJax stopped working on Redmine 2.3.1.

Other versions: Ruby 1.8.7, Rails 3.2.13, redmine_latex_mathjax 0.1.0.

I didn't notice immediately that it doesn't work anymore. It might be due to one of the updates in the last 7 months. There is no error in the redmine log, nor anywhere else I could look at.

Does anybody use MathJax successfully with Redmine 2.3.1?

#### #37 Updated by C Pacherover 7 years ago

MathJax also stopped working on our Redmine 1.4.4 (approx two weeks ago).

So it might be related to MathJax itself?

#### #38 Updated by Michael Boratkoover 7 years ago

I believe this is fixed now. The problem was that I had used an unofficial link for the MathJax javascript (I'm not sure why I had done that). In any event, it seems this unofficial source no longer hosts MathJax. A user "crax" on GitHub had pointed this out and corrected the link to use the official CDN, and I just merged his changes so things should now be working. Please update the plugin and let me know if there is still an issue. Sorry for the latency in my reply.

#### #39 Updated by Tobias Verbekeabout 7 years ago

For the record, and as reported on Github, there seems to be an issue (?) with redmine 2.4.2. Anyone has it working with 2.4.2?

#### #40 Updated by Marius BALTEANUover 2 years ago

• Private changed from No to Yes

#### #41 Updated by Marius BALTEANUover 2 years ago

• Private changed from Yes to No

Also available in: Atom PDF