4

Preview-latex installs, but doesn't actually preview. When I generate the preview from the source, all I see is... the source. For example, the math equations are highlighted, but not rendered.

Some version information: emacs23 on Lion, and I just installed mactex and auctex today.

Here is an example latex document I've tried:

\documentclass{article}
\usepackage{preview}
\begin{document}
solution to $\sqrt{x}=5$ is $x=25$.
\end{document}

(also, the circ.tex sanity-check which comes with auctex doesn't work either)

3
  • Welcome to TeX-SX! I've edited your question to include the material you provided in the "answer" you've subsequently provdided. If you haven't already done so, you may want to register with the site so that you can edit your question.
    – Mico
    Oct 2 '11 at 0:40
  • No, the problem seems to be a ghostscript bug. I could not find any "solutions" that actually worked. Sigh. Oct 2 '11 at 4:02
  • 2
    @FrancisHaart I've merged the different accounts you created in posting two comments as 'answers'. As Mico says, please register an account: this will allow you to comment and edit on your own questions.
    – Joseph Wright
    Oct 2 '11 at 7:12
9

I answered a similar question elsewhere on this site, but I will post the answer here as well. It is extremely frustrating, and I want as many people to find this as possible. If moderators disagree, feel free to delete these posts and let me know

To FIX THIS:

Open a .tex file (or make one). I will assume that you are using Emacs23, using an Xwindow (Mine is in Gnome). Go to the menu bar and do:

Preview -> Customize -> Browse Options

In this buffer, do:

Preview GS -> Preview GS options -> [click on the little arrow to show the options] -> del -dSAFER

C-x C-s to save, and reload Emacs. Previews should work now! Hope this helps.

Sincerely, Matt

2
  • That exactly did the trick! Thanks a million times! Mar 31 '12 at 7:33
  • This didn't work for me. First of all, there was no -dSAFER option. There was a -dDELAYSAFER option, but deleting that did nothing.
    – Calculemus
    Sep 14 '20 at 0:52
3

I believe you need to add the option active when you load the preview package, as in

\usepackage[active]{preview}

Citing from the documentation of the preview package:

If [the active] option is not specified, the preview package will be inactive and the document will be typeset as if the preview package were not loaded, except that all declarations and environments defined by the package are still legal but have no effect.

Additional options you may want to specify are displaymath, textmath, and auctex.

Addendum: Just in case you haven't already done so, be sure to "activate" the preview-latex package (not the same as the preview package...) with

(load "preview-latex.el" nil t t)

in emacs/auctex. From the documentation of the preview-latex package:

If you still don’t get a “Preview” menu in LaTEX mode in spite of AUCTEX showing its “Command”, your installation is broken.

2
  • Some version information: emacs23 on Lion, and I just installed mactex and auctex today. Here is an example latex document I've tried: \documentclass{article} \usepackage{preview} \begin{document} solution to $\sqrt{x}=5$ is $x=25$. \end{document} (also, the circ.tex sanity-check which comes with auctex doesn't work either) Thanks Oct 1 '11 at 23:40
  • Adding the active option yourself makes the document useless for non-preview compilations. active, auctex and tightpage options are automatically supplied by preview-latex. One only needs to load the preview package oneself if one wants to use a non-standard preview configuration, and even then one should leave one's fingers off the AUCTeX/preview-latex specific options and active since they will be supplied automatically.
    – user9588
    May 16 '12 at 17:10
3

If you do \usepackage{preview} yourself, preview-latex will assume that you know what you are doing and have specified all options to the preview package that you want to use. You have specified no options, and made no preview definitions. While preview-latex will use the command line for passing the active option to the preview package, no construct will actually be made active.

Instead of figuring what constructs to make active, I would recommend as first try to not change the default settings. Just remove your own \usepackage{preview} call, and preview-latex will load it by itself, in this case with sensible default options (which also work with the given math constructs).

Now you state that the "circ.tex sanity-check" also does not work: this would point to an installation problem, and you might want to report the way in which it fails using M-x preview-report-bug RET after running C-c C-p C-d on the circ document.

But it is expected that a document containing an unadorned \usepackage{preview} will not produce previews.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.