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

Re: AucTeX / Emacs syntax highlighting problem



Jörg Johannes <liste_joerg@gmx.de> writes:
> I have a file called header.tex in my home directory which I use for
> every LaTeX document. When I try to do
> \input{$HOME/header}
> at the very beginning of my document, emacs colors everything in
> math-mode-colour because of the "$"-sign.

(Does TeX even support that?  *tries*  Weird...)  Depending on what's
in the header.tex file, you might consider creating a LaTeX .sty file
and using \usepackage{header} instead of \input.  But you'll need to
do extra magic if header.tex inserts text at the start of the document.

> I do not want to use the absolute path, because I use the same
> tex-files on my home box ($HOME == /home/jorg) and on an IRIX box at
> university ($HOME == /usr/people/jorg).

TeX searches the current directory by default.  It also searches every
directory in the TEXINPUTS environment variable, so you might put

  TEXINPUTS=$TEXINPUTS:$HOME

in your .bashrc or equivalent.  (And it's important that you do it
this way, even if $TEXINPUTS starts empty, since TeX takes an empty
entry as "the default value".)

> Can I tell emacs to ignore the "$" sign in \input{} context? (is
> this a bug?). To work around this, I \input another file called
> $HOME/newcommands, so the math mode stops there... but this is not
> very beautiful.

I run into this problem more often with inline verbatim text.  One
might format \verb|$foo =~ s/bar/baz/g;|%$
but then Emacs will get confused seeing the $.  Putting %$ at the end
of the line is a comment to TeX, but also gets Emacs back in sync.  So
for your case,

\input{$HOME/header}%$

should get around your formatting problems.

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: