auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] Preview and math mode


From: David Kastrup
Subject: Re: [AUCTeX] Preview and math mode
Date: Wed, 20 Nov 2013 14:27:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

François Poulain <address@hidden> writes:

> Hi,
>
> I encounter errors when I try to use the preview LaTeX package on the
> macro or environments with math mode. For example, the following file
> does not compile:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass{article}
> \usepackage[active]{preview}
> \PreviewMacro[{{}{}}]{\frac}
>
> \begin{document}
>
> \[
>   x= \frac{\alpha}{\beta}
> \]
>
> \end{document}
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%

> I guess this is relyed to the math mode, but I don't know how to deal
> with. I tried to add @{\ensuremath} in the PreviewMacro options, but it
> didn't work.
>
> Notice that, as far as possible, I don't want to preview the entire
> equation environment, but only a part of it.
>
> Any idea?

Well, the preview stuff is funneled off for separate typesetting, and
you need to get the math mode back into it.  I get nice results for
preview-latex (namely C-c C-p C-d inside of Emacs/AUCTeX) with

\documentclass{article}
\usepackage{preview}
\PreviewMacro[{{}{}}][$\displaystyle #1$]{\frac}

\begin{document}

\[
  x= \frac{\alpha}{\beta}
\]

\end{document}
Depending on your needs, you might consider using \[#1\] in the optional
argument instead, but that gives a full-length display math environment
with indentation and spacing that's less suited for previewing.

-- 
David Kastrup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]