[Top][All Lists]

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

Re: [Bug-AUCTeX] TeX fill instead of LaTeX fill for \subsection at top o

From: Ralf Angeli
Subject: Re: [Bug-AUCTeX] TeX fill instead of LaTeX fill for \subsection at top of file
Date: Fri, 21 Nov 2008 20:51:06 +0100

* Chris Pickett (2008-11-21) writes:

> Ralf Angeli wrote:
>> There are no such modes as "TeX Fill mode" and "LaTeX Fill mode".  Do
>> you perhaps refer to the modeline indicator?
> Yes, sorry.  I'm unfamiliar with formal emacs terms.  What are the 
> actual TeX/LaTeX modes called?

TeX mode and LaTeX mode.

>> Hard to say without more information.  Are you sure AUCTeX is enabled?
>> There should be a Command menu if it is.
> I don't see a specific AUCTeX menu, but "F10 l" gives me a LaTeX menu if 
> it says "section" instead of "subsection" in the file, and "F10 T" gives 
> me a TeX menu if it says "subsection" as written above.  Furthermore, 
> "F10 c l" runs LaTeX and "F10 c t" runs TeX correspondingly.  Can you 
> confirm this?

Wow, you make me jump through hoops.  I had to switch to a Linux console
to see what you mean because the GTK port behaves differently.  So I
guess I can confirm it.  But couldn't you just have said "Yes, there is
a menu called 'Command'"?

>> Not really, at least not with respect to macros used in the document.
>> If AUCTeX cannot derive the mode from the document contents it should
>> fall back to the mode given by `TeX-default-mode'.  Perhaps you changed
>> that?
> Not that I know of.  I looked through my .emacs and didn't see anything. 
>   How do I set TeX-default-mode to be LaTeX?

You shouldn't have to.  It's the default.

>>> Is there some way to always force LaTeX 
>>> mode?
>> Even for ConTeXt files?
> I've never used ConTeXt, presumably I can start caring if/when.

This was just an example demonstrating that forcing LaTeX mode under
every circumstance is not a good idea.

> Why do I care about this?  I break large documents into several files 
> and \input them from the master document file, and so sometimes I end up 
> having a single subsection in a file.

Okay, I now actually checked with a file as you provided it (shame on me
for not doing so before) and yes, it falls back to Plain TeX mode
because there is no string which is recognized by AUCTeX identifying the
file as being a LaTeX file.

You have two options dealing with the problem:

1) Set `TeX-force-default-mode' to t.

   This will disable the automatic file type recognition and always use
   the mode specified in `TeX-default-mode'.  However, I don't recommend
   this because it will disable a useful feature and is usually not
   necessary because there is option 2.

2) Set the variables `TeX-auto-save', `TeX-parse-self' and `TeX-master'
   as described on the first page of the AUCTeX manual.

   Especially the `TeX-master' setting will lead to AUCTeX prompting you
   for a master file each time you start a new file and then insert a
   "Local variables" stanza into the file like this:

   %%% Local Variables: 
   %%% mode: latex
   %%% TeX-master: t
   %%% End: 

   You can see that in the stanza the mode is specified and this is
   usually the default mode, namely LaTeX mode.  Each time you open the
   file this mode will be activated regardless of what the automatic
   detection would propose.

   For your existing files you can force the insertion of the stanza by
   typing `C-c _'.  You will have to replace `plain-tex' with `latex'
   and then type `C-c C-n' to reinitialize the mode.

   Note that this feature is mainly about the master file.  (The mode
   setting is secondary.)  The master file is the LaTeX should be run on
   in order to typeset the document if it is spread across different
   files.  Since you mentioned you actually _are_ dealing with documents
   spread across several files this is likely useful for you.


reply via email to

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