auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] integrating feynmf


From: David Kastrup
Subject: Re: [AUCTeX] integrating feynmf
Date: Fri, 20 May 2005 18:15:19 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ralf Stubner <address@hidden> writes:

> [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. :-(

You'd be amazed at what the `counters' option will achieve with regard
to keeping counters consistent.  And actually, \includeonly has its
own trickery for keeping the counters in a consistent state over
excluded parts.

>> 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}.  Those
>> are in TeX-header-end and TeX-trailer-start.  You could adjust 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}{%
>    \begin{equation}
>    \stepcounter{fmfeq}
>    \begin{fmffile}{fmf-\arabic{fmfeq}}
> }{\end{fmffile}
>    \immediate\write18{mpost -tex=latex fmf-\arabic{fmfeq}.mp}
>    \end{equation}}
>
> 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...

Have you customized
preview-required-option-list
to include the `counters; option?

>>>>>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"))
>> (add-hook 'LaTeX-mode-hook
>>   (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. :-(

Uh, LaTeX-command-style is defined by default as
(("" "%(PDF)%(latex) %S%(PDFout)"))
And TeX-expand-list contains
 ("%(latex)"
  (lambda nil
    (if TeX-Omega-mode LaTeX-Omega-command LaTeX-command)))

So LaTeX-command should get consulted after all, unless you customized
LaTeX-command-style to be something different.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

[Prev in Thread] Current Thread [Next in Thread]