unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Coloring a command in LateX-mode?
@ 2003-06-23 12:30 Nicolas Neuss
  2003-06-23 20:27 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Neuss @ 2003-06-23 12:30 UTC (permalink / raw)


Hello, all.

I have a document which I want to write bilingual (German and English).  To
this end I have defined the following TeX/LaTeX commands:

\newif\ifgerman    \germanfalse    \germantrue
\ifgerman\usepackage[german]{babel}\fi
\newcommand{\ifg}[2]{\ifgerman#1\else#2\fi}

which can be used, e.g., as

\ifg{Hallo}{Hello}!

Now, it would be nice if Emacs' LaTeX mode could be instructed to show the
German and English parts of the text with different colors.  I have tried
to find something with similar functionality in tex/latex-mode, but this
stuff is not easy to understand - at least for me.  Therefore, I would very
much appreciate any help from knowledgeable people.

Thank you, Nicolas.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Coloring a command in LateX-mode?
  2003-06-23 12:30 Coloring a command in LateX-mode? Nicolas Neuss
@ 2003-06-23 20:27 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2003-06-23 20:27 UTC (permalink / raw)


>>>>> "Nicolas" == Nicolas Neuss <Nicolas.Neuss@iwr.uni-heidelberg.de> writes:
> \ifg{Hallo}{Hello}!

If the `Hallo' and `Hello' parts are short enough (a couple lines at most),
you can use font-lock-add-keywords in your tex-mode-hook.

Otherwise, you'll have to use something more complex and it's probably not
worth the trouble.  If you really insist on doing it, I'd recommend you
look at how perl-mode and cperl-mode handle the s/.../.../
command highlighting (they use two different approaches).
For perl-mode, you'll have to look at the version that's in Emacs-CVS
because the version in Emacs-21.3 does not have this code yet.


        Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-23 20:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-23 12:30 Coloring a command in LateX-mode? Nicolas Neuss
2003-06-23 20:27 ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).