Is there a way to eliminate the "\" in frequently used LaTeX commands?

Escape category code for other character

The escape character, which starts commands is not fixed and can be changed, e.g.:

\catcode`\|=0 % escape category code as the backslash
|textit{some text here}; |textbf{some more text here};
|begin{quotation}...|end{quotation}

The tricky part is finding the right character, which does not clash with other uses of it. It depends on the keyboard layout and the characters already used in the text.

If _ is used, then the subscript feature in math mode is available via command \sb (or then _sb).

Post-processing

Another way is to post-process the input file with a regular expression, which checks for known command words, ensure that no letter is preceding or following and adds the backslash in front. For example, a simple expression for Perl:

s/\b(textbf|textit|item)\b/\\$1/g;

Thinking outside the \box: instead of looking for a TeX solution, look for a general solution. You want to type X for Y. That's what editors excel at. Well, the good ones at least.

The best one is, of course, vi (or vim or gvim), a touch-typist's dream come true. You could, for example, remap the backslash to a key that's more easily reached.

imap # \

Or, if that interferes with other documents you write, selectively use insert-mode abbreviations such as

iabbr textit \textit

It's easy to restrict such mapping to files with a .tex extension only.


(Edited answer significantly to provide further generality)

Here's a LuaLaTeX-based solution that lets you omit the \ (backslash) character from sectioning commands, \begin{<some environment>}, \end{<some environment>}, \item, and font shape-changing commands such as \textit, \bfseries, \scshape, and \ttfamily. Writing the backslash character is permitted, but not required. Note that no substitute for \ needs to be entered.

There are but a few syntax rules:

  • section and subsection directives must be placed at the start of a line.

  • item instructions must be the first items (pun intended) on a line other than (possibly) whitespace.

  • Finally, if you have created macros ill-advisedly named \bend, \fend, \lend, \send or \tend, they must not take arguments -- so that they can be distinguished from \end! Please don't create macros named, say, \xxtextrm or \zzitshape unless you want to make the Lua code below unfit for use.


% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{amsmath}

\usepackage{luacode}
\begin{luacode*}
function add_backslash ( x )
  -- sectioning commands
  x = string.gsub ( x , "^\\?(section)"          , "\\%1" )
  x = string.gsub ( x , "^\\?(subsection)"       , "\\%1" )
  x = string.gsub ( x , "\\?(subsubsection%s-{)" , "\\%1" )
  x = string.gsub ( x , "\\?(paragraph%s-{)"     , "\\%1" )
  -- \begin and \end of environments
  x = string.gsub ( x , "\\?(begin%s-{)"      , "\\%1" )
  x = string.gsub ( x , "\\?(end%s-{)"        , "\\%1" )
  -- \item 
  x = string.gsub ( x , "^%s-\\?(item)"       , "\\%1" )
  -- \text?? (rm, sf, up, bf, it, ...)
  x = string.gsub ( x , "\\?(text[^e]%l)"     , "\\%1" )
  -- \??shape (it, sc, ...)
  x = string.gsub ( x , "\\?(%l[^e]shape)"    , "\\%1" )
  -- \??series (bf, md, ...)
  x = string.gsub ( x , "\\?(%l%lseries)"     , "\\%1" )
  -- \??family (sf, tt, ...)
  x = string.gsub ( x , "\\?(%l%lfamily)"     , "\\%1" )
return x
end
luatexbase.add_to_callback("process_input_buffer", add_backslash, "add_backslash")
\end{luacode*}

begin {document} 

section{Here}    
subsection {today,}    
 subsubsection   {gone}
   paragraph {tomorrow.}

begin{enumerate}
  item A
   item B
item C
end{enumerate}

 begin{equation}  1+1=2  end{equation}

  begin{itemize}
    item X is not equal to the following item:
    item Y
    item Z
  end{itemize}  

    begin{align} 
       a &= b\\
       c &= d
    end{align}

textit{abc}, textsc{def}, textbf{ghi}, textsf {jkl}

{itshape abc}, {scshape def}, {bfseries ghi}, {sffamily jkl}

end{document}

Note the complete absence of any and all backslash characters after the \end{luacode*} directive. I must confess that this code looks positively spooky to me.

enter image description here