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.

Is there a way to fix Emacs AUCTeX's preview-latex to make the previews look less ugly? Specifically, they are squashed vertically to a height of exactly one line of text. I have screenshots to show you what I mean.

LaTeX

(notice how lines 69 and 70 are wider than the surrounding lines to add make the section names stand out).

Preview

(notice how lines 69 and 70 are now the same width as the other text lines).

How can I fix this behaviour so that the size of lines get resized automatically to allow for correctly proportioned previews? The example above is just for a section name, but it also happens for equations, which are affected even more.

Thanks!

EDIT: Here's an example of an equation preview:

Equation preview

Compare to:

Correct equation preview

Furthermore, the problem is not with the images being restricted to only one line spacing after all (this equation takes up the equivalent of about 3 lines of vertical spacing), but they are still stretched out too wide.

share|improve this question
    
I would just turn off section previews entirely; I'm not sure how you turned them on (I've never messed with mine, and the first screenshot is all I ever see), but it may be better to simply get rid of them entirely. –  Sean Allred Mar 9 '13 at 10:30
    
Oh, and welcome to TeX.SE! –  Sean Allred Mar 9 '13 at 10:33
    
I agree, I don't particularly like section previews either. But the same thing happens to equation previews, which is what I'm really after. (Also, I didn't turn it on actually. This is a fresh install of emacs and AUCTeX. I just highlight the line and press C-c C-p C-r to get section previews.) –  Silvo Mar 16 '13 at 0:18
    
Try C-c C-p C-d - I've never used the region one before. It shouldn't produce different outputs, but may get rid of the section previews. The fact that this is happening to equations, however, is unacceptable. I have a feeling this has something to do with ghostscript. –  Sean Allred Mar 16 '13 at 10:44
    
When you turn on previews, a folder should be made called _region_.prv (or something similar). Open that up and make sure its contents aren't stretched similarly. –  Sean Allred Mar 16 '13 at 10:44

2 Answers 2

You can specify how the preview-latex should scale your inputs in the preview-latex configuration:

M-x customize-group preview-latex

The customization you should change is the preview-scale-function. The default configuration let the size depend on the current face you are using. This can be changed to a fixed value. Try to insert following in your preamble:

(set-default 'preview-default-document-pt 12)
(set-default 'preview-scale-function 1.2)
share|improve this answer
    
I can't find the relevant section when running the customize-group command, but the set-default functions seem to work nonetheless. However, while it does scale the preview images, it does not fix the weird proportions issue (as in, the preview images look exactly the same as in my screenshot, only bigger). –  Silvo Mar 9 '13 at 10:05
    
preview-scale-function scales both height and width. [From the documentation], it doesn't seem that there is a straightforward way of doing this. (You might try a hook that will stretch the PDFs themselves?) –  Sean Allred Mar 9 '13 at 10:32
    
What is your output on C-h v preview-dvipng-command and what is C-h v preview-dvipng-image-type specified to be? –  aagaard Mar 9 '13 at 10:39
    
preview-dvipng-command: "dvipng -picky -noghostscript %d -o \"%m/prev%%03d.png\"" preview-dvipng-image-type: png –  Silvo Mar 16 '13 at 0:22
up vote 0 down vote accepted

I've worked it out. I had installed the auctex package from the Arch Linux package repository. I tried removing it and installing the auctex package within emacs (M-x package-install auctex) instead, and it worked!

I was getting an error: Error: /typecheck in --setfileposition-- (mentioned here), which I fixed by changing preview-image-type to dvipng.

I have no idea what the difference is between the Arch package and the other version, because both reported the same version number.

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.