# Are there existing LaTeX commands \1,\2,\3, or \4?

I want to make new commands with the names \1 \2 \3 \4. But I do not want to use these names if they will conflict with standard existing names. I do not know of any existing LaTeX commands with these names but I want to check.

• This is exactly what \newcommand is for: it will allow the definition as they do not exist. – Joseph Wright May 29 '17 at 20:01
• @JosephWright But I will use these in many files which do not yet exist, and i do not want to create an unintended conflict later on. – Colin McLarty May 29 '17 at 20:03
• I know of two packages that define \0, \1, \2: qtree and tikz-qtree-compat. – Alan Munn May 29 '17 at 20:05
• – Werner May 29 '17 at 20:10
• David's answer now includes mine. :) – Alan Munn May 29 '17 at 20:30

## 1 Answer

a rough estimate can be found just by looking for $0-9] in the latex/*/*.sty files in your local installation. eg  grep '[^\$\$0-9]' /usr/local/texlive/2017/texmf-dist/tex/latex/*/*.sty | grep -v Digits  Just keeping one line per package and removing comments and uses with \string returns the following list, some of which will be internal uses, but each would need to be checked. /arabtex/hebchrs.sty:\ifx #1\relax \relax \else \uppercase {\gdef \1{#1}}% /bengali/beng.sty:\def\3#1z{{\char"#1}} /bibarts/bibarts.sty: \def\3{\string\3}% /biblatex/biblatex.sty: \do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9% /cbcoptic/coptic.sty:\let\0\^^b0 % alias name for keyboards missing the "degree" key /cmdtrack/cmdtrack.sty:\ifcat ?\relax{\catcode37=7 \catcode127=9 \def\0{\@sanitize\catcode}\fi /cryptocode/cryptocode.sty: { \1\u{l_pc_strsub_replace_tl} } /csquotes/csquotes.sty: \do\!\do\?\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9} /cuisine/cuisine.sty: \let\0\d@grees /dialogl/grabhedr.sty: \edef\0{\meaning\input}\edef\1{\string\input}% /dialogl/menus.sty: \begingroup \def\0{?}\def\1{Q}% /dvdcoll/pdfnotiz.sty: \edef\0{\string\0}% /etextools/etextools.sty: \long\edef\1##1/##2/##3{##1\endgroup\unexpanded{#2}##3}% /fonttable/fonttable.sty: \f@tm=\f@tn \divide\f@tm by 64 \xdef\0{\the\f@tm}% /gmdoc/gmdoc.sty: \DoNotIndex{\1 \2 \3 \4 \5 \6 \7 \8 \9 \0}% /hyperref/hyperref.sty: \edef\1{\string\1}% /longfigure/longfigure.sty: \begingroup\def\2{#2} /media9/media9.sty: \regex_replace_once:nnN{([^:]+):??.*}{\1}\l_tmpa_tl /mftinc/mftinc.sty:\long\def\mfcomment#1\9#2\par{\unskip#2 } /mhchem/mhchem.sty: { \c{\\}(\[.*?$)? } { \0 }
/nicetext/niceverb.sty:      \def\cs{\134}%                    %% 2010/03/17, 2011/06/27
/outlines/outlines.sty:%   \1 <level 1 text>
/pdfx/pdfx.sty: \edef\0{\string\0}
/pkgloader/pkgloader.sty:       \c{g__pkgloader_pkg_graph}\cB\{\0\.sty\cE\}) }
/prftree/prftree.sty:  \global\prf@samefalse\begingroup\def\1{#1}\def\2{#2}%
/proba/proba.sty:\DeclareRobustCommand{\1}[1]{\ensuremath \mathbf{1}_{\{#1\}}}
/protex/AlProTex.sty:   \def\1{#1}%
/qsymbols/qsymbols.sty:  \expandafter\let\expandafter\1\csname qsym@@#1\endcsname
/qtree/qtree.sty:  \def\0{\ifmmode ^0\else \rlap{$^0$}\fi}%
/regexpatch/regexpatch.sty:      \regex_replace_once:nnN { .*? \{ (.*) \} \Z } { \1 }
/snapshot/snapshot.sty:      \edef\0{\csname rqv@#1\endcsname}%
/songs/songs.sty:  \let\2\1\let\3\1\let\4\1\let\5\1%
/teubner/teubner.sty:\def\2#1 {\csname2#1\endcsname}
/tikz-qtree/tikz-qtree-compat.sty:  \def\0{\ifmmode ^0\else \rlap{$^0$}\fi}%
/toptesi/topfront.sty:        \ifx\2\empty
/toptesi/topfront.sty:            \noexpand\oldstylenums{\1} -- \noexpand\oldstylenums{\2}}
/uaclasses/my-title.sty:    {\def \1{#1}%
/uaclasses/ua-title.sty:    {\edef \3{#1}%
/ucs/ucshyper.sty:      \edef\1{\string\1}%
/units/units.sty:    \def\0{#1}%
/velthuis/dev209.sty:\def\0{\llap{\char13}}
/velthuis/devanagari.sty:\DeclareRobustCommand*\0{\llap{\char13}}%

• A few of these are regex replacements ... – Joseph Wright May 29 '17 at 20:32
• @JosephWright if I knew a regular expression to filter out regular expression replacements I'd add it to that grep call:-) adding |grep -v regex` to the end of the pipeline might be near enough:-) – David Carlisle May 29 '17 at 22:09
• @DavidCarlisle but then it's regexes all the way down :) – user49449 May 30 '17 at 1:09