# A (La)TeX with only one special control character in the source file

One thing I find annoying about (La)TeX is that there are too many special characters. To have any of \ $% & # _ ~ ^ { } in a text in the document we have to escape it using \. Personally I think this is stupid - after all we are writing a text document and not doing programming. I think it would be great if there was a mode where we only have one escape character (and \ would suite me just fine) and all commands and control sequences would have to be preceded by \. Comments would be (e.g.) \% math could be introduced with \$ etc.

Are there any packages/hacks/modifications that allow this?

-

I can't answer your question about any packages that do that. Some of those parameters could be changed. For example, if you alway use $$...$$ instead of $...$, then you could make $ just be a normal punctuation symbol (or you could use \$). Likewise, \&, \_ and \^ could easily be swapped with their nonslashed counterparts. There's no need for ~ to be active, you could easily define \~ to have the same effect. As Will notes in the comments, # can be made a symbol.

I wasn't able to get comments working. I can't figure out how to get a macro to expand to an end of line token. Actually, I'm not even sure that's one of the tokens that gets to TeX's "stomach."

The real problem would come with braces. You really do need two additional characters to act as groupings. You could make two characters you don't frequently use be those.

So barring braces being special and not having line comments (although it'd be easy to define a block comment like \def\%#1\relax{} which might be sufficient for your purposes), this seems to work.

\newenvironment{plaintext}{%
\catcode\$12 \def\&{&}% \catcode\&12 \def\_{_}% \catcode\_12 \def\^{^}% \catcode\^12 \catcode\#12 \catcode\%12 \let\~~% \catcode\~12 }{}  Use it like \begin{plaintext} Here is some test text % ^ & _$ # &.

How about some math $$x\_y\^z$$. You're still out of luck with braces
though.
\end{plaintext}

-
You could use \begingroup...\endgroup. Shows why you shouldn't, really. –  Charles Stewart Sep 10 '10 at 11:07
Don't forget #, which can be turned into a letter as soon as your macro definitions are all done with. (Well, this might perhaps break some obscure code that uses \scantokens, but you're probably safe.) –  Will Robertson Sep 10 '10 at 11:08
@Charles: I don't think \begingroup will work in this way. –  Will Robertson Sep 10 '10 at 11:10
@Charles: Do you mean \bgroup...\egroup? This didn't work for me. I can never remember the rules for when you can use implicit braces, but I don't believe this is one of those times. –  TH. Sep 10 '10 at 11:17
"you could make $just be a normal punctuation symbol" ... how would I do this? Link appreciated :-) – Martin Sep 10 '10 at 11:20 show 8 more comments In ConTeXt, we are discussion adding a macro \asciimode which will set catcodes such that only \, {, } and spaces (tab, newlines, and pagefeed) have their usual meaning. Everything else (including % and $) are set to other.

You can enter into math mode using \math{...}, display math mode using \startformula, comments using \starthidden, etc. Inside the math mode, _ and ^ have their usual meaning. There will be a dedicated 'programming' environment that will restore the traditional TeX catcodes.

A preliminary version is at the end of http://source.contextgarden.net/tex/context/base/catc-ctx.tex (although commented out at present)

-
It looks to me like ~ is left active. –  Charles Stewart Sep 10 '10 at 20:22
\Usuperscript           ^
\Ustartmath             $\Ustopmath$
\Ustartdisplaymath      $$\Ustopdisplaymath$$
`