Bug#384479: [benji@member.AMS.org: Re: better recognising of tex vs
plaintex filetype]
Stefano Zacchiroli
zack at debian.org
Thu Aug 31 15:52:42 UTC 2006
[ forwarding the message to the bug report for future reference, and as
a TODO list item ]
----- Forwarded message from Benji Fisher <benji at member.AMS.org> -----
Date: Thu, 31 Aug 2006 11:11:26 -0400
From: Benji Fisher <benji at member.AMS.org>
To: VIM Development List <vim-dev at vim.org>
Cc: Gautam Iyer <gautam at math.stanford.edu>
Subject: Re: better recognising of tex vs plaintex filetype
On Wed, Aug 30, 2006 at 10:36:09AM -0700, Gautam Iyer wrote:
> On Wed, Aug 30, 2006 at 07:17:16PM +0200, Stefano Zacchiroli wrote:
>
> > > I agree with the comment that plain TeX users may also define such
> > > sectioning commands. Maybe it would be safe if you check for such
> > > definitions, using an include-file search ... but of course, that is
> > > more convenient after ftplugin/plaintex.vim has been :source'd.
> >
> > I'm not really fond of plain TeX, but I think it is not really
> > widespread to \input slices of plain TeX. So the idea mentioned in
> > this thread was to implement the policy: "if a document starts with a
> > lot of blanks followed by one of the possible LaTeX sectioning
> > commands, then it is (probably) a LaTeX source file". What do you
> > think of this policy?
I think my undergraduate thesis (1985, plain TeX, just about the
time the first version of LaTeX came out) was structured that way (i.e.,
split into separate files, each beginning with a \chapter command or
something like that. (My thesis was also my introduction to vi.)
I also had several collections of macros, so my TeX files usually
started out with
\magnification 1200
\input standard
\input math
\input smiley
or something like that. I do not recall whether I defined any
sectioning commands in these files.
Now that you describe your proposed policy more, I like it a little
better. Specifically, I like the idea of looking at the first
non-comment, non-blank line, since that gets around the problem that
something that *looks* like LaTeX might be defined in an \input file. I
would like it better if it were more conservative. The problem is that
the LaTeX sectioning commands are not very LaTeX-y: if you were looking
for
\begin{chapter}
instead of
\chapter
then I would be a lot happier.
> I actually like this policy a lot. Most people who break latex files up
> into tonnes and tonnes of little files, do so based on sections. Odds
> are, that the little files will begin with a bunch of comments, and a
> sectioning command.
>
> It would make life easier if this made it into filetype.vim. Especially
> because changing g:tex_flavor means that every time I edit a plain tex
> file, I need to unlet this variable.
Another option is to add one of the lines
%&plain
%&tex
%&pdfplain
or
%&pdftex
at the top of the plain TeX files (assuming that they are your own).
This is the most reliable method for determining file the TeX flavor,
since it overrides a format specified on the command line:
$ latex myfile
will *not* load the LaTeX format if myfile.tex starts with one of the
above lines. The only problem (unless this has changed since the last
time I checked) is that the pdftex program is not smart enough to change
%&plain to %&pdfplain .
For now, I suggest doing what you think is right in the Debian
package. If plain TeX is really as rare as you think (I do not
disagree, but I am willing to be surprised!) and there are no
complaints, then I might vote for a change to the vim distro based on
feedback from Debian users.
HTH --Benji Fisher
----- End forwarded message -----
--
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20060831/206acae4/attachment.pgp
More information about the pkg-vim-maintainers
mailing list