Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've installed AUCTeX and passed the circ.tex preview, however, when I'm trying to add more elements (enumerate, tabular) to preview with \PreviewEnvironment{..} in the preamble, AUCTeX ignores these lines and render only math, table, sections, and other default elements. I've tried to add custom environments in preview-default-preamble, but no success.

It's probably a part of the same problem, but if I try C-c C-p C-e (preview the environment with a pointer inside this environment), it says no enclosing outer environment found -- a pretty rare error, Google finds it only in preview.el sources.

preview-image-type is set to dvipng (png and gswin32c.exe do not work properly).

Emacs 23.3 and TeX Live 2011 are the counterpart.

share|improve this question

migrated from stackoverflow.com Aug 28 '11 at 20:08

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 1 down vote accepted

Worked through the problem and have three points to stress:

  1. \PreviewEnvironment should not work in a tex file's preamble.

  2. One way to add custom environments is by adding full \PreviewEnvironment{..} entries after the last string of the default Preview Default Preamble string (expected to be ]{preview}[2004/11/05]). It's equivalent for .emacs: (setq preview-default-preamble (quote ("\\RequirePackage[" ("," . preview-default-option-list) "]{preview}[2004/11/05]" "\\PreviewEnvironment{center}" "\\PreviewEnvironment{enumerate}"))), where center and enumerate are example custom environments. Alternatives are (preview-latex.pdf, p. 11):

    • including custom environments in local file variables
    • a configuration file in the project's directory
  3. M-x preview-environment (C-c C-p C-e) works only for the customized environments (see 2) and environments from preview-default-option-list.

share|improve this answer

Point 1: PreviewEnvironment certainly works in the preamble if preview.sty has been loaded. The AUCTeX component of preview-latex uses \AtBeginDocument for loading it in order to give the document itself a chance to load it with its own individual options.

Point 3: preview-environment most certainly works for any environment, but it likely does something different from what you expect it to do: it runs the region enclosed by the current environment through preview-latex, and everything that would be previewed inside of that region when running the whole document through preview-latex will get freshly previewed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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