# PreviewLaTeX

Last edit

Sumário: preview-latex Error: /typecheck in --setfileposition-- and math not displayed

> * Using ghostscript 8.71 an error occurs when emacs tries to display the math images and ghostscript complains with:
> Error: /typecheck in --setfileposition--
> as reported in http://comments.gmane.org/gmane.emacs.auctex.bugs/1822 or
> : The error occurs only in PDF mode (go to Command -> TeXing Option and uncheck Generate PDF to be back to DVI mode and every thing should work: CTRL_C CTRL_P CTRL_D). The current (January 2001) error comes from a change in pdf_main.ps not reported to the file pdf2pdsc.ps . See patch
> http://svn.ghostscript.com/viewvc?view=rev&revision=10778
> : The commands:
> pdflatex "\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes]{preview}[2004/11/05]\fi}" "\input" toto.tex
> : and:
> pdf2dsc toto.pdf toto.prv/tmp33492THG/preview.dsc
> : were working but the dsc file was output with 'copy_trailer_attrs' instead of 'process_trailer_attrs'
> which made further ghostscript commands fail.

Package preview-latex runs LaTeX on equations and other environments (figures and tables) of your source and replaces the fragment of the source by an preview image. In the “edit mode” for equations, you see the normal LaTeX code.

## LatexMk as alternative to preview-latex

As an alternative a useful perl program known as latexmk.pl works well under cygwin, and provides a dvi “preview window” which updates on every page save. This gives a more stable “realtime” preview of your Latex document.

latexmk -pvc yourdoc.tex opens a preview window that continuously reflects changes to the tex source

LatexMk comes as standard with the popular tex installation MixTex? but is also available from ftp://ctan.tug.org/tex-archive/support/latexmk/ .You may have to make some changes to the perl file as detailed in the INSTALL file

You can incorporate some of the latexmk commands into the Auctex C-c C-c cycle / Toolbar menu using M-x customize-group auctex.

## Known Issues

The error occurs only in PDF mode (go to Command → TeXing? Option and uncheck Generate PDF to be back to DVI mode and every thing should work: CTRL_C CTRL_P CTRL_D). The current (January 2001) error comes from a change in pdf_main.ps not reported to the file pdf2pdsc.ps . See patch http://svn.ghostscript.com/viewvc?view=rev&revision=10778
The commands:
` pdflatex  "\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes]{preview}[2004/11/05]\fi}" "\input" toto.tex`
and:
` pdf2dsc toto.pdf toto.prv/tmp33492THG/preview.dsc`
were working but the dsc file was output with ‘copy_trailer_attrs’ instead of ‘process_trailer_attrs’ which made further ghostscript commands fail.