
| Line: 1 to 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Added: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > > |
Generate PDF-Latex Add OnThis add-on generates a latex file for a specified topic, and/or the PDF output ofpdflatex processing this latex file. The goal is to provide PDF versions of TWiki topics with nicely rendered mathematics, using a latex document preparation environment installed on the TWiki server.
The package is tightly integrated with the TWiki:Plugins.LatexModePlugin, which is a required prerequisite.
The goal of this package development is to provide a mechanism for groups to edit and produce latex documents suitable for publication submission. The use of this package on a TWiki installation provides the following advantages:
Usage
Startup FormThis add on uses an intermediate form to declare the latex/pdflatex rendering options, includingdocumentclass to be used, single or double column, etc... A default form is provided with the script. A custom form can be used by declaring GENPDFLATEX_OPTIONSPAGE somewhere within the twiki or web preferences (or in the GenPDFLatexPlugin topic). If the following strings appear in the form, $web, $topic, $style, and $packages, these strings will be respectively replaced by %WEB%, %TOPIC%, and the option arguments described below.
Topic SyntaxThe following TWiki topic syntax commands are provided through the included GenPDFLatexPlugin: The tag %PDFLATEXLINK{options}% will render as a link to thegenpdflatex script. The available options are
%PDFLATEXIF% [tex] %ELSE% [html] %PDFLATEXENDIF% and %PDFLATEXIF% [tex] %PDFLATEXENDIF% In each case, content in the [tex] region will only appear in the PDF/Latex rendered file, and content in the [html] region will only appear in HTML renderings (i.e. a standard TWiki view).
Most notably, this is useful for declaring the titlepage in the latex rendering. This conditional allows one to use, for example, a professional name in the latex file and a TWiki username in the HTML topic rendering.
The following | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
option<-- --> |
description |
|---|---|
| class | the LaTeX2e document class (article,IEEEtran,letter,etc.) |
| font_size | font size (9,10,11,12) |
| imgscale | scale factor for the HTML images |
| packages | to supply a list of Latex2e packages (graphicx,doublespace,etc) |
html2latex configuration (i.e. LatexLMP.pm).
tar zxvf html2latexLMP...)
cd html2latexLMP.../HTML)
perl Makefile.PL; make test; make install;) See the INSTALL file for a complete description.
texmf tree accessible by the server. For example, for an apache server running as 'nobody' on a linux system: /home/nobody/texmf/tex/latex, with reasonable permissions.
.cls and .sty latex files in this directory
root or nobody, run texhash /home/nobody/texmf to create the ls-R latex database file for the /home/nobody/texmf/ tree.
GenPDFLatexAddOn.zip in your twiki installation directory. Content: | File: | Description: |
|---|---|
data/TWiki/GenPDFLatexAddOn.txt | Add-on topic |
data/TWiki/GenPDFLatexPlugin.txt | The Plugin topic |
data/Main/GenPDFLatexForm.txt | form listing file generation options |
bin/genpdflatex | Add-on script |
lib/TWiki/Contrib/GenPDFLatex.pm | the perl code package module |
lib/TWiki/Plugins/GenPDFLatexPlugin.pm | code for conditional content rendering |
genpdflatex file to the .htaccess permission list in the twiki/bin directory
pdflatex executable path and the $ENV{'HOME'} variables, if needed.
view with genpdflatex in the url, and reload the page.html2latexLMP, a few hooks were added to allow greater control of the image rendering in the latex document. Standard html2latex provides an image scale parameter. The LMP version allows two new attributes, texwidth and texheight, to be declared in the html img tag. For example, a standard HTML tag for the attached screen shot image would read:
<img src="screenshot.png" alt="screen shot example" width="800" height="600">To render this same image in the pdf/latex document to cover almost the whole width of the page, one could declare:
<img src="screenshot.png" alt="screen shot example" width="800" height="600" texwidth="0.95\linewidth">The
html2latex processing will convert this tag to
\includegraphics[width=0.95\linewidth]{screenshot.png}
and proceed happily along.
The LatexModePlugin color option was introduced to enable rendered mathematics images with font-color consistent with normal font color declarations. It is assumed that any color option specified in a %BEGINLATEXMODE{}% TWiki tag is embedded in a font-color block. Second, the \usepackage{color} call needs to be in the latex preamble. This will happen automatically if using colors defined by the LatexModePlugin.
This code is still very much under development. All syntax calls,
e.g. equations, figures, and tables, in the LatexModePlugin are supported.
The TWiki:Plugins.BibtexPlugin can be used for bibliography support.
| Add-on Author: | TWiki:Main/ScottHoge |
| Add-on Version: | 31 Jan 2008 (v2.2, SVN:16334) |
| Change History: | <-- versions below in reverse order --> |
| 31 Jan 2008 (v2.2): | updated for TWiki 4.2 |
| 15 Nov 2007 (v2.1): | improved reporting of errors, now includes bibtex support |
| 30 Sep 2006 (v2.01): | minor change, for compatibility with TWiki:Plugins.LatexModePlugin v3.0 |
| 1 Feb 2006 (v1.4): | fixed bug in stripping of <p> tags within latex environments |
| 6 Dec 2005 (v1.3): | modified for Dakar compatibility |
| 11 Nov 2005 (v1.2): | Added PDFLATEXLINK tag, tweaked image handling |
| 15 Oct 2005 (v1.1): | Initial version |
| TWiki Dependencies: | TWiki:Plugins.LatexModePlugin v2.0 or greater |
| CPAN Dependencies: | File::Basename, File::Temp, HTML::TreeBuilder, XML::Simple |
| Other Dependencies: | HTML::LatexLMP v1.4 or greater (included in the html2latexLMP package attached below), a working latex installation |
| Perl Version: | 5.005 |
| License: | GPL |
| Add-on Home: | http://TWiki.org/cgi-bin/view/Plugins/GenPDFLatexAddOn |
| Feedback: | http://TWiki.org/cgi-bin/view/Plugins/GenPDFLatexAddOnDev |
| Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/GenPDFLatexAddOnAppraisal |