MEDIAWIKI2LATEX(1)
π MEDIAWIKI2LATEX(1) π
okay so bestie, this is the mediawiki2latex page from the User Commands manual, and it's literally the glow-up pipeline you've been waiting for: it grabs MediaWiki pages and compiles them, through LaTeX, all the way into a PDF. no cap. let's get into it π¦
β¨ SYNOPSIS β¨
mediawiki2latex [OPTION] -o FILE -u URL
that's it. that's the whole vibe. give it a URL, tell it where the PDF goes, and it works. π
πΈ DESCRIPTION πΈ
okay so here's the tea: MediaWiki to LaTeX will fetch MediaWiki pages from a URL. and not just the one page, babe β it fetches all its content recursively, meaning subpages and pictures, the whole tree, no crumbs left behind. obsessed.
then the source code gets converted to LaTeX, using the user template MAP if you specified one, or a default template otherwise. if you gave it a LATEXTREE, the LaTeX output gets stored there. πΎ
and finally β the main character moment β a PDF gets generated from the LaTeX source code if an appropriate LaTeX compiler is found. heads up though: it will automatically run several times to make sure all references are resolved, because references are dramatic like that and need a second (and third) pass. π
every single step can be controlled with command-line options. iconic.
β¨ OPTIONS β¨
-c,--copy=LATEXTREEβ write all generated LaTeX files to the specified folder.-g,--vectorβ keep vector graphics in vector form. β¨ (yes bestie, they stay crisp, we love to see it)-h,--htmlβ use mediaWiki generated HTML as input. this one is the default, so it's already on unless you say otherwise.-z,--zipβ output LaTeX Source Archive. π¦-b,--epubβ output an epub file. β οΈ only works if the packageslatex2rtfandcalibreare installed additionally.-d,--odtβ output an odt file. Open Document Text (for wordprocessors). β οΈ only works if the packageslatex2rtfandlibreofficeare installed additionally.-i,--internalβ use internal template definitions.-x,--hex=CONFIGβ take configuration data from a hex encoded string given on the command line. this is only needed to avoid malicious shell injection via the web form of the server. π stay safe out there.-m,--mediawikiβ use mediaWiki to expand the templates.-k,--bookmodeβ use book-namespace mode for expansion. that means: follow all links but not recursively.-o,--output=FILEβ specify the PDF output file.-p,--paper=SIZEβ set the paper size. possible values areA4,A5,B5,letter,legal,executive.-r,--resolution=DPIβ set the maximum image resolution in dot-per-inch. the argument should be an integer.-s,--server=PORTβ run as server. listen onPORT. π₯οΈ-t,--templates=MAPβ specify the user template map file. usually calledtemplates.user.-l,--headers=EADERSPATHβ the path to the LaTeX headers which should be used. may be omitted. useful in combination with-t.-u,--url=URLβ the input URI. it should point to a MediaWiki page.-?,-v,--version,--helpβ show help options together with version number. π«Ά
π TEMPLATES π
so MediaWiki has this genuinely powerful template system that controls the appearance of specific parts in the text. and bestie, we can use that to our advantage β to further control the appearance of the resulting PDF. main character energy for real.
you can tell MediaWiki to LaTeX to use the host site template result directly in the PDF, or you can use a custom template of your own. want a template example? peek at $XDG_DATA_DIRS/mediawiki2latex/latex. go look, it's giving inspiration. π
π§ LATEX TREE π§
okay so all the downloaded files are kept into memory, which means there will not be any MediaWiki files remaining on disk after the process finishes. clean. β¨
but β plot twist β the generated LaTeX files (the LaTeX tree) need to be written on disk in order to produce the PDF. by default these files are written to /tmp/MediaWiki$$. and that folder? it gets removed when the program exits. bye bye. π
however (dramatic pause), you may want to keep the generated LaTeX tree on disk for LaTeX customization and to fasten future builds. π if you use the -c option to set the LaTeX tree folder, the program will not remove it on exit, so you can continue to use it. keep it forever, bestie.
the LaTeX tree is made of three folders:
headerβ a folder containing the LaTeX options, the special pages, the package loading, etc.imagesβ all the original picture files used in the article. πΌοΈmainβ the complete LaTeX version of the source document is stored inmain.tex.
to compile the PDF file yourself, simply run xelatex on the main.tex file. for instance:
xelatex LaTeX-tree/main/main.tex
you may need to run it several times to make sure all references are resolved. (again. they're needy. it's fine.)
π AUTHORS π
MediaWiki to LaTeX was mainly developed by Dirk HΓΌnniger <dirk.hunniger@googlemail.com>. other contributors are listed in the AUTHORS file. absolute legends, all of them.
this man page was written by Pierre Neidhardt <ambrevar@gmail.com>.
and that's the whole page bestie!! π this is MediaWiki to LaTeX 8.41, dated 2013-12-25 β yeah it's a vintage icon but she still slays. so go forth, compile some wikis into PDFs, and remember: run xelatex a few times or your references will simply not resolve. periodt. π
β¨π
π¦ where this page comes from
- ubuntu stonking: mediawiki2latex 8.41-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms