Here's a LuaLaTeX-based solution to your challenge.
The Lua function replace_ddollar doesn't actually redefine the $$ primitive. Instead, it scans the input text at a very early stage of processing (before TeX's "eyes" start doing anything) and replaces all instances of $$ with either \[ or \]. The Lua code can handle code such as
$$a^2+b^2=c^2$$
i.e., matched pairs of $$ directives on a single line, as well as the usual entry format for equations, i.e.,
$$
E = mc^2
$$
Remark: Precisely because $$ is not being redefined in this approach, things can (and will) go wrong if the document contains instances of $$ that are not used to initiate or terminate display-math mode. Some examples of such instances:
- Unmatched instances of
$$ in a comment (including comment-like environments)
- Instances of
$$ in a verbatim-like environment
- Instances of
$$ in a URL string encased in a \url{...} directive
(I'm sure there are still more possibilities for things to go wrong.) Just in case you do have such instances in your document, the code below provides the macro \ReplaceDoubleDollarOff, which turns off the operation of the Lua function replace_ddollar. There's also a companion macro, called \ReplaceDoubleDollarOn, that switches the Lua function back on.
The risk posed by instances of single instances of $$ on an input line that are not meant to initiate or terminate displaymath mode can be greatly reduced if it can be assumed that the only instances of $$ that are supposed to initiate or terminate displaymath mode occur at the very start of a line: If this assumption is valid, simply reduce the search string in the second string.gsub function, "%$%$", with "^%$%$". The ^ character indicates that a match can occur only if $$ occurs at the very start of a line. [In case you're curious why the Lua code contains %$%$ rather than just $$: In Lua, the $ character is "special" and has to be escaped (by prefixing a % symbol) in order to denote an actual $ symbol.]

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{luacode} % for 'luacode' environment
\begin{luacode}
in_display_math = false
function replace_ddollar ( line )
line = string.gsub ( line , "%$%$(.-)%$%$" , "\\[ %1 \\]" )
line = string.gsub ( line , "%$%$" , function (x)
if not in_display_math then
in_display_math = true
return "\\["
else
in_display_math = false
return "\\]"
end
end )
return line
end
\end{luacode}
\newcommand\ReplaceDoubleDollarOn{%
\directlua{ luatexbase.add_to_callback(
"process_input_buffer", replace_ddollar, "replace_ddollar" )}}
\newcommand\ReplaceDoubleDollarOff{%
\directlua{ luatexbase.remove_from_callback(
"process_input_buffer", "replace_ddollar" )}}
\ReplaceDoubleDollarOn % Replacement function turned on
\usepackage{url} % just for this example
\begin{document}
$$
E = mc^2
$$
$$a^2+b^2=c^2$$ $$d^2+e^2=f^2$$ % Aside: I do not endorse this coding style!
$$
x = 3\alpha^2 + \beta = \int f\, d\mu.
$$
% Turn off replacement of double-dollars
\ReplaceDoubleDollarOff
\url{A_URL_string_with_a_$$_and_$$$$_and_another_$$}
% Turn replacement of double-dollars back on
\ReplaceDoubleDollarOn
$$ e^{i\pi}-1=0 $$
$$
1+1=2
$$
\end{document}
\begin{align*}...\end{align*}. And if a new format is designed around this, it should be less fragile (I assume). – Gaussler Apr 23 '15 at 10:28\eqalignor\eqalignnoin plain TeX before using&. The native$$...$$doesn't support this. If you need to do\eqalignat every display then you can set\everydisplay. And my recommendation: forget LaTeX, use simply plain TeX. – wipet Apr 23 '15 at 10:29alignshould not be used for single line equations, and it would be hard to detect in time that there was no second line, also you should not have a blank line beforealign(or$$) and it is hard to define the macros to correct that. – David Carlisle Apr 23 '15 at 10:31gather*ormultline*oralignat*orflalign*? What's the purpose of obscuring one's code for a “gain” which is not such? – egreg Apr 23 '15 at 10:44$$…$$behaving like\[…\], but why should it be likealign*? – Franck Pastor Apr 23 '15 at 12:21l2tabupackage to see how it redefines$as an active character to catch the wrong usage of$$...$$and modify according to your wish. The usefulness of this still escapes me. – egreg Apr 23 '15 at 12:26LaTeXin almost any case? ;-) It doubt you would programe a graphical interface in assembling language instead of using C(++) or Java ;-) There are definitely some features of LaTeX which should be improved, this will be most probably attacked in LaTeX3 (or LaTeX4.... ;-)) ... The site is called TeX.SX, but the tour page says: Welcome to TeX - LaTeX Stack Exchange – Apr 23 '15 at 12:30$$...$$became\[...\],$...$might one day become\(...\), and\bf, \ttetc. were divided into math and text versions. So instead of a small, logical library of simple commands we got a gigantic, fragmented one. I like LaTeX and the ideas of it and would like to keep using it; I would just have liked if they modified the existing commands. – Gaussler Apr 23 '15 at 12:35\(...\)and\[...\]have to match in pairs. LaTeX2e does allow$and that means$$still works as at the time of design tokens were scarce (nowadays with e-TeX and lots of space you can move$as a math shift token out of the way). The short font commands get mentioned in http://tex.stackexchange.com/questions/15361/will-two-letter-font-style-commands-bf-it-ever-be-resurrected-in-latex, but probably a separate question would allow a better answer. – Joseph Wright Apr 23 '15 at 12:54\bf, \ttetc. would ever get the same meaning as\mathbf/\textbf, \mathtt/\textttetc., allowing them to be used again. And all he got was preaches why\bf, \ttare obsolete. Well, his idea as to make them up to date. – Gaussler Apr 23 '15 at 12:58\bf,\ttetc. were used in LaTeX 2.09 and their meaning was preserved in 2e to maintain compatibility with old documents. Also, you might be interested in Barbara Beeton's comment here regarding Donald Knuth's thoughts on the use of $ symbols for entering and exiting math mode. – Ian Thompson Apr 23 '15 at 13:21\bfand friends are not available withmemoirby default. KOMA-classes give warnings. – Johannes_B Apr 23 '15 at 13:23onlyamsmath.stywhich causes$$...$$to throw an error. I rather agree with others that it would be better not to legitimize plain TeX practice in LaTeX. Soonlyamsmath.stymight be one approach to breaking someone of the habit. It also enforce some other policies. – sgmoye Apr 24 '15 at 17:19