[Top][All Lists]

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

Re: [AUCTeX] Three new user questions

From: Ralf Angeli
Subject: Re: [AUCTeX] Three new user questions
Date: Sun, 22 Jun 2008 11:18:54 +0200

* Ista Zahn (2008-06-22) writes:

> On Jun 21, 2008, at 8:43 PM, Ista Zahn wrote:
>> On Jun 21, 2008, at 5:18 PM, Ralf Angeli wrote:
>>> Assuming you have parsing enabled as described on the first page of  
>>> the
>>> AUCTeX manual, you can get AUCTeX from CVS which has support for
>>> hyperref ... since, uh, 5 minutes.
>> Thanks, but  I was just using hyperref as an example. What I would  
>> really like is for the editor to recognize which packages are loaded  
>> and recognize macros from all loaded packages. I realize of course  
>> that this may not be possible...

So, did you enable parsing?

AUCTeX knows a lot of packages and their commands but you need to till
it to look for them.  Probably more important than syntax highlighting
is the possibility to complete macros when inserting them with `C-c
<RET>'.  AUCTeX can parse LaTeX package files and derive information for
completion, see (info "(auctex)Automatic") <-- Type `C-x C-e' here.
The main function for generating this information is

>>> RefTeX does not provide support for apacite as for natbib or jurabib
>>> yet.  But you can define your macros by customizing the variable
>>> `reftex-cite-format'.  See (info "(reftex)Citation Styles") and
>>> (info "(reftex)Options (Creating Citations)").
>> Yes, I've looked at the documentation, but I don't understand what I  
>> need to do. I've been using emacs for about 12 hours...

Then you should likely take a look at the tutorial available through the
menu: Help --> Emacs Tutorial.  Once you are through with that you can
look at the Emacs manual, specifically at the chapter about
customization, see (info "(emacs)Easy Customization").  When you want to
adapt a variable it usually boils down to an `M-x customize-variable
<RET> <variable_name> <RET>'.

>>>> 3)  I use Sweave a lot, and I want to be able to run Sweave (I  
>>>> have a
>>>> shell script for this) on foo.Rnw, then latex on foo.tex. The  
>>>> problem
>>>> is that if I ask the Sweave script to run latex it tries to run  
>>>> latex
>>>> on foo.Rnw instead of foo.tex. Does anyone know how to make this  
>>>> work
>>>> properly?

You should consider getting a MUA which does not produce this kind of
botched quoting.

>>> How do you call the Sweave script?  Did you add "nw", "Rnw" and  
>>> "Snw" to
>>> `TeX-file-extensions' and `reftex-file-extensions'?
>> I think aquamacs emacs is set up this way by default. I didn't add  
>> anything, but the editor seems to recognize .Rnw files and loads  
>> AUCTEX and RefTEX automatically.

Well, then you should complain to the Aquamacs developers that they did
not manage to get this right.  Since they usually don't contribute their
changes back to AUCTeX I don't know what they've done and it is not easy
to comment what might be wrong.  In any case the values of the above
mentioned variables could be interesting.  What does e.g. `C-h v
TeX-file-extensions <RET>' return?

>>> Frankly I don't have much experience with how AUCTeX has to be set up
>>> for Sweave.  The above I picked up from some discussions on this  
>>> list.
>>> But since there are some Sweave users who also use AUCTeX perhaps you
>>> get some information by searching the archives of the Sweave mailing
>>> lists or asking there.  Unless some Sweave user lurks on this list  
>>> and
>>> shares her or his wisdom.
>> Thanks for the tip, I'll ask this question in a more appropriate  
>> forum. On the other hand I'm worried that I'll simply be told to ask  
>> on an emacs mailing list because the question is really an AUCTEX  
>> question.

That's why I suggested to search first.  Gmane
(<URL:>) is a good place to do that.

>> Basically, I want the  typesetting command to refer to  
>> foo.tex even though I'm calling it from a buffer named foo.Rnw.

AFAIU you will need extra commands for running Seave and LaTeX after
Sweave.  Assuming you are using ESS the following might work if you put
it into your init file:

(add-hook 'Rnw-mode-hook
          (lambda ()
            (add-to-list 'TeX-command-list
                         '("Sweave" "R CMD Sweave %s" 
                           TeX-run-command nil t :help "Run Sweave") t)
            (add-to-list 'TeX-command-list
                         '("LaTeXSweave" "%`%l%(mode)%' %s" TeX-run-TeX nil
                           t :help "Run LaTeX after Sweave") t)))

I derived this from

It adds two new commands ("Sweave" and "LaTeXSweave") to
`TeX-command-list' which you should see in the "Command" menu afterwards
and which should be available for completion with `C-c C-c'.

Perhaps some Sweave or ESS user can shed some light on what the exact
workflow is.  Then we might have a chance to support this correctly in
AUCTeX out of the box.


reply via email to

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