When I run


\usepackage[active, tightpage, displaymath]{preview}


1+2 = 3


I get the following result enter image description here

I checked this question "Crop equations with preview package" but the solutions provided there, using external script or replace equations all inline, don't work for me because that image snippet will be used for Emacs auctex preview that automatically inserts "\usepackage[options...]{preview}" to the original tex document, generate equation snippets, then overlay them on the equation strings making the editing like more WYSIWYG-ish.

Anyway, Emacs auctex variable preview-default-preamble enables me to insert some custom strings to the preamble when it generates the preview images, so I was looking for something like


to be inserted to the preamble when I run preview-document.

But those naively written \renewcommand commands don't work of course. I know that I can use \renewcommand or even \def or \let to redefine macros, but how can I do it for the macro with certain arguments? More directly,

What should I put in the preamble so that whenever the compiler sees \begin{equation*} it replaces it with \begin{math}\displaymath and run it?

PS. This may look like an XY question, but I'm also interested in finding the solution because I have something else that I could do with that. :-)

  • 1
    You may find it useful to read up on \renewenvironment etc and understand how LaTeX environments work. Dec 12, 2020 at 3:59

1 Answer 1


Thanks for ShreevatsaR's comment, I found it and it was simple! I don't know why I was so obsessed with macros, but I just put


and it worked perfect. (I could not put $ in place of \begin{math} and \end though but that's not a big issue and is understandable why it doesn't work.)

I'll also edit the title because this thing with preview with that spacing has been an minor annoyance for quite a long time for me (cf. how to set preview-latex left indentation on formulas?).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .