0

The following Latex code doesn't compile. It seems that the align environment does not like the index \split. What is the reason for this behavior and how can I make align use such indices?

\documentclass{article}
\usepackage{amsmath}

\def \split{\mathrm{split}}

\begin{document}

\begin{align*}
\int_{A_\split}
\end{align*}

\end{document}
  • 1
    Closing brace is missing in \split definition – Ignasi May 16 '17 at 8:16
  • Yes, but the problem persists. – Zero May 16 '17 at 8:18
  • I think \split is forbidden, try with \int_{A_\text{split}} – Ignasi May 16 '17 at 8:20
  • if you had used the latex syntax \newcommand you would have have had an error at the definition. If you use \def you avoid that check but you redefine amsmath internals with no checks, so after that anything that happens is up to you. – David Carlisle May 16 '17 at 8:26
  • @Ignasi: Yes sure, but that's inconvenient, and I want to know what exactly is forbidden and why. – Zero May 16 '17 at 8:26
7

\split is the internal definition of the split environment, and in order to give split its special properties when nested inside align and similar constructs, the definition of \split is adjusted in those environments. So inside align the original definition is used, not your definition.

\def is not intended to be used in LaTeX documents for exactly this reason. Had you used

\newcommand\split{\mathrm{split}}

then the error would have been detected earlier, that you were redefining amsmath internals.

2

There exist already a command \split, if you change it to e.g. \spl it will work:

\documentclass{article}
\usepackage{amsmath}

\def \spl{\mathrm{split}}

\begin{document}

\begin{align*}
\int_{A_{\spl}}
\end{align*}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.