简体   繁体   中英

fail to preview using auctex and emacs

I am using emacs and auctex on linux mint. I fail to preview the math formula in emacs when writing the following simple .tex file

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}

\begin{document}
I am going to write down the formula 
\[
    \sum_{k=1}^\infty x_k=\frac{x}{1-x^2}
\]
\end{document}

When I press Cc Cp, there comes the following error messages:

No appropriate `.dvi' file could be found

It seems that emacs doesn't generate any .dvi file. How to address this problem? Thanks all.

I ran into this issue because I was asking for the dvi file to be displayed before it was done being built. The following elisp is used inside a bind-keys function which assigns control-p to preview the latex.

("C-p" . (lambda ()
  "Preview a latex buffer or selected region."
  (interactive)
  (if (use-region-p)
     (tex-region (region-beginning) (region-end))
   (tex-buffer))
  (run-with-idle-timer 0.3 nil 'tex-view)))

The tex-region and tex-buffer commands begin the conversion from TeX to dvi and opens another window showing the intermediate file names. These files, which include the desired dvi file, will be deleted as soon as the window is closed.

I used the run-with-idle-timer function to wait until emacs has been idle for 0.3 seconds before attempting to display the file.

Note: I am uncertain if this works solely because my tex file is small, or because it actually works.

Cc Cp Cp 在 Windows 10 上对我有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM