如何实现这样的公式对齐

发布于 2025-03-04 16:48:51

如何实现这样的排版:
image.png

\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报错:
image.png

\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}

查看更多

关注者
0
被浏览
107
Swit
Swit 2天前
LaTeX nubility!

\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}
2 个回答
Sagittarius Rover
我要成为Typst糕手/(ㄒoㄒ)/~~

从公式的含义来说, 这个两行的公式应该共享同一个编号。

如何实现这样的排版

个人觉得更好的办法是使用amsmath宏包提供multline环境,从这个公式来看,我认为你这里并不需要按照某个位点对齐,而仅仅是长公式折行。

image.png

\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}

image.png

为什么会报错?

可以见这个链接的介绍。

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览