Table of Contents

DokuTeXit

DokuTeXit is a DokuWiki plugin that generates a PDF file from the wiki data. It depends on LaTeX which is mandatory to generate the PDF document.

This plugin is still experimental: Feedback and criticism are appreciated. Contact me at Danjer@doudouke.org.

The plugin content is :

  • a LaTeX rendering class (latex.php),
  • a dokuwiki specific wrapper (syntax.php),
  • a configuration/admin plugin (admin.php),
  • a renderer plugin (renderer.php),
  • some class tools.

The goal of this plugin, is to give dokuwiki users the ability to get a decent printable version of their documents. Some examples:

  • If you are a student, when you get to write a paper, thanks to dokuwiki you can write it from everywhere and get a good looking printable version.
  • Allow several people to work on the same document, to make it alive, at anytime you can with a click get a printable version to show your work to your boss or customers.

Download

Basic Idea

Creating PDF based on HTML is not really good and the simplest and most important reason is because their purpose and usage are not the same. Why should we do a chaining conversion ?

Graph

During the chaining conversion process we will loose most of the formatting information. Let’s then keep DokuWiki Format as our root Format.

Graph

DokuTeXit is a good way to export dokuwiki format to PDF.

DokuTeXit Playground

DokuTeXit PlayGround

You can also use this playground to show me up some bugs.

I see a lot’s peoples do some tests with specifics characters languages like Russian, German, Finish, Hungarian. I can’t do a latex configuration to support all languages, but if someone tweak one in dokuTeXit configuration, please send it to me. I’ll include it the plugin package. I design this plugins to have one latex config by language.

Language Babel Option(s) Have a DokuTeXit Config
Afrikaans afrikaans NO
Bahasa bahasa NO
Basque basque NO
Breton breton NO
Bulgarian bulgarian NO
Catalan catalan NO
Croatian croatian NO
Czech czech NO
Danish danish NO
Dutch dutch YES
English english, australian, newzealand, etc... Yes Default
Esperanto esperanto NO
Estonian estonian NO
Finnish finnish NO
French french, francais, canadien, acadian Yes
Galician galician NO
German austrian, german, germanb, ngerman, naustrian Yes
Greek greek, polutonikogreek NO
Hebrew hebrew NO
Hungarian magyar, hungarian NO
Icelandic icelandic NO
Interlingua interlingua NO
Irish Gaelic irish NO
Italian italian NO
Latin latin NO
Lower Sorbian lowersorbian NO
North Sami samin NO
Norwegian norsk, nynorsk NO
Polish polish NO
Portuguese portuges, portuguese, brazilian, brazil NO
Romanian romanian NO
Russian russian NO
Scottish Gaelic scottish NO
Spanish spanish NO
Slovakian slovak NO
Slovenian slovene NO
Swedish swedish NO
Serbian serbian NO
Turkish turkish NO
Ukrainian ukrainian NO
Upper Sorbian uppersorbian NO
Welsh welsh NO

Supported features

DokuWiki

Works pretty well :

  • Headings
  • Bulleted lists
  • Ordered lists
  • Bold
  • Italics
  • Underline
  • Superscript
  • Subscript
  • Deleted
  • Short tables (with heading and align)
  • Footnotes
  • Inline and separate-line teletype text
  • Code blocks
  • Typography
  • Images
  • Syntax highlighting
  • Externals Links
  • Smileys
  • Interwiki icons
  • Acronyms (as Footnotes)

May have strange layout :

  • Internals Links
  • Images Links
  • Very long/big tables
  • Quotting (It’s really sucks)

Not supported :

  • Line break in tables
  • Footnotes in tables
  • Animated Smileys
  • Embedded HTML and PHP
  • Windows platforms (It may work)

LaTeX

You can freely set :

  • Language (babel options)
  • Papersize A4/Letter
  • New Typography like ‘LaTeX’ (see PDF version)
  • Your own LaTeX commands
  • Header and footer
  • Document style and options

Technicals principles

The main goal is have a nice looking printable version of a DokuWiki pages. LaTeX is a good choice.

LaTeX renderer

To avoid lots of parsing troubles and because dokuwiki is very well thought, LaTeX renderer is directly plugged into the dokuwiki framework.

LaTeX generation

To obtain good flexibilty, LaTeX generation is split into 5 parts :

  • Begin/Header
  • Command
  • Document
  • DokuWiki LaTeX Renderer mode
  • Footer

Graph

Begin/Header

This part controls everything before ‘\begin{document}‘. You can add LaTeX packages there. You may choose your babel options or change the document class (Default options is for two-side print and A4 format).

Command

The Command part control LaTeX commands which use by TeXit to generate the LaTeX file. You can add LaTeX newcommands that you can use in your document. LaTeX command generated by the LaTeX renderer can be overloaded. So you can change headers and footers, color, font styles... etc.

Document

The Document part controls everything just after ‘\begin{document} You can choose the layout of the begin of your document. You can define where you want the table of contents.

DokuWiki LaTeX Renderer mode

LaTeX code is generated from dokuwiki format.

Footer

The Footer part control the end of the LaTeX file. You may want define table of contents here. Last line of this field MUST BE ‘\end{document}

Installation

Alternatively, see the installation notes by Frisco Rose under http://wiki.splitbrain.org/wiki:debian_notes

