WikiToLearn/mw-ocg-latexer

Name: mw-ocg-latexer

Owner: WikiToLearn

Description: MediaWiki ocg-latexer fork

Created: 2015-10-06 21:11:56.0

Updated: 2016-01-19 22:16:32.0

Pushed: 2017-09-18 12:37:08.0

Homepage: null

Size: 85618

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

MediaWiki ocg-latexer

ocg-latexer forked from https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Collection/OfflineContentGenerator/latex_renderer

mw-ocg-latexer

NPM

Build Status dependency status dev dependency status

Converts mediawiki collection bundles (as generated by mw-ocg-bundler) to beautiful PDFs (via XeLaTeX).

Installation

Node version 0.8 and 0.10 are tested to work.

Install the node package dependencies.

install

You will need to have a C compiler installed in order to build the sqlite3 and icu-bidi packages (ie, apt-get install g++).

Install other system dependencies.

get install texlive-xetex texlive-latex-recommended \
            texlive-latex-extra texlive-generic-extra \
            texlive-fonts-recommended texlive-fonts-extra \
            fonts-hosny-amiri fonts-farsiweb fonts-nafees \
            fonts-arphic-uming fonts-arphic-ukai fonts-droid fonts-baekmuk \
            texlive-lang-all latex-xcolor \
            poppler-utils imagemagick librsvg2-bin libjpeg-progs \
            djvulibre-bin unzip

Note that up-to-date LaTeX hyperref and fontspec packages are required. If your LaTeX installation is old, you can find recent versions of some of the necessary packages in texdeps/, but it's best to use an up-to-date TeXlive distribution.

If you prefer, the inkscape package can be installed to do SVG->PDF conversion in place of rsvg-convert (from the librsvg2-bin package).

In older versions of Ubuntu, the Nazli font was provided by the ttf-farsiweb package instead of fonts-farsiweb.

In Ubuntu 12.04, the lmodern package must also be installed manually.

Hyperlinks in generated PDFs will not resolve correctly unless the target wiki has $wgUsePathInfo enabled.

Generating bundles

You may wish to install the mw-ocg-bundler npm package to create bundles from wikipedia articles. The below text assumes that you have done so; ignore the mw-ocg-bundler references if you have bundles from some other source.

Running

To generate a PDF named out.pdf from the en.wikipedia.org article “United States”:

EPATH/bin/mw-ocg-bundler -v -o us.zip -h en.wikipedia.org "United States"
mw-ocg-latexer -o out.pdf us.zip

In the above command $SOMEPATH is the place you installed mw-ocg-bundler; if you've used the directory structure recommended by mw-ocg-service this will be ../mw-ocg-bundler.

For debugging, preserving the XeTeX output is often useful:

mw-ocg-latexer -l -D -o out.tex us.zip
NPUTS=tex/: xelatex out.tex

For other options, see:

mw-ocg-latexer --help
Related Projects
License

GPLv2

(c) 2013 by C. Scott Ananian

c87d63a404fbd60423f3d5a6058085c3c3f70668


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.