# Active characters in linguistics

What are the pros and cons of using active characters instead of macros in text? Would it make sense to implement a “simplified markup” parser in Latex to make code more readable?

# Rationale

Latex-style inline markup can get distracting quickly. Most people, like me, probably only use a limited set of commands. (We’ll ignore environments for now.) One can define shorter mnemonic macros like \bold to alias \textbf, but that hardly saves any keystrokes – not for \, { and } in particular, which are difficult to access in some keyboard layouts.

At the same time, many (ASCII) punctuation marks are not used much or only in specific spatial scenarios, i.e. some are surrounded by whitespace characters, others have a space on one side and a letter on the other, yet others only follow or precede digits (maybe separated by a space) or are only useful in math mode altogether. French differs as usual.

Many people, like me, are used to markdown (as used e.g. on SX), reStructuredText (rST), textile, ASCIIdoc, Emacs org-mode, Haddock or some variant of wiki markup (e.g. MediaWiki or MoinMoin syntax). They all reuse punctuation characters to mark-up plain text without adding too much visible noise.

\newcommand\lexeme[2][]{\textit{#2}\ifthenelse{\isempty{#1}}{}{ ‘#1’}}

\let\svleftbracket[
\def\newleftbracket#1]{\phone{#1}}
\catcode[\active
\def\newphoneON{\catcode[\active\def[{\newleftbracket}}
\def\newphoneOFF{\catcode[=12\let[\svleftbracket}
\catcode[=12

\let\svslash/
\catcode/\active
\def\newleftslash#1/{\phoneme{#1}}
\def\newphonemeON{\catcode/\active\def/{\newleftslash}}
\def\newphonemeOFF{\catcode/=12\let/\svslash}
\catcode/=12

\begin{document}
Testing a normal bracket and slash [[[xyz] /abc/\par
\newphoneON \newphonemeON
Testing the newphoneON [xyz] here and newphonemeON here /abc/ and /def/.\par
\newphoneOFF \newphonemeOFF back to normal bracket [[[xyz]]]]] and slash /abc/.
\end{document}

-
Can this be automated by a new command as in \newactive{/}{/}{phoneme}{leftslash} and \newactive{[}{]}{phone}{leftbracket}? –  Crissov Apr 2 '14 at 14:36
@Crissov Please see revision. A step closer. –  Steven B. Segletes Apr 2 '14 at 15:50