Prerequisites

  • Of course you need DokuWiki installed and running.
  • DokuTeXit needs a working installation of LaTeX, Ghostscript.
  • If you are on a Debian box,
    # apt-get install tetex-base latex-ucs tetex-extra imagemagick gs-common

    should be sufficient to install the required packages

    • Recommended: install also tetex-extra
    • Note: Make sure latex-ucs is installed. It’s not really a standard package. We need it because DokuWiki uses UTF-8 to store its data, so you also have to enable latex to handle UTF-8.
  • If you are on a Ubuntu box,
    # apt-get install tetex-base texlive-latex-recommended tetex-extra imagemagick gs-common
    • Note: texlive-latex-recommended provide latex-ucs to enable latex to handle UTF-8.
  • If you are on a gentoo 2006.1 box, add USE=”... tetex unicode jpeg jpep2k tiff wmf png gs” into file /etc/make.conf and run
    sudo emerge tetex latex-unicode imagemagick ghostscript

Installation with plugin manager

Installation from command line, without darcs

  $>  cd dokuwiki
  $>  mkdir lib/plugins/dokutexit
  $> cd /tmp
  $> wget http://danjer.doudouke.org/dokutexit.tar.gz
  $> tar zxvf dokutexit.tar.gz
  $> cp -R dokutexit ${YOUR_DOKU_ROOT}/lib/plugins
  $> chmod +x ${YOUR_DOKU_ROOT}/lib/plugins/dokutexit
  $> rm -rf dokutexit

Troubleshooting

LaTeX Packages

fguill

You may need french quotation mark fguill if you don’t use french in babel’s options. You can find this package here :
http://lcr.math.ist.utl.pt/tetex/texmf/tex/latex/fguill/fguill.sty

I you can disable this dependency by removing theses lines in DokuTeXit entities configurations :

<<	{\guillemotleft}
>>	{\guillemotright}

Test Latex installation

Example dokuwiki contents

Quick Start

First action is to go in DokuTeXit admin plugin and save configuration.

To activate TeXit plugins you just have to add this at the beginning of your document :

<texit info>
author=MySelf
title=MyTitle
</texit>

Once you saved the page, you will see that button :

Click on it, to begin generation process. If it’s successful you will see this button :

Add some LaTeX

You can add some LaTeX commands any where in you document like this :

<texit>
\newpage
</texit>

Advanced use

You can also use this syntax in your wiki document :

title=My title
author=Myself
subject=subject
keywords=Me and my life
recurse=on
keyword meaning values default
title Add to PDF properties & Latex document title string first level one header
subject Add to PDF properties string title is used
author Add to PDF properties & Latex document string no default
keywords Add to PDF properties string no default
date Latex document string generation date
recurse Add internals links as appendix on/off/chapter off
recurse_file Add internals media non image as appendix on/off off
backgroundtext Add background text on each page string DOKU_URL
usetablefigure Put table in a figure/float on/off off
tablerowlength This values is used to change tables layout number 100
tablemaxrows This values is used to change tables layout number 30
biggesttableword Obscur parameter that can change, sometimes, tables layout number 15

Export URL

DokuTeXit support export commands (Renderer Plugins) with Dokuwiki 2007-06-26. So you can call dokutexit with this kind of url :

http://url..?...do=export_dokutexit
http://url..?...do=export_dokutexit&dokutexit_type=zip
http://url..?...do=export_dokutexit&dokutexit_type=pdf

This feature is usefull to do an export to pdf button

Image layout

Image layout with LaTeX could quickly turns into a nightmare. Once you tried to do that with latex you will really appreciate any WYSIWYG editors. To make it easier with dokutexit I put some rules to generate something close to a web browser layout :

  1. An image with a title or centered is not wrapped with the text,
  2. An image without a title and not centered is wrapped with text.

Other Rendering Plugins

Other rendering plugins can be used along with DokuTeXit if they support LaTeX rendering mode. I have modified Dokuwiki graphviz plugin in that way.

Basically, it’s easier to add latex mode into a syntax plugins than

How to make a patch for a syntax plugin that do not support latex mode ?

First find the render function in the syntax.php, it’s should look like this :

function render($mode, &$renderer, $data) {
  if ($mode == 'xhtml' /* &&... */) {
    //Build xhtml
    // ...
    $renderer->doc .= $xhtml_stuff;
    return true;
  }
  return false;
}

Then you just have to add the latex mode :

function render($mode, &$renderer, $data) {
  if ($mode == 'xhtml' /* &&... */) {
    //Build xhtml
    // ...
    $renderer->doc .= $xhtml_stuff;
    return true;
  }
  if ($mode == 'latex' /* &&... */) {
    //Build latex
    // ...
    $renderer->doc .= $latex_stuff;
    return true;
  }
  return false;
}

Graphviz

Tips

Use this in your graphviz for better rendering :

bgcolor=transparent

LaTeX

To use LaTeX formula in you dokuwiki and your PDF document you must do the following :

grab this plugin from : http://wiki.erazor-zone.de/doku.php?id=wiki:projects:php:dokuwiki:plugins:latex

and patch it like this :

*** lib/plugin/latex/syntax.php.org      Fri Nov 23 11:10:15 2007
--- lib/plugin/latex/syntax.php  Fri Nov 23 13:38:34 2007
***************
*** 99,104 ****
--- 99,110 ----
          }
          return true;
        }
+       if($mode == 'latex' && strlen($data[0]) > 1) {
+        $renderer->doc .= "$";
+        $renderer->doc .= $data[0];
+        $renderer->doc .= "$\n";
+          return true;
+        }
        return false;
      }

This patch already exist in darcs version.

Installation with plugin manager

Tips

Please keep in your mind that LaTeX plugins is more permissive than dokutexit. Dokutexit will stop at any error and it’s intentional. But I’ll try to make this work for basic cases.

Remember that using ‘\\’ (linebreak command) in formula is BAD, especially if you have the LaTeX Error: There’s no line here to end.

You can add texit tag to add some formating stuff (pretty hugly in that case) :

<texit>
\begin{figure}[h]
\begin{center}
</texit>

<latex>
\frac{3}{4 \pi}   \sqrt{4 \cdot x^2   12} \newline
\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6} \newline
\it{f}(x) = \frac{1}{\sqrt{x} x^2} \newline
e^{i \pi} + 1 = 0
</latex>

<texit>
\end{center}
\caption{Wonderful math formula}
\end{figure}
</texit>

Graph

Or you can escape latex math mode to make better layout :

<latex>
$
\begin{eqnarray*}
2x^2 + 3(x-1)(x-2)&=&2x^2 + 3(x^2-3x+2)\\
&=& 2x^2 + 3x^2 - 9x + 6\\
&=& 5x^2 - 9x + 6
\end{eqnarray*}
$
</latex>

Graph

In that case ‘\\’ means end of array/tabular.

Include

I make this patch to add latex mode support inside the include plugin. You must use the last version of dokutexit to use this patch.

*** syntax.php.org      Mon Nov 26 11:37:07 2007
--- syntax.php  Tue Nov 27 10:30:36 2007
***************
*** 104,111 ****
      } elseif ($mode == 'metadata'){
        if (!$flg_macro) $renderer->meta['relation']['haspart'][$id] = $exists;
        $include->pages = array(); // clear filechain - important!
! 
        return true;
      }
   
      return false;  
--- 104,132 ----
      } elseif ($mode == 'metadata'){
        if (!$flg_macro) $renderer->meta['relation']['haspart'][$id] = $exists;
        $include->pages = array(); // clear filechain - important!
!       
        return true;
+     } elseif ($mode == 'latex') {
+       $latex_info = $renderer->get_info();
+       $include->setLevel($renderer->get_clevel());
+       $include->renderer =& $renderer;
+ 
+       if ($texit =& plugin_load('texitrender', 'dokutexit')) {
+       $include->ins = p_cached_instructions($include->page['file']);
+ 
+       // show only a given section?
+       if ($include->page['section'] && $include->page['exists']) 
+         $include->_getSection();          
+ 
+       // convert relative links
+       $include->_convertInstructions();
+ 
+       // get latex content
+       $latex = $texit->p_render('latex', $include->ins, $latex_info);
+       $renderer->doc .= $latex;
+       } else {
+       msg("Can't load Dokutexit from include plugins\n", -1);
+       }
+       return true;
      }
   
      return false;  

Installation with plugin manager

Issues

I have still issues with this. After I click generate PDF, the PDF is generated correctly, but the wiki-page is empty afterwards (at least the inclusions are not there). After a “refresh” everything is ok. Is there a simple fix to that in the patch above ??

<texit info>
author=DAP1 Team
title=Praktikumsblatt 0
</texit>

|Tags {{tag>praktikum blätter einführung}}|

====== Praktikumsblatt 0 ======

^ [[praktikum-0809-00|Blatt]] | [[praktikum-0809-00-loesung|Lösung]] | [[praktikum-0809-00-drehbuch|Drehbuch]] |

{{section>intern:blaetter:praktikumsblaetter:aufgaben:erste_schritte#Erste Schritte&nofooter&noeditbtn}}

{{section>intern:blaetter:praktikumsblaetter:aufgaben:ein_zweites_programm#Ein zweites Programm&nofooter&noeditbtn}}

{{section>intern:blaetter:praktikumsblaetter:aufgaben:umsetzung_der_praesenzaufgabe#Umsetzung der Präsenzaufgabe&nofooter&noeditbtn}}

Color

This is a small patch to add latex mode for color plugin. http://wiki.ioslo.net/dokuwiki/color

*** syntax.php.org      Wed Dec  5 14:49:14 2007
--- syntax.php  Wed Dec  5 14:43:37 2007
***************
*** 69,77 ****
        $renderer->doc .= '<span style="color: '.$data[1].'">'.$data[0].'</span>';
        return true;
      }
      return false;
    }
   
  }
-  
-  
--- 69,96 ----
        $renderer->doc .= '<span style="color: '.$data[1].'">'.$data[0].'</span>';
        return true;
      }
+     if($mode == 'latex' && strlen(trim($data[0])) > 0) {
+       if ($texit =& plugin_load('texitrender', 'dokutexit')) {
+       if (substr($data[1], 0, 1) == '#') {
+         $rgb[0] = substr($data[1], 1, 2); 
+         $rgb[1] = substr($data[1], 3, 2); 
+         $rgb[2] = substr($data[1], 5, 2); 
+         $count = count($rgb) - 1; 
+         while ($count >= 0) {
+           $rgb[$count] = bcdiv(base_convert($rgb[$count], 16, 10), 255, 2);
+           $count--;
+         }
+         $renderer->putcmd('textcolor[rgb]{'. $rgb[0] 
+                           . ',' . $rgb[1] 
+                           . ',' . $rgb[2] 
+                           . '}{' . $data[0] . '}');
+       } else {
+         $renderer->putcmd('textcolor{'. $data[1] . '}{' . $data[0] . '}');
+       }
+       }
+       return true;
+     }
      return false;
    }
   
  }

Patch for newer version of Dokuwiki/Color

The structure of the $data array has changed in newer versions of Dokuwiki/Color.

