auctex
[Top][All Lists]

## [AUCTeX] integrating feynmf (was: [Bug-AUCTeX] rel-0-9-1; Two speed issu

 From: Ralf Stubner Subject: [AUCTeX] integrating feynmf (was: [Bug-AUCTeX] rel-0-9-1; Two speed issues) Date: Fri, 20 May 2005 17:29:06 +0200 User-agent: Debian Thunderbird 1.0.2 (X11/20050331)

[IMO this no longer belongs to bug-auctex, so I simply subscribed to the normal AUCTeX list]

David Kastrup wrote:

Ralf Stubner <address@hidden> writes:


David Kastrup wrote:


Ralf Stubner <address@hidden> writes:


I haven't found a possibility yet to have those play nicely
together with preview-latex.


Where is the problem?  Just use one empfile (?) environment per
graphic.


That works fine for emp.sty, where I have only a few graphs. The
problem ist feynmp.sty, where I currently have ~80 graphs within
something like 30 or 40 displayed equations (still increasing). At
least at the moment I find it more practical to have one 'fmffile'
per file in a multi-file document and make occasional preview-latex
runs on the whole buffer.


Well, one possible remedy would be to place the fmffile stuff _around_
\begin{document}...\end{document}.  Then it should be active on each
run.  No idea whether this will do more harm than good though, and
you'd quite probably need to use METAPOST on every run if you hope to
achieve anything close to consistency (not sure how the "counters"
option might interact here.  If you use that, you probably should
_not_ run METAPOST when regenerating regions).



Unfortunately having only one fmffile in a multi-part document using \includeonly is asking for trouble. At the LaTeX level a counter is used to number all the different diagrams. This counter can have wrong values if say the first and the third part but not the second part a processed after changes have been made to the first part. :-(


There are also regular expressions to tell AUCTeX what to include in
every region compilation, and those expressions usually take
everything outside of \begin{document} and \end{document}.

them to include the file writing code from feynmp.



Thanks, I will look into this. Currently I am giving your first suggestion of using a separate fmffile environment a try. IMO the main problem is the naming of all these files, which I tried to automatize with a LaTeX counter:

\newcounter{fmfeq}
\newenvironment{fmfeq}{%
$$\stepcounter{fmfeq} \begin{fmffile}{fmf-\arabic{fmfeq}} }{\end{fmffile} \immediate\write18{mpost -tex=latex fmf-\arabic{fmfeq}.mp}$$}


This works quite well in principle (I only have to find out how to register this new environment with RefTeX or leave out the equation environment from the definition). With two LaTeX runs, where at least the first one uses -shell-escape, I get consistency. Unfortunately, this still doesn't integrate well with preview-latex, since I can't get preview-latex to call latex with -shell-escape (see below). So if I call preview-latex for some fmfeq environment, I get the graphs from the first fmfeq environment, since the fmfeq counter is 1 during the preview-latex run. Maybe it would be best to use the label of the equation environment instead of a counter...


BTW, is it possible to call latex with -shell-escape' on a case by
case basis from within AUCTeX, similar to source specials or PDF
mode?


% Local Variables:
% LaTeX-command: "latex -shell-escape"


Thanks, that helps. Really nice would be a possibility to switch
between enabeling '-shell-escape' or not, since I don't want
MetaPost to process the files, even if nothing has changed.



Well, choose a keyboard binding and write a toggle for it.  About 5
lines of Lisp code, something like

(defun TeX-toggle-escape nil (interactive)
(if (string= LaTeX-command "latex") "latex -shell-escape" "latex"))

(lambda nil
(define-key LaTeX-mode-map "\C-c\C-t\C-x" 'TeX-toggle-escape)))



Thanks, I am now using:

(defun TeX-toggle-escape nil (interactive)
(setq LaTeX-command
(if (string= LaTeX-command "latex")
"latex -shell-escape" "latex")))


This works really well with AUCTeX. However, preview-latex does not seem to honour this change LaTeX-command. It seems to get which command to run from LaTeX-command-style. But I have no idea how that one works. :-(

cheerio
ralf