如何实现这样的排版:
\documentclass[aspectratio=169,10pt,notes=show]{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{align}
\left[\mathcal{E} + eV - \frac{1}{2m}\left(\mathbf{p} + \frac{e}{c}\mathbf{A}\right)^2 + \frac{1}{2m_0c^2}\left(\mathcal{E} + eV\right)^2\right. \\
\left. + i\frac{e\hbar}{(2m_0c)^2}\mathbf{E}\cdot\mathbf{p} - \frac{e\hbar}{2m_0c}\boldsymbol{\sigma}\cdot\mathbf{B} - \frac{e\hbar}{(2m_0c)^2}\boldsymbol{\sigma}\cdot\left(\mathbf{E} \times\mathbf{p}\right)\right]\psi = 0
\end{align}
\end{frame}
\end{document}
不加入&
时,可以正常编译,当我加入对齐符号&时,latex报错:
\left[\mathcal{E} + & eV - \frac{1}{2m}\left(\mathbf{p} + \frac{e}{c}\mathbf{A}\right)^2 + \frac{1}{2m_0c^2}\left(\mathcal{E} + eV\right)^2\right. \\
\left. & + i\frac{e\hbar}{(2m_0c)^2}\mathbf{E}\cdot\mathbf{p} - \frac{e\hbar}{2m_0c}\boldsymbol{\sigma}\cdot\mathbf{B} - \frac{e\hbar}{(2m_0c)^2}\boldsymbol{\sigma}\cdot\left(\mathbf{E} \times\mathbf{p}\right)\right]\psi = 0
! Extra }, or forgotten \right.
<template> }
$}\ifmeasuring@ \savefieldlength@ \fi \set@field \endtemplate
l.9 \end{frame}
将 \left
和 \right
改为 \biggl
、\biggr
\documentclass[aspectratio=169,10pt,notes=show]{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{align}
\biggl[\mathcal{E} + & eV - \frac{1}{2m}\left(\mathbf{p} + \frac{e}{c}\mathbf{A}\right)^2 + \frac{1}{2m_0c^2}\left(\mathcal{E} + eV\right)^2 \\
+ & i\frac{e\hbar}{(2m_0c)^2}\mathbf{E}\cdot\mathbf{p} - \frac{e\hbar}{2m_0c}\boldsymbol{\sigma}\cdot\mathbf{B} - \frac{e\hbar}{(2m_0c)^2}\boldsymbol{\sigma}\cdot\left(\mathbf{E} \times\mathbf{p}\right)\biggr]\psi = 0
\end{align}
\end{frame}
\end{document}
从公式的含义来说, 这个两行的公式应该共享同一个编号。
如何实现这样的排版
个人觉得更好的办法是使用amsmath
宏包提供multline
环境,从这个公式来看,我认为你这里并不需要按照某个位点对齐,而仅仅是长公式折行。
\documentclass[aspectratio=169,10pt,notes=show]{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{multline}
\left[\mathcal{E} + eV - \frac{1}{2m}\left(\mathbf{p} + \frac{e}{c}\mathbf{A}\right)^2 + \frac{1}{2m_0c^2}\left(\mathcal{E} + eV\right)^2\right. \\
\left. + i\frac{e\hbar}{(2m_0c)^2}\mathbf{E}\cdot\mathbf{p} - \frac{e\hbar}{2m_0c}\boldsymbol{\sigma}\cdot\mathbf{B} - \frac{e\hbar}{(2m_0c)^2}\boldsymbol{\sigma}\cdot\left(\mathbf{E} \times\mathbf{p}\right)\right]\psi = 0
\end{multline}
\end{frame}
\end{document}
为什么会报错?
可以见这个链接的介绍。