Using PFG/TIKZ with Redmine

The Wiki external filter is a very handy redmine plugin. I'm using it for drawing diagrams with PGF/TIKZ . Here are some notes on how to do it.

System Ubuntu 11.04 Redmine 1.2.0

Install external tools/scripts

Name Purpose Install
Latex/Tikz document typesetting & drawing tools sudo apt-get install texlive-latex-extra pgf pdf2svg dvipng
Latex tool interfaces wiki external plugin and latex latextool.sh

Install filter

I'm using an extra ruby installation (Ruby Enterprise Edition), where the current user has write permissions to, so I don't need to sudo before gem commands.

# optional ruby package (used for debugging in case things go wrong)
gem install POpen4
#---[ installing plugin ]---
cd vendor/plugins
git clone https://github.com/ndl/wiki_external_filter.git
cd ../../config/
wget https://www.hostedredmine.com/attachments/download/5214/wiki_external_filter.yml
rake db:migrate:plugins RAILS_ENV=production
# applying patch 
cd ../../lib/redmine/
# this patch also works for redmine 1.2.0
wget http://www.ndl.kiev.ua/downloads/redmine-1.0.2-macros-escaping.patch
# or a copy from https://www.hostedredmine.com/attachments/5478/redmine-1.0.2-macros-escaping.patch
# please do a 'patch --dry-run' before to ensure it can be patched
patch  -p3  < redmine-1.0.2-macros-escaping.patch

Configure cache storage

In file config/environments/production.rb append:

config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/cache" 

And set e.g.

caching expiration time = 30

at http://<host>:<port>/settings/plugin/wiki_external_filter

Setup CSS (optional)

I've configure the macro {{le()}} for small latex excerpts. The following css fix vertical alignment in this case.

public/stylesheets/application.css

div.wiki img.externalfilterinline {
  vertical-align: top;
}

References

wiki_external_filter.yml Magnifier - custom config for using latextool.sh (3.28 KB) Alx A, 2011-07-03 01:09 AM

latextool.sh Magnifier (4.32 KB) Alx A, 2011-07-09 10:09 PM

redmine-1.0.2-macros-escaping.patch Magnifier (3.71 KB) Alx A, 2011-07-09 10:11 PM