请问为什么会出现错误?当我删除 '+ \ +' 时,编译正常。
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\begin{document}
\begin{equation}\label{subrad}
\begin{gathered}
J = 16 e'^2 \left( \frac{Z}{a} \right)^6 \frac{1}{r_1} e^{-\frac{2Zr_1}{a}} \textcolor{blue}{\left[-\frac{ar_1^2e^{-\frac{2Zr_1}{a}}}{2Z} - \frac{a^2}{2Z^2}r_1e^{-\frac{2Zr_1}{a}}-\frac{a^3}{4Z^3} \left(e^{-\frac{2Zr_1}{a}}-1 \right) \right]} \\ \textcolor{red}{\left[\frac{ar_1}{2Z}e^{-\frac{2Zr_1}{a}}+\frac{a^2}{4Z^2}e^{-\frac{2Zr_1}{a}}\right]} = 16e'^2 \left( \frac{Z}{a} \right)^6 e^{-\frac{4Zr_1}{a}} \left[-\frac{ar_1}{2Z} - \frac{a^2}{2Z^2} - \frac{a^3}{4Z^3r_1} + \\ + \frac{a^3}{4Z^3r_1}e^{\frac{2Zr_1}{a}}+ \frac{ar_1}{2Z}+\frac{a^2}{4Z^2} \right]
\end{gathered}
\end{equation}
\end{document}
答案1
\left
正如 Andrew Swan 已经指出的那样,您不能在一对-之间拆分等式\right
。但是,如果您用 来关闭打开的括号或方括号\left.
,并用 来打开关闭的括号或方括号,则可以做到这一点\right.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\begin{document}
\begin{equation}\label{subrad}
\begin{gathered}
J = 16 e'^2 \left( \frac{Z}{a} \right)^6 \frac{1}{r_1} e^{-\frac{2Zr_1}{a}}
\textcolor{blue}{\left[-\frac{ar_1^2e^{-\frac{2Zr_1}{a}}}{2Z} -
\frac{a^2}{2Z^2}r_1e^{-\frac{2Zr_1}{a}}-\frac{a^3}{4Z^3}
\left(e^{-\frac{2Zr_1}{a}}-1 \right) \right]} \\
\textcolor{red}{\left[\frac{ar_1}{2Z}e^{-\frac{2Zr_1}{a}}+
\frac{a^2}{4Z^2}e^{-\frac{2Zr_1}{a}}\right]}
= 16e'^2 \left( \frac{Z}{a} \right)^6 e^{-\frac{4Zr_1}{a}}
\left[-\frac{ar_1}{2Z} - \frac{a^2}{2Z^2} - \frac{a^3}{4Z^3r_1}
\right. %<------ Closes previous \left[
+ \\
\left. %<------- Opens following \right]
+ \frac{a^3}{4Z^3r_1}e^{\frac{2Zr_1}{a}}+ \frac{ar_1}{2Z}+\frac{a^2}{4Z^2} \right]
\end{gathered}
\end{equation}
\end{document}