1

I am trying to define some new commands starting with the word end and I found that it is impossible in TeX. For example, the following code does not work. My question is: Is it possible to define new commands starting with \end... in (La)TeX?

 \documentclass{article}

\usepackage{amsthm,amssymb}

\newcommand{\endofproof}{\rule{0.7em}{0.7em}}

\begin{document}
\begin{proof}
  Clear. \hfill  \endofproof
\end{proof}
\end{document}
4
  • Just to inform that there is the command qedhere
    – Sigur
    Commented Oct 10, 2015 at 17:52
  • There's no need to add an \endofproof command: if you prefer a black tombstone, redefine \qedsymbol.
    – egreg
    Commented Oct 10, 2015 at 17:54
  • See tex.stackexchange.com/a/62266/4427 for reference about the problem in the title
    – egreg
    Commented Oct 10, 2015 at 17:59
  • My question is general. I know that on could redefine qed. But there are some situations that I need to define a command starting with end. For example there are some musicalterms in my language that are starting with end so when I am trying to define some musical symbols like repetions: endhere, startfromhere I need commands starting with the words end or start .
    – kornaros
    Commented Oct 10, 2015 at 18:04

1 Answer 1

1

Yes, it is possible by \def.

\documentclass{article}

\usepackage{amsthm,amssymb}

\def\endofproof{\rule{0.7em}{0.7em}}

\begin{document}
\begin{proof}
  Clear. \hfill  \endofproof
\end{proof}
\end{document}

The result IS strange. You probably simply want to redefine \qedsymbol.

3
  • Scherwentk Oh! I forget \def command. So \newcommand has many restrictions indeed! Thanks for the answer!
    – kornaros
    Commented Oct 10, 2015 at 18:14
  • 1
    @kornaros Well, it only tells you if you're doing something you shouldn't be doing ... \def happily overwrites any existing macro without checking anything (I think). Commented Oct 10, 2015 at 18:36
  • @kornaros it is not that \newcommand has restrictions, it is what defines the latex language. If you use \def to undercut the language in this way things will break in surprising ways. Commented Oct 10, 2015 at 20:54

Not the answer you're looking for? Browse other questions tagged .