How to Configure DruTeX

Introduction

How to install and configure Drupal's TeX implementation, DruTeX. We localize DruTeX files within their site directories (rather than in a global Drupal-wide directory) so sites are self-contained.

Procedure

Install and Configure PEAR Wiki Filter

  1. Download and unpack the PEAR Wiki filter module in the sites/all/ directory.
  2. Site Building -> Modules -> Enable the PEAR Wiki filter module.

Install and Configure DruTeX

  1. Download and unpack the DruTeX module in the sites/all/ directory.
  2. Site Building -> Modules -> Enable the DruTeX module.
  3. User management -> Permissions -> Grant authenticated users and above rights to access DruTeX stuff.
  4. Localize the DruTeX module settings:
    
    Site Config -> DruTeX Settings ->
       Temporary directory: sites/wiki.cse.buffalo.edu.cse545_6/files/tmp
       Conversion method: custom
       Conversion Method (Custom): [fully-qualify the paths to the latex and dvipng binaries]
    
  5. Create a DruTeX input format:
    
    Site Config -> Input Formats -> Add Input Format ->
       Name: DruTeX
       Roles: [authenticated user and above]
       Filters: DruTeX, PEAR Wiki Filter
       Save Configuration
    
    
  6. Configure the DruTeX input format:
    
    Site Config -> Input Formats -> DruTeX -> Configure
       Configure tab->
    
          PEAR Wiki filter
             Path of PEAR packages: /usr/local/www/drupal6/sites/all/modules/pearwiki_filter/
             Format: MediaWiki
             Compatibility
                Allow HTML? [unchecked]
                Ignore tags: equation equations math tex
             Wikilinks
                Use wiki links? [checked]
                Replacement for Spaces: -
                Base path for wikilinks: /wiki
                Use wikitools? [checked]
             Images
                Base path for images: sites/wiki.cse.buffalo.edu.cse545_6/files/tex
                Use image module? [checked]
    
          DruTeX Submodules:
             LaTeX Renderer
             LaTeX to HTML
             PDF Generator
             Line break converter
    
          DruTeX :: Base Settings
             Temporary directory: /tmp
             Image directory: sites/wiki.cse.buffalo.edu.SITENAME/files/tex
             Image URL: sites/wiki.cse.buffalo.edu.SITENAME/files/tex
    
          DruTeX :: LaTeX Renderer
             Conversion Method: custom
             Conversion Method (Custom): [fully qualify latex and dvipng binary pathnames]
    
          DruTeX :: PDF Generator
             Conversion Command: [fully qualify pdflatex binary pathname]
    
       Rearrange Tab ->
          PEAR Wiki Filter
          DruTeX
    
    
  7. Teach DruTeX to understand MediaWiki-style <math> tags. Add this rule to drutex_render.inc, around line 114:
    
      /*  environment */
      $E[] = (object) array(
          'pattern' => '@]*)?>(.+?)@se',
          'replacement' => "'$1' . drutex_render('$ $2 $', 'format')",
          'weight' => -3
      );
    
    

References

  1. http://drupal.org/project/drutex
  2. http://drupal.org/project/pearwiki_filter
  3. DruTeX Documentation
  4. <math> mediawiki tag support
  5. Is there a way to reset all png images?