latex-bfc.pl An enhancement of latex.pl to allow raw latex to produce multiple PNGs or embedded PDFs; now uses amsmath and hyperref packages by default. Requires pdflatex.
v1.2c (2008-07-10)
- Now you can
\includegraphics{pic.pdf}
as written (we secretly add the ../
so as to look in $LatexDir where you really downloaded it. - Fixed silly bug where the security quoting of raw latex comments was quoting all previous comments.
- Fixed silly bug where math & displaymath weren’t being produced as tight PNGs.
v1.2
- Allows
\includegraphics{../file}
(by processing everything through pdflatex, cropping with pdfcrop and using convert to make PNGs) - Defaults to producing cropped PNGs
- For single raw latex block, can override cropping and full-page format with
{{{ $ [opt
where opt can be png,pdf,pdffull,pngfull (pngtight, pdfcrop no longer works) - I tried really hard to get PDFs embedded in a reasonable way, but the embed and object tags are flaky.
- Cropped PDFs as well as PNGs using pdfcrop.
- Now has links next to each png to popup pdf, cropped pdf and latex.
v1.0
- enhanced raw latex mode (not secure, so don’t let random people be editors!) (default
$allowPlainLaTeX=1
) -
{{{
}}} to delimit raw LaTeX commands. Not suitable for use on a publicly editable wiki. - raw latex produces full-page PNGs (one for each page) by default, with option to embed a PDF instead ($RawLatexOutput=“pdf”). This allows entire latex files to be displayed.
-
{{{ $[type[options]{class}
are options. - type is the filetype of the output and can be pdf, png or pngtight (margins clipped)
- {class} is the LaTeX \documentclass. [opt] are options for {class}. They are optional and cannot stand by themselves.
- raw latex mode is restricted to Editors and Admins unless
$RawLatexForAll=1
- Advantages to raw latex mode versus restricting to math and displaymath modes.
- You can more easily include existing latex documents (just paste in the part between
\begin{document}
and \end{document}
). - You can use many more environments, esp. environments like enumerate and align.
- You can include graphics. Post the graphics files in a pdflatex-friendly format (PDF, PNG, JPEG or GIF, not EPS) to $LatexDir and refer to a file as
\includegraphics{file.pdf}
.
To Do (latex-bfc.pl)
- When upgrading the BFC site from beta, BE SURE to change $LatexDir back to latex
- TODO. There must be an optimization here for cropping. Currently it goes .tex - .pdf - .ps - .tex - .pdf. Yeek. I tried to hack the equation service templates to get pdflatex to directly produce a cropped page, but I couldn’t make it accept multiple line inputs.
- TODO. It would be nice to find a subtle place for the links. Maybe they hide until the image is clicked? A little JS.
Deferred/Done
- MAYBE. Use Equation Service templates to trim PDFs (e.g. for calc problems)
- MAYBE. How to cleanly push out config changes (e.g. $WikiLinks = 0; # No CamelCase links) to different sites.
- should set in bfc.pl defaults but allow people to change it in config? So in bfc.pl, $WikiLinks = 0 unless (defined ($WikiLinks)) ; # No CamelCase links
- check order of loading of variables (and modules!)
- MAYBE. Allow pdf=1 to make optional cookie?
- MAYBE. Make problem graphic a link to pop-up to give raw latex?
- DONE. Allow loading special class file. Ultra raw mode where there’s no template?
- WORKAROUND. Can’t adjust PDF embed window in custom way.???
- â FIXED. PATCHED. MyMacro subs don’t affect comments.
Graphics Format
- TRIED. Improve PNG look by producing higher res and scaling in browser?
- Browsers are not reliable scalers.
- TRIED. For PDF embeds, calculate the width exactly. height too.
- I can look at the --debug output from pdfcrop (which shows gs’s Page 1: bounding box lower left x, y, upper right x, y.) But the embedded PDf still looks horrible.
- TRIED. Use equation service templates to trim the PDF. (couldn’t quite figure it out… multiline output wasn’t working.
Option 1. PNG output.
- Every browser understands it, readable with equations. Can use any latex.
- Can’t get dvipng to look good.
- hyperlinks won’t work.
- â Improve the look of the dvi2png. Must be some way to boost the quality.
- â Try --truecolor and -density (doesn’t work)
- â Improve PNGs by converting PDF with imagemagick convert. (It doesn’t look any better. )
Option 2. PDF output.
- Looks GREAT as text. Most browsers can read.
- Idiot Adobe toolbars. TURN OFF?
- hyperref does do links, but they open within the embed window. Not sufficient.
- Actually this works fine on Firefox/Win and IE7, to change the whole window. Same with Safari.
- The problem is with Apple’s PDF Viewer. Adobe Acrobat seems to handle it all right.
Rejected
- Opt 3. TTH.
- tried TTH. Doesn’t look right and doesn’t support AMS-LaTeX.
- Opt 4. Latexmathml.
- Opt 5. http://www.math.union.edu/~dpvc/jsmath/
- doesn’t like enumerate
- doesn’t like most environments
- can’t quite install right on my OS X side
- Opt 6. latex2html.
- outputs equations to PNGs! Same quality issue as before.
- BUT, hyperlinks would work.
- Opt 7. http://www.cse.ohio-state.edu/~gurari/TeX4ht/
- Still uses bitmaps for letters and figures
- BUT, some lovely lists of TeX-HTML utilities