So Philipp Neuser modified this hack for new Versions:

        if($mode == 'latex' && strlen(trim($data[1][0])) > 0) {
           if ($texit =& plugin_load('texitrender', 'dokutexit')) {
              $data_tex = substr($data[1][0],6,strlen($data[1][0])-7);
              list($state, $match) = $data;
                  switch ($state) {
                  case DOKU_LEXER_ENTER :
                     list($color, $background) = $match;
                     $color = substr($color,6,strlen($color)-7);
                     $is_rgb = ""; # no = "", yes = "[rgb]"
                     if (substr($color, 0, 1) == '#') {
                       $is_rgb = "[rgb]";
                       $rgb[0] = substr($color, 1, 2);
                       $rgb[1] = substr($color, 3, 2);
                       $rgb[2] = substr($color, 5, 2);
                       $count = count($rgb) - 1;
                       while ($count >= 0) {
                        $rgb[$count] = bcdiv(base_convert($rgb[$count],
16, 10), 255, 2);
                        $count--;
                       }
                       $color = $rgb[0] . ',' . $rgb[1] . ',' . $rgb[2];
                    }
                    $renderer->doc .= "\\textcolor".$is_rgb."{".$color."}{";
                    break;
                  case DOKU_LEXER_UNMATCHED :  $renderer->doc .=
$renderer->_xmlEntities($match)."}"; break;
                  #case DOKU_LEXER_EXIT :       $renderer->doc .= "}";
break;
                }
                return true;
               }
               return true;
        }

Installation with plugin manager

Note

This is a small patch to add latex mode for note plugin. http://wiki.splitbrain.org/plugin:note

This patch was submitted by Aurelien Bompard

--- syntax.php.org      2007-12-06 14:06:08.088635605 +0100
+++ syntax.php  2007-12-06 14:25:05.835425955 +0100
@@ -123,7 +123,43 @@
           }
           return true;
         }
-        
+        if($mode == 'latex'){
+         if ($texit =& plugin_load('texitrender', 'dokutexit')) {
+           list($state, $data) = $indata;
+           switch ($state) {
+           case DOKU_LEXER_ENTER: // opening     
+             $renderer->putcmdnl("begin{figure}[h]");
+             $renderer->putcmdnl("centering");
+             $renderer->putcmdnl("fbox{");
+             $icon = substr($data, 4);
+             if ($icon == "classic") {
+               $icon = "note";
+             }
+             $img = new TexItImage(DOKU_PLUGIN."note/images/".$icon.".png");
+             if (! $img->is_error) {
+               $ps_filename = $img->get_output_filename();
+               if ($ps_filename != '') {
+                 $renderer->putcmdnl("begin{minipage}{1.3cm}");
+                 $renderer->putcmd("includegraphics[width=1cm,height=1cm]{".$ps_filename."}");
+                 $renderer->putcmdnl("end{minipage}");
+               }
+             }
+             $renderer->putcmdnl("begin{minipage}{.75\\linewidth}");
+             break;
+           case DOKU_LEXER_UNMATCHED: // content
+             $renderer->putent($data);
+             break;
+           case DOKU_LEXER_EXIT: // closing
+             $renderer->putcmdnl("end{minipage}");
+             $renderer->put("}\n");
+             $renderer->putcmdnl("end{figure}");
+             break;
+           }
+         } else {
+           msg("Can't load Dokutexit from note plugin\n", -1);
+         }
+         return true;
+        }
         // unsupported $mode
         return false;
     } 

Installation with plugin manager

To Do List

  • X ⇒ Done
  • H ⇒ Half done
  • B ⇒ Buggy...
  • T ⇒ Thinking about that
  • W ⇒ Work in progress
state Name, bug or part Priority
B Clickable internal links in the PDF low
T Manage Image transparency low
T Howto for writing plugins compatible with latex renderer mode low
T Do all windows compatible stuff low
T Use ImageMagick php class if available low
T Use ACL for button display low
T Ebook feature (manage your exports with namespaces) low
T Overload code/file environment med
H Include media text or code file as apendix low
H Better Table handling (too long cell text) Landscape ? low
H Better Image handling low
H Add recurse options low
H Clickable admin interfaces low
X Manage LaTeX entities in title and author high
X Add float or some space around tables low
X Manage External Image with dokuwiki cache low
X Manage Acronyms with index low
X Clean up after image convert low
X Add options for download button low
X Free up some memory med
X Add way to download tex source and image in a zip low
T Line break in tables low

Other ideas

I am thinking to write another plugins to export dokuwiki format to openoffice, and another one to make slides.

Thanks

  • Gijs van Gemert <g*dot*v*dot*gemert[at]inter*dot*nl*dot*net> for dutch translation.
  • Stefan Pampel <stefan*dot*pampel[at]polyformal*dot*de> for german translation.
  • Quinten Krijger <qkrijger[at]gmail*dot*com> for comments and windows alpha testing.
  • Julius for tables reflexions.
  • Rolphin for being a loser.
  • Leprechaun for spending time reading over my english :-)
  • Philipp Neuser <pneuser[at]physik*dot*fu-berlin*dot*de> for Dokuwiki Color Patch

Who use it ?

Please feel free to add your site.

Site OS WebServer Latex info Status
Danjer.doudouke.org Debian apache latex debian package OK
www.cpclibre.org/wiki Debian apache latex debian package OK
A laboratory of the Université de Liège Gentoo apache TeX 3.141592 OK
Bimac Ubuntu Apache latex debian package OK

News/Changes

4 Oct 2006

  • I included Drye changes as he described below. But we loose pdf clickables links when using dvipdfm instead of dvipdf.
  • Is there anyone who can provide me access to a windows (IIS and/or Apache) server with dokuwiki administrative rights, miktex and imagemagick ?
  • I am looking for people to translate this plugins in other languages ... Anyone ?
  • Is there anyone who wants to make an howto ‘DokuTeXit & MikTeX Windows install’ ?

14 Oct 2006

  • A small patch to correct this error :
! LaTeX Error: File `' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H   for immediate help.
 ...

l.113 ...ssible via \includegraphics[height=1em]{}

\href{http://wiki.splitbra...

?

This happened on interwiki link when imagemagick do not work.

15 Oct 2006

  • Use $conf[’im_convert’] to set imagemagick path.
  • Correct some bugs with quotting and hline.

22 Oct 2006

  • Correct a caption bug
! Missing $ inserted.

                $
l.108 ...tion{:polyformal:stefan.pampel_small.jpg}

?

10 Nov 2006

15 Nov 2006

  • Add latex entities support for title, author, date and backgroundtext

16 Nov 2006

  • Add some hook for plugins command and footer part,
  • Add a new option : recurse=chapter

3 Dec 2006

  • Add Dutch’s support thanks to Gijs van Gemert

11 Feb 2007

  • Add Latex Zip sources button
  • Add in dokuwiki config manager (You will need the last stable dokuwiki version) :
    1. Enable/Disable Download ZIP
    2. Enable/Disable Download as PDF
    3. Enable/Disable Force Clean up Button
    4. Choose your latex processing mode :
      • latex mode (I recommend this one)
      • pdflatex mode
    5. Set latex path

22 Jun 2007

I am not dead... I just overflow at work.

Danjer

4 Jul 2007

Dokuwiki 06-07-2007 compilant

  • calling parser ⇒ Little bit faster, but use less memory for big documents.
  • backgroundtext options ⇒ as request
  • add $lang[’qb_latex’] ⇒ ?!?
  • apostrophe support for $conf[’typography’] = ‘2’;
  • export_dokutexit renderer plugins...
  • small image cache bug

Aurelien Bompard

  • This patch actually loads the configuration from conf/default.cfg,

thus enabling the use of pdflatex (and other settings) It also fixes a bug when the path exists but is empty.

23 Nov 2007

Latex plugin

  • Do some latex plugin compatibily

27 Nov 2007

Include plugin

  • Modify dokutexit (texitrender interface) for the include plugin
For all dokutexit hackers

I had to rename class.texitrender.php to texitrender.php. In that way plugin_load can work with dokutexit.

29 Nov 2007

  • Adding RSS support syntax

4 Dec 2007

  • Fix some bugs with links (interwiki, image).

Comments

dokutexit with pages that have accents

Hello, I’m trying to generate PDF files with pages like “nossa_missão” (file data/pages/nossa_miss%C3%A3o.txt) and it isn’t working. The output is:

latex pass 1:
cmdline: /usr/bin/pdflatex /home/turicas/public_html/sol/data/media/texit/tmp/nossa_miss%C3%A3o.tex 2>&1 
ret: 1
This is pdfeTeX, Version 3.141592-1.30.5-2.2 (Web2C 7.5.5)
entering extended mode
! I can't write on file `texput.log'.
Please type another transcript file name:
! Emergency stop
No pages of output.

I tried with other filenames (without accents) and it worked. I’ve tested in terminal:

pdflatex nossa_miss%C3%A3o.txt
pdflatex 'nossa_miss%C3%A3o.txt'
pdflatex "nossa_miss%C3%A3o.txt"

output is the same of dokutexit.

So, I suggest: create a tex file with other name (like a md5sum of the name of page dot tex), so pdflatex can compile without problems, like: $newTexName = md5($pagename).’.tex’; run_latex($newTexName);

dokutexit with cyrillics

I’ve got this problem - using dokuwiki with cyrillics (bulgarian). If an article has a latin name - pdf’s are generated a OK. But if the name is in cyrillic - pdflatex gives up.

latex pass 1:
cmdline: /usr/bin/pdflatex /REPLACED TEXT/data/media/texit/tmp/%D0%B0%D0%BB%D0%B8%D0%B5%D0%BD%D0%B0.tex 2>&1
ret: 1
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode

*
! Emergency stop.
<*> ...mp/%D0%B0%D0%BB%D0%B8%D0%B5%D0%BD%D0%B0.tex

No pages of output.
Transcript written on ?.

Any help or ideas on this?

Boris Jordanov, borj at borj dot org

Bugs report solved

Lists depth level

Looks like there are some bugs when using

recurse=on

and lists deep levels. A deph of 3 works. See DokuTeXit PlayGround for examples.

It’s not really a bug. LaTeX is limited to 4 lists deep levels. You can up to 6 when you combine enumerated and bullet lists See DokuTeXit PlayGround for examples. Danjer 2007/02/01 19:51

Windows running

please do not blame me, but I try to get this running on a Windows server (using apache).
I have trouble to get latex running:

latex pass 1:
cmdline: (cd C:\Program Files\xampp\htdocs\dokuwiki\data\media/texit/tmp/zentech/checklists; latex C:\Program Files\xampp\htdocs\dokuwiki\data\media/texit/tmp/zentech/checklists/win_server.tex 2>&1 )
ret: 1
The filename, directory name, or volume label syntax is incorrect.

I think the problem is the “latex” command which is called latex.exe in windows, but I am not sure. Does anyone has this running on a Windows Box?

Thanks Andre

— I got it running successfully on a Windows Box. After I successfully installed MikTex, I modified the Path system variable to include c:\Program Files\MiKTeX 2.5\miktex\bin. Then i had to make some changes in some files:

In \dokuwiki\lib\plugins\dokutexit\class.texitrender.php I modified the pdffromdvi funtion, which now looks like this:

