# User:Austin J. Che/Extensions/LatexDoc

(Difference between revisions)
 Revision as of 12:44, 5 October 2006 (view source)← Previous diff Current revision (10:44, 17 November 2007) (view source) (7 intermediate revisions not shown.) Line 3: Line 3: * The biggest change is to allow use of other files on the wiki so that bibtex and graphics works. * The biggest change is to allow use of other files on the wiki so that bibtex and graphics works. * Requires [http://www.phys.psu.edu/~collins/software/latexmk-jcc/ latexmk] * Requires [http://www.phys.psu.edu/~collins/software/latexmk-jcc/ latexmk] + ** The default location for latexmk is in the extensions directory of your mediawiki installation. + ** If you wish to use a different location, add $wgLatexDoc->latexmk = "/path/to/latexmk"; in LocalSettings.php after requiring/including LatexDoc.php. * Removed DVI output (not useful on web) * Removed DVI output (not useful on web) - * Removed filter for "obviously dangerous control words" as it isn't a good security mechanism. Instead, change texmf.cnf so that shell_escape=f, openout_any=p, and openin_any=p. You may also want to run latex under a chroot jail. + * '''Security''': Removed filter for "obviously dangerous control words" as it isn't a good security mechanism. + ** Instead, change texmf.cnf so that shell_escape=f, openout_any=p, and openin_any=p. This disallows running system commands and reading or writing any files not under the directory of the tex file. + *** texmf.cnf is located in /usr/share/texmf/web2c/texmf.cnf on tetex distributions. Debian users should edit /etc/texmf/texmf.d/95NonPath.cnf and run update-texmf as root. + ** You may also want to run latex under a chroot jail. + ** If anyone notices any other security issues, please let me know. * Added link to get the log file * Added link to get the log file + * If you want automatic syntax highlighting, install the [[../SyntaxHighlight/]] extension (and GeSHi). Usage: Usage: Line 11: Line 18: Any wiki page that looks like a latex document will automatically have links for added to the top. The Get PDF link will generate a PDF or grab it from the cache if it exists and the Regenerate PDF forces the PDF file to be regenerated. Any wiki page that looks like a latex document will automatically have links for added to the top. The Get PDF link will generate a PDF or grab it from the cache if it exists and the Regenerate PDF forces the PDF file to be regenerated. - The special command \usewikifile{Wiki Page Name}{texfilename} can be used. All such commands are stripped before being passed to latexmk for generation of pdf. In addition, the contents of Wiki Page Name are saved as texfilename in the same directory as the page. Thus, you can include graphics or use bibtex where the graphics and .bib file are stored on the wiki. + The special command \usewikifile{Wiki Page Name}{texfilename} can be used. All such commands are stripped before being passed to latexmk for generation of pdf. In addition, the contents of Wiki Page Name are saved as texfilename in the same directory as the page. Thus, you can include graphics or use bibtex where the graphics and .bib file are stored on the wiki. '''Hint:''' If you wish to use the same file both on and off the wiki, you can put the \usewikifile in a comment or some other place where normal LaTeX won't parse it (such as after \end{document}). The extension does not care at all the context or the location of the command. See an [[OpenWetWare:Feature_test/LatexDoc|example]]. See an [[OpenWetWare:Feature_test/LatexDoc|example]]. + + ==Code== + Source file could not be found ---- ---- Send bugs and comments to [[Austin Che]]. Other extensions including sources can be found at [[../]]. Send bugs and comments to [[Austin Che]]. Other extensions including sources can be found at [[../]]. + + [[category:Extensions]] ## Current revision The LatexDoc extension in MediaWiki SVN has been modified as follows: • The biggest change is to allow use of other files on the wiki so that bibtex and graphics works. • Requires latexmk • The default location for latexmk is in the extensions directory of your mediawiki installation. • If you wish to use a different location, add$wgLatexDoc->latexmk = "/path/to/latexmk"; in LocalSettings.php after requiring/including LatexDoc.php.
• Removed DVI output (not useful on web)
• Security: Removed filter for "obviously dangerous control words" as it isn't a good security mechanism.
• Instead, change texmf.cnf so that shell_escape=f, openout_any=p, and openin_any=p. This disallows running system commands and reading or writing any files not under the directory of the tex file.
• texmf.cnf is located in /usr/share/texmf/web2c/texmf.cnf on tetex distributions. Debian users should edit /etc/texmf/texmf.d/95NonPath.cnf and run update-texmf as root.
• You may also want to run latex under a chroot jail.
• If anyone notices any other security issues, please let me know.
• If you want automatic syntax highlighting, install the SyntaxHighlight extension (and GeSHi).

Usage:

Any wiki page that looks like a latex document will automatically have links for added to the top. The Get PDF link will generate a PDF or grab it from the cache if it exists and the Regenerate PDF forces the PDF file to be regenerated.

The special command \usewikifile{Wiki Page Name}{texfilename} can be used. All such commands are stripped before being passed to latexmk for generation of pdf. In addition, the contents of Wiki Page Name are saved as texfilename in the same directory as the page. Thus, you can include graphics or use bibtex where the graphics and .bib file are stored on the wiki. Hint: If you wish to use the same file both on and off the wiki, you can put the \usewikifile in a comment or some other place where normal LaTeX won't parse it (such as after \end{document}). The extension does not care at all the context or the location of the command.

See an example.

## Code

<syntax type="php" file="http://austinche.name/mediawiki/LatexDoc.php.txt">Source file could not be found</syntax>

Send bugs and comments to Austin Che. Other extensions including sources can be found at User:Austin J. Che/Extensions.