0

I can use preview-latex successfully on any Tex buffer, and it works great.

I was wondering how I can enable previewing capability for any mode, such as Fundamental, or any other programming language modes. I tried this, and I get

TeX-region-create: Wrong type argument: stringp, nil

I am especially interested in having this work for Ein mode, the ipython notebook mode. I tried previewing in this mode as well, and I get a complaint from Ein saying that the point at I am at is read-only.

http://tkf.github.com/emacs-ipython-notebook/

Thanks,

BBSysDyn
  • 4,389
  • 8
  • 48
  • 63
  • 1
    Likely this is impossible, as preview mode is tied to AUCTeX, i.e. uses it's API, which obviously only works when applied to LaTeX files. –  Mar 27 '13 at 11:54
  • It is possible, although my old method doesn't work for me right now. The preview .ps file is generated, but `gs` fails to generate .png files. – lukstafi Mar 29 '13 at 08:33

1 Answers1

0

Copy the "preamble.tex" file, or your own LaTeX file, to your working directory, and set the 'TeX-master variable to the path of your "preamble.tex" file. Also, set 'TeX-header-end and 'TeX-trailer-start. Basically, add the following to your mode hook:

(set 'TeX-header-end "^[^%\n]*\\\\begin *{document}")
(set 'TeX-trailer-start "^[^%\n]*\\\\end *{document}")
(set 'TeX-master "/path/to/preamble.tex")
(cd "/path/to/")

Content of preamble.tex:

\documentclass[12pt,a4paper]{report}
\usepackage{amssymb,amsmath,amsthm}
\begin{document}
\end{document}

I haven't checked this out recently, but it worked for me long ago. Let me know if you've made progress and I'll update my answer.

lukstafi
  • 1,883
  • 15
  • 22