Patch included: 4 Oct 2006

In the same file, i modified the run_latex function to look like this:

Patch included: 4 Oct 2006

I also had to tweak some settings. I had to remove this line, cause miktex didn’t come with a package called fguill

%%\usepackage{fguill} %%Use this package for guillemot[left|right] useless with 

And that’s basically it.

Good luck, Drye


I have got a quite similar problem to the above one, I get the message:

latex pass 1:
cmdline: c:\Program Files\MiKTeX 2.6\miktex\bin/latex E:\Web\dokuwiki\data\media/texit/tmp/pdftest.tex 2>&1 
ret: -1

I am running a windows machine with apache and php5. The newest MikTeX version (2.6) is also installed. I have done all the above modifications without getting a better result, so any help on this problem would be much appreciated.

thanks, kurt

Ok - take everything you see after “cmdline” and run it at a CMD prompt - chances are good you installed MikTex and told it to notify you up updates so it fails when it tries to run the first time.. it’s asking if it can update, and you aren’t there to say yes. Do this, as I said, from a CMD prompt. Update all the packages.

You will still have to deal with that stupid fguill.sty porblem... but I think I found a solution to that in \support\lib\plugins\dokutexit\settings\entities - delete the entries for guillemotleft and guillemotright. I did this and it ended my problem MikTex failing while trying to find that sty file.

Another issue - MikTeX 2.7 just came out Dec 1, 2007. I think that is a big reason I’m having other issues (If I run at the cmd line I can see a whole bunch of MicTex issues when trying to create a page, and on top of that when I try to do a nearly-empty dokuwiki page, it creats a 5 page document.) I’m downloading 2.5 as I type this and I think that will solve a bunch of issues.

-Nathaniel

I just got it running under Windows. However, it doesn’t export images to the pdf at this time. I’m using MikTex 2.7 Complete(takes a while to install). I had issues with the basic install hanging because it was missing a significant number of the packages it required. Missing file errors included: ucs.sty, utf8x.def, moreverb.sty, listings.sty, lastpage.sty, fancyhdr.sty, wasysym.sty, and eso-pic.sty. I didn’t have to modify any of DokuTeXit package. The MikTex 2.7 install (both basic and complete) adds the directory of latex to your system’s path variable, so you shouldn’t have to. However, if you’re getting an error that the command isn’t defined make sure it’s there and that you’ve restarted IIS since having it added to the Path.
If the complete package is too big (1.3GB) for you then install the Basic 2.7 package. During install I used the A4 default size and had set it to ‘no’ when asked about automatic update install/notification. You’ll need to add the following packages using the “Browse Packages” program: listings, unicode,moreverb, lastpage, fancyhdr, wasysym, eso-pic, ms, and wasy.There are plenty more packages you’ll need to get this working depending on the complexity of your content. Check \lang\XX\begin_config.txt for any of hte possible included packages. All I did was run ‘latex XXX.tex’ and let it tell me which files were missing. Then I would filter by filename in the Browse Packages program and install the file. The only time that didn’t quite work perfectly was with package, wasy, since it complained about something other than a missing file.
jack 2008/03/19 10:53CST

When I run the commands at the command prompt I see several warnings, none of which have stopped the PDF from being created. These warnings are invisible when using the wiki and creating the pdf through that.
Update: I have removed the title,blank, and table of content pages by editing document.cfg in the settings directory. Make sure you read up on latex formatting before doing so. I found this tutorialuseful–it’s written by David R. Wilkins and hosted by the University of Dublin's school of mathematics
jack 2008/03/17 16:28CST

I was not getting images initially, instead I was seeing text ‘img C:\...whatever_directory..\imagename.jpg’ where the image should be. I went into latex.php and modified the lines that output that code and changed the two parts that weren’t under the error code to grab the image height and width and then submitted it to the latex file:
    $filename = ereg_replace("\\\\","/",$filename);       
    list($x,$y,$img_type,$dim_str)= getImageSize($filename); 
   if($img_type==1 || $img_type==2 || $img_type==3 ) 
     $this->putcmd("includegraphics[bb=0 0 ".($x/2)." ".($y/2)."]{".$filename."}"); 
   else 
      $this->unformatted('img '. $filename); 

I’m not sure why I had to divide by two, but meh–I have the images in my document now..

.gif files are not displayed, however, space is allocated for them and they do appear in the .tex code just like the other image formats (.jpg and .png). I can’t get any .gif’s to display.

When I use DokuWiki’s table headings with the caret I get errors because the command dokuheadingstyle is not defined. Adding it to the .tex file fixed the error–i made it a bold style, and coupled with the dokuheadingcolor color it’s a bold grey. Make addition in command.cfg in settings folder of dokutexit.
jack 2008/03/18 14:13CST

I am very short sighted. I should have realized a lovely package like DokuTeXit would have come with a nice little control panel. I hadn’t realized it until I was poking around. From the admin panel you can change all the general pdf output options so long as you know your LaTeX. Thanks for the plugin.
jack 2008/03/19 16:45CST

language babel settings

Under Linux (Suse 10.1) with standard tetex installation.

Two little changes I have done

  1. dokutextit/settings.old renamed in dokutexit/settings
  2. one line added in dokutexit/settings/command.cfg :
