Benutzer:Dirk Huenniger/wb2pdf

Aus Wikibooks
Zur Navigation springen Zur Suche springen

Summary[Bearbeiten]

mediawiki2latex converts MediaWiki markup to LaTeX and, via LaTeX, to PDF. It can be used to export pages from any project running MediaWiki, such as Wikipedia. It is also possible to generate epub and odt output files.

Web Version[Bearbeiten]

You may test mediawiki2latex under the following url

http://mediawiki2latex.wmflabs.org/

Installation on Ubuntu[Bearbeiten]

sudo apt-get install mediawiki2latex
mediawiki2latex

Currently version 7.30 is available from the Ubuntu package repositories. That version does not work properly with tables on recent installations of MediaWiki. To resolve the issues you may follow the instruction for the installation of version 7.32 which are given for Debian below, but also apply for Ubuntu. Since you usually can not login as root on Ubuntu systems you have to run the given command as your normal user but with a preceding "sudo " in order to get the necessary privileges to install new software on your system.

Installation on Debian[Bearbeiten]

mediawiki2latex is included in the Debian Stretch distribution and works out of the box, but the output is limited to a few pages. To work around this problem you should install mediawiki2latex version 7.32 in Stretch. Please install mediawiki2latex version 7.25 first by typing (as root).

apt-get install mediawiki2latex

Then install the build time dependencies (as root).

apt-get install ghc libghc-x509-dev libghc-pem-dev
apt-get install libghc-regex-compat-dev libghc-http-dev cabal-install libghc-hxt-dev
apt-get install libghc-split-dev libghc-blaze-html-dev libghc-file-embed-dev
apt-get install libghc-highlighting-kate-dev  libghc-hxt-http-dev libghc-regex-pcre-dev
apt-get install libghc-temporary-dev libghc-url-dev libghc-utf8-string-dev
apt-get install libghc-utility-ht-dev libghc-http-conduit-dev libghc-happstack-server-dev
apt-get install libghc-directory-tree-dev libghc-zip-archive-dev libghc-strict-dev
apt-get install libghc-network-uri-dev
apt-get install ghostscript calibre latex2rtf libreoffice 

Download mediawiki2latex version 7.32 from sourceforge. Extract the archive and run (as root in the directory in which you extracted the archive from sourceforge)

make install


Installation on Windows[Bearbeiten]

Installation

  • Go to Control Panel -> Programms -> Turn Windows Features On / Off
  • The Windows Features Dialog will open
  • Scroll to the bottom
  • Enable Windows Subsystem for Linux
  • Press OK
  • Install the App "Ubuntu 18.04" from the Windows Appstore.
  • When stating the app for the first time you will be asked to set your username and password, which you need to remember
  • In the App type sudo apt-get install mediawiki2latex and press Enter. You will then need to enter the password you defined above
  • The download and installation will take some time.

Running mediawiki2latex

  • Run the Ubuntu app if it is not already open
  • Type sudo mediawiki2latex -s 80 and enter the password as above
  • Keep the app open and, in Windows, open your normal web browser
  • In the address entry type localhost Press Enter
  • mediawiki2latex web version is now running on your local Windows computer.

Compiling large Books

  • The mediawiki2latex web server has a time limit of one hour built in, so very large books with more than about 500 pages may fail to convert. But there is a work around:
  • Go back to the Ubuntu App
  • Press and hold the CTRL key and press the C key once while holing it in order to stop the mediawiki2latex webserver
  • Type mediawiki2latex -u https://en.wikipedia.org/wiki/Homomorphism -o mybook.pdf and press Enter
  • After the command finishes, open Windows Explorer on your Windows Desktop and search for the file mybook.pdf
  • Double click the file to open it in your pdf viewer
  • Replace the link https://en.wikipedia.org/wiki/Homomorphism with the link to the large article you want to compile and repeat the above steps in order to get your desired result.

Updating the converter

  • Follow the steps given above in the installation instruction for Ubuntu. You will have to do this inside the Ubuntu 18.04 App.


Installation on other OS[Bearbeiten]

I recommend that you use virtualbox or similar virtual machine and run Ubuntu in there. The program itself is already larger than Ubuntu, so installing Ubuntu does not add much overhead. The large size of the program is due to the many dependencies for latex packages and fonts, and the way they are packaged. In total a little over 1 GByte of packages has to be downloaded during the installation on Ubuntu. The .tar.gz archive of the source code is also available on sourceforge.

User Manual[Bearbeiten]

see the User Manual

Command Line Version[Bearbeiten]

A command line version is currently available as part of the Stretch debian distribution, as well as the current ubuntu distribution.

LaTeX intermediate Code[Bearbeiten]

On Linux you can use the -c command line option with an absolute pathname.

Media[Bearbeiten]

Talk[Bearbeiten]

File:Wb2pdfTalk.ogv

Slides[Bearbeiten]

Wb2pdfTalk.pdf

Poster[Bearbeiten]

File:Wb2pdfPoster.png

In Action[Bearbeiten]

To see it in action look here: Datei:Wb2latexCompilingWikibook2PDF.ogg

Developers[Bearbeiten]

The follwing Link Benutzer:Dirk Huenniger/wb2pdf/details explains some of the inner workings of the software.

Quality and Statistics[Bearbeiten]

A test run in October 2014 processing 4369 featured articles of the English Wikipedia did produce a PDF file in each case. In particular these were all featured articles we were able to find at the beginning of the test.