0

Minimal working example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\title{}
\def\bel#1\eel{\begin{align}\begin{split}#1\end{split}\end{align}}

\begin{document} \maketitle \bel a^v=2 \eel \end{document}

Then the error says: ^ must be inside math mode. Does anyone know how to fix this?

I also tried

\def\bel{\begin{equation}\begin{aligned}}
\def\eeq{\end{aligned}\end{equation}}

But it doesn't fix it. Thanks!

  • 1
    Welcome! Don't do that. You will end with a document basically unreadable for anybody (apart from you), and any good editor will be able to generate the environment with a simple key sequence. – Rmano Jul 02 '22 at 16:00
  • 1
    Anyway, if you insist, the best approach is to use the package environ or the \NewDocumentEnvironment command (see xparse) – Rmano Jul 02 '22 at 16:03
  • Next time write a minimal working example. See link for more details what it means. – user202729 Jul 02 '22 at 16:11
  • Okay, I wrote a minimal example containing your code snippet and it doesn't error. (the second one does error as expected.) So write a minimal working example. – user202729 Jul 02 '22 at 16:12
  • Ummm, your MWE works fine for me. – Mico Jul 02 '22 at 16:22
  • Added a minimal working example. Seems that it works fine for some of you. I guess it's an issue with the overleaf editor? – Xiao Xiao Jul 02 '22 at 16:24
  • Yes, this was mentioned in the chat yesterday that it got broken on Overleaf. It was also said that a fix is on the way. "one of our parsers got into an infinite loop over any {\begin{foo}} or {\end{foo}}, causing the editor to eat itself out of memory." – mickep Jul 02 '22 at 16:29
  • Thanks a lot for the suggestions – Xiao Xiao Jul 02 '22 at 18:07

0 Answers0