\newcommand{\dokuheadingstyle}[1]{#1}   % ça mange pas de pain !
Could you describe why you did that ?
Because code generated for arrays contains line like this :
\multicolumn{1}{|l|}{\dokuheadingstyle{\color{dokuheadingcolor} baratin \normalcolor}}& ...

Then without a \dokuheadingstyle definition, latex compiler fails.

This is very strange... This line is present in the default config :
\newcommand{\dokuheadingstyle}[1]{\textbf{#1}}

Could you check in that file : dokutexit/lang/en/command_config.txt if this line is present ?

I’ve got the same trouble as ‘ca mange pas de pain’. latex complains about dokuheadingstyle and I had to add this line into settings/command.cfg. However, I’ve double-checked in dokutexit/lang/en/command_config.txt and it exists. It seems that this file will never be loaded... weird. Maybe, I’ve done something wrong with babel options. I’ve tried in settings/begin.cfg to add line like :

\usepackage[american]{babel} %% Use your own babel language
\usepackage[british]{babel} %% Use your own babel language
\usepackage[english]{babel} %% Use your own babel language

instead of [french], but it doesn’t work either.

pvincent 2007/07/31 07:04


Et merci beaucoup pour ce plugin, Bernard.

Pas de quoi
Yes, I see this problem yesterday.
Danjer

Hi, I installed this plugin today, I have Dokuwiki 2006-10-08 running on Gentoo linux. Looks to be working well. I think this is a very exciting plugin — thank you very much for writing this! Warren Howard

Code highlight

Did some hacking. Now you can create Umlgraphs by putting some java code in graphviz juml quotes. see the tail of the graphviz dokuwiki page. hm, code formatting works in wiki but texit will break dothebart

About this break : In Latex for syntax highlighting we use listing package witch exist since 1996, but language descriptor is not exactly the same in dokuwiki. ie: bash do not exist in listing package. I copy and paste you example in playground with other language descriptors (c or c++ instead of cpp) and it’s work fine.
Anyway you can make language aliases by adding this line in dokutexit command :
\lstalias{cpp}{C++}

If anyone want make all aliases between geshi and
listing package this could be great.
I am sure that listing package can be tweakable for special layout, but I will remove latex hardcoding in dokutexit for code/code hightlight/file to put in dokutexit config.

I have some troubles with boxes around code... and page break.

Danjer 2006/11/13 09:48

Wonderful work. Very nice plugin for Dokuwiki. Thanks very much for your work. I had some problem as I mentioned on my blog

move da button!

Ok, i did some hacking. The button inside of the document was annoying me. It needed to be added on two places:

  • class.texitrender.php:render in line 172
    define(PDF_BUTTON_TEXT, $string);

    return ""; //return $string;
  • If you want to have the pdf button inside the document, let the return intact.
  • the other one goes to the theme inside lib/tpl/[yourtheme]/main.php right after the history button:
        <?php tpl_button('history')?>
        <?php echo PDF_BUTTON_TEXT; ?>

this hurts the plugin architecture a bit, but works, and looks more smart (to me) – dothebart

You’re right this button really sucks. When I start this project, I didn’t find a better way to add a button without hacking the theme. Maybe it’s time now to think in another way. I will rewrite texitrenderer to fit better to new dokuwiki version (?do_export=texit), add hook for others plugins and make it more flexible for download button. — Danjer 2006/12/11 09:09
Finally I’ve done it ! Have a look on this Danjer 2007/07/04 14:45

sh: latex: command not found

Hi, I have this message when i try to generate pdf

latex pass 1:
cmdline: latex /home/mypath/public_html/aide/data/media/texit/tmp/accueil.tex 2>&1 
ret: 127
sh: latex: command not found

How to fix that ?

Thanks, Stéphanie

You need to have a full latex installation on your host. Many hosting services do not provide LaTeX, this kind of service can be available only on dedicated servers. Feel free to contact me about this subject.

Danjer 2007/01/23 09:31

Could also be a php safe_mode issue. Try disabling safe_mode just for testing purpose.

Frank 2007/02/22 14:02

What i can do for fix this? (I found no installation advice for latex.)

UPDATE: I solved the problem. It is just that the latex path is not set right. Set it to “/usr/tex” in the config.php.

Jakob 2008/07/15 12:00

Big document

On this url http://lcmserv2/lcm/radio/doku.php?id=software_radio:manuel:manuel I try to generate a big PDF (about 100 pages) the first 20 pages will be OK, but after I will have wiki code ! Is it a bug ? Will it have a work around ?

Thanks in advance and sorry for my English.
Stéphane Brunner

Unfortunately, the URL you provide is not accessible. Please provide a new one for furthers investigation. — Danjer 2007/02/09 09:21
It was a plugins problem. In one plugin (for LaTeX rendering) I have something like that :
              $latexRenderer = new texitRender();
              $text = $latexRenderer->p_render_latex_text($data[0]);
              $renderer->doc .= $text; 

I replace it by :

              $text = $renderer->_latexEntities($text);
              $renderer->doc .= $text;

add all will be OK ;-)

Enhancement to the background feature

I was trying to set the background to an empty string and realized that tex was complaining about it. The following change makes the error go away (Starting @ line 415 of class.texitrenderer.php):

Patch included: 4 Jul 2006

Basically, if the background is set to an empty string, we simply skip the ‘\dokubackground’ altogether, rather than generate an empty one.

– Renny Koshy (a grateful dokutexit user!)

Background Image

Is it possible to change the default background (the URL) with a picture ?

Thanx,

Georges

Autoresponse : I inserted this code after the \begin{document} in the “DokuTeXit Document” section, and placed the Image (here spiral.png) in the /data/media/texit/tmp/folder

\makeatletter
\newcommand\BackgroundPicture[2]{%
  \setlength{\unitlength}{1pt}%
  default \put(0,\strip@pt\paperheight){%
  \parbox[t][\paperheight]{\paperwidth}{%
    \vfill
    \centering\includegraphics[angle=#2]{#1}
    \vfill
}}} %
\makeatother
\AddToShipoutPicture{\BackgroundPicture{spiral.png}{45}}% here or anywhere in text

It works great. :o)

Thank you for this tips — Danjer 2007/06/22 14:50

Add icon to Toolbar

In order to add a export to PDF button in the toolbar, I did the following things :

  • Create a toolbar button (dimension 16×16 pixels) and call it “latex.png” (I resized one from here).
  • Copy the button in the correct folder /lib/images/toolbar/
  • Edit the inc/toolbar.php file and add this code
        array(
                'type'   => 'insert',
                'title'  => $lang['qb_latex'],
                'icon'   => 'latex.png',
                'insert' => '<texit info> \nauthor= \ntitle= \nsubject= \nkeywords= \nrecurse=on \nbackgroundtext= \n</texit>\n \n',
                ),
  • Edit the inc/lang/en/lang.php file and add this line (If you use other language than english just edit the corresponding lang.php):
$lang['qb_latex'] = 'Export to PDF';

TIP : Don’t forget to delete the cache of your browser. :-)

~Martin

You may find interesting renderer_urlDanjer 2007/07/04 14:46

getFormat() Error

Hello Danjer,

I have just installed the plug-in and was testing it on the latest DokuWiki release (rc-2007-05-24 on Debian, shared hosting, LaTeX is installed); unfortunately, I get the following error displayed on the page I am attempting to export to PDF, right before the blue box where the LaTeX log is displayed:

Warning: getFormat() not implemented in doku_renderer_latex in /pathtomydokuwikiroot/inc/parser/renderer.php on line 46

LaTeX stops and no output is produced. What can I do to solve this? Any help will be greatly appreciated.

Thanking you for the great work,

Enrique.

Hi, I would also like to add that I am seeing this error too Warning: getFormat() not implemented in doku_renderer_latex in /var/www/localhost/htdocs/dokuwiki/inc/parser/renderer.php on line 46. I am using Dokuwiki 2007-06-26. For me the error will be repeated several times, but the PDF generation does not fail.

Regards,

Warren.

  • I think the getFormat() was introduced in the new version. I added the following just before the first function in latex.php (in the dokutexit plugin folder) in line 60. Now I don’t get any of those warnings:

Patch included: 4 Jul 2006

  • Hi, the above code inserted at around line 58 in my latex.php file has removed the error messages described above. With thanks, Warren.
This function getFormat() was a part of dokuwiki’s parser evolution. Dokutexit and dokuwiki’s renderer are very close together. Sorry for the late... — Danjer 2007/07/04 14:39

Image link image (same problem on linuxpourlesnuls.org)

example : http://www.linuxpourlesnuls.org/v4/dokuwiki/doku.php?id=tutoriaux:premiers_pas_avec_linux:presentation_lpln

FIXME thanks for any suggestions...

Tom

mail: tsly_mdk A yahoo fr

Hi... In your case the origin trouble is there :
[[http://lpln.free.fr/pics/edtm0lh0.png|{{ http://lpln.free.fr/minis/edtm0lh0.png }}]]
Obviously Dokutexit have some trouble with externals images in external link. — Danjer 2007/09/24 16:11
It’s solved in 4 Dec 2007 version — Danjer 2007/12/05 16:00

problem using color plugin

Texts wrapped by <color> tags aren’t integrated into the document (example : test)

http://wiki.splitbrain.org/plugin:color

Dokutexit add a latex renderer mode to dokuwiki perhaps you can ask to the color plugin maintainer to add a latex mode to this plugin. — Danjer 2007/11/20 11:18

fguill not available on all linux distributions

I have discovered that fguill.sty is not available on my Ubuntu Linux distribution. Despite my best attempts to circumvent the need for it, I cannot overcome the error messages I see about a missing fguill.sty. (I might be able to avoid them if I actually knew how to use LaTex/TeTex).

I scanned my system using

find / -name "*guill*.sty" 

and found aeguill.sty. I thought maybe I would have other ‘guill’ styles installed so I ran:

$ apt-file search aeguill.sty
tetex-src: usr/share/texmf-tetex/source/latex/aeguill/aeguill.sty
texlive-lang-french: usr/share/texmf-texlive/tex/latex/aeguill/aeguill.sty

and it showed that I have an ‘aeguill’ style installed. I substituded this:

\usepackage{aeguill} 

for the fguill statement in my DokuTeXit Begin/Header section. I also changed my language to English:

\usepackage[english]{babel}

and everything is working fine for me. Thanks for a great plugin.

Chris Freyer

Thanks for this useful feedback, I will have a look at it. — Danjer 2007/11/20 11:16

dokutexit generates empty document

I’ve installed dokutexit (through the plugin manager) and installed all the latex packages mentioned (in Ubuntu). The Generate PDF button on the plugin’s config page does generate a PDF but with the exception of the title page, the PDF is empty. Is there anything else I need to do to get it to work? Unfortunately, my website is internal only for the moment; I want to use dokutexit to generate a PDF file I can distribute. (There is a copy of the website here, but dokutexit won’t work here at all, probably because of the server).

Raja Mukherji

It’s solved... — Danjer 2007/12/05 16:02

Symbols from the symbol menu

Is it possible to allow LaTeX to properly parse symbols from the symbol menu (the one with the Omega icon)? If I insert a sigma from the symbol menu it crashes LaTeX processing completely. The same thing happens on the DokuWiki playground.

I did the same test in the playground but I did’nt see any crashes... —