User:Duplode/wb2pdf installation on Fedora

This page provides advice on how to install the MediaWiki-to-LaTeX converter wb2pdf in Fedora. It is wholly based in my own experience with F16, so take it with a grain of salt and adapt the details to your system if need be. You will likely want to check the main wb2pdf page, with download links and usage instructions, and in particular the installation guide for Ubuntu, from which this page was originally derived.

The TeXLive 2011 repository
The default Fedora 16 repositories carry an outdated set of TeXLive packages which lacks many things we will need for wb2pdf. Before installing the packages, it is necessary to install the test repository for TeXLive 2011 (see this Fedora Project page for details and instructions for Fedora versions other than 16). In Fedora 16, run:

su -c 'rpm -i http://jnovy.fedorapeople.org/texlive/2011/packages.fc16/texlive-release.noarch.rpm' su -c 'yum clean all'

If you already have the older TeXLive installed, you will also need to

su -c 'yum update'

Installing packages
Next, we will install all packages needed for building and running wb2pdf, including the TexLive ones. Here is the yum command, in one shot:

su -c 'yum install subversion python3 python3-tkinter ImageMagick librsvg2 fontforge-devel ghc ghc-regex-compat-devel ghc-HTTP-devel ghc-split-devel ghc-MissingH-devel cabal-install texlive-scheme-basic texlive-collection-latexrecommended texlive-collection-latexextra texlive-collection-fontsrecommended texlive-collection-fontsextra texlive-collection-games texlive-collection-humanities texlive-collection-science texlive-arabtex texlive-cjk texlive-collection-langcjk texlive-collection-langcyrillic texlive-collection-langgreek texlive-collection-langvietnamese texlive-cm-super texlive-gnu-freefont wqy-zenhei-fonts'

The same packages, in a more readable presentation:

su -c 'yum install subversion python3 python3-tkinter ImageMagick librsvg2 fontforge-devel' su -c 'yum install ghc ghc-regex-compat-devel ghc-HTTP-devel ghc-split-devel ghc-MissingH-devel cabal-install' su -c 'yum install texlive-scheme-basic texlive-collection-latexrecommended texlive-collection-latexextra' su -c 'yum install texlive-collection-fontsrecommended texlive-collection-fontsextra texlive-collection-games' su -c 'yum install texlive-collection-humanities texlive-collection-science texlive-arabtex texlive-cjk' su -c 'yum install texlive-collection-langcjk texlive-collection-langcyrillic texlive-collection-langgreek' su -c 'yum install texlive-collection-langvietnamese texlive-cm-super texlive-gnu-freefont wqy-zenhei-fonts'

(This list was inferred from the Ubuntu instructions; compare with that one if you find some package is missing - and if so I kindly ask you to correct the commands here.)

There are two packages which are not in the Fedora repositories. ghc-hxt will be automatically installed by Cabal (the Haskell package system) when you build wb2pdf; there is also unifont, which will be dealt with in a later step.

Building wb2pdf
Next, we will get the sources and build wb2pdf:

svn co https://wb2pdf.svn.sourceforge.net/svnroot/wb2pdf wb2pdf cd wb2pdf/trunk cabal update cabal install cd src python3 makelinuxbins.py

Note that I am assuming a per-user (as opposed to global) installation of wb2pdf by cabal.

Building and installing megafont
wb2pdf requires a set of fonts, called megafont, which is a combination of the unifont, FreeSerif ans wqy-zenhei fonts. We need to build and install megafont to the LaTeX tree. wb2pdf comes with a python script which help building megafont. First, however, you will need to download unifont, which is not in the Fedora repositories. You can get it from this page (the first link to a ttf.gz file). Extract it to the font sudirectory of the svn trunk and rename the ttf file to unifont.ttf.

The script for installing megafont is in the same font subdirectory. To run it, then, do:

cd ../font su -c 'python3 installunifont_fedora.py'

The script will install the fonts to the LaTeX tree for local additions, as set in your system by the file /usr/share/texlive/texmf/web2c/texmf.cnf. You can find it with:

kpsewhich --var-value TEXMFLOCAL

Updating the TeX tree
(This section is based in information from this page from the TeX Users Group.)

Finally, we need to register the megafont fonts in the TeX tree. To do that, run the following commands:

su -c 'texhash' updmap --enable Map=megafont.map su -c 'texhash'

Again, note that the updmap step is being performed locally, and not globally.

wb2pdf is now ready to run:

cd ../src/ python3 gui.py

And that's it - for further instructions, see the wb2pdf manual.