jed-users mailing list

[2011 Date Index] [2011 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [Jed-users-l] [PATCH] TeX mode: Replace three dots by \ldots instead of {\ldots}


On Thu, 12 May 2011 at 11:15:20 -0400, John E. Davis wrote:
> 
> I like your idea of using \cdots if proceeded by a binary operator.

As this is important for me, I spent some time reading the docs to try
to come up with something. 

The below is working for me after simple tests, where "me" means 
Plain TeX user who cares about ... replacements only in math mode 
(but typing an extra "\" in text mode for LaTeX does not seem too bad).

I'd be theoretically happier if I got \dots in text mode, but ... in 
text mode for me is extremely rare, so I won't particularly invest
time in this direction.

define tex_is_after_binary_operator ()
{
	bskip_white();
	go_left(1);

	if (looking_at("+") || looking_at("-")) {
		go_right(1);
		return 1;
	} else {
		go_right(1);
		return 0;
	}
}

define tex_ldots ()
{
   if (blooking_at ("..")) {
	   go_left(2);
	   deln(2);

	   if (tex_is_after_binary_operator()) {
		   insert(" \\cdots");
		   return;
	   } else {
		   insert(" \\ldots");
		   return;
	   }
   }
	insert_char ('.');
}


Note that I also removed the tex_is_verbatim_environment () check, because
I'd like this replacement even inside verbatim mode (even if I was using
latex -- as that function looks for \begin{verbatim}).
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l


[2011 date index] [2011 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]