我有这个代码
\documentclass{article}
\usepackage{mathtools}
\usepackage{xcolor}
\newcommand{\Tonde}[1]{\left(#1\right)}
\newcommand{\tonde}[1]{\bigl(#1\bigr)}
\begin{document}
\begin{flalign}
\textcolor{red}{\boxed{V\tonde{r,\theta}=\frac{3}{\varepsilon+2}Er\cos\theta}}\\
\textcolor{red}{\boxed{W\tonde{r,\theta}=Er\cos\theta\Tonde{1+\frac{1-\varepsilon}{2+\varepsilon}\frac{R^3}{r^3}}}}
\end{flalign}
\begin{align}
V\tonde{r,\theta}&=\frac{3}{\varepsilon+2}Er\cos\theta\\
W\tonde{r,\theta}&=Er\cos\theta\Tonde{1+\frac{1-\varepsilon}{2+\varepsilon}\frac{R^3}{r^3}}
\end{align}
\end{document}
并且我想将红色方程式在 = 符号处左对齐,就像下面的黑色方程式一样。
可以吗?非常感谢
答案1
如果棘手的版本也可以的话......
\documentclass{article}
\usepackage{mathtools}
\usepackage{xcolor}
\newcommand{\Tonde}[1]{\left(#1\right)}
\newcommand{\tonde}[1]{\bigl(#1\bigr)}
\begin{document}
\newlength\Wl
\settowidth\Wl{$W$}
%\begin{flalign}
\begin{align}
&\textcolor{red}{\boxed{\makebox[\Wl][r]{$V$}\tonde{r,\theta}=\frac{3}{\varepsilon+2}Er\cos\theta}}\\
&\textcolor{red}{\boxed{W\tonde{r,\theta}=Er\cos\theta\Tonde{1+\frac{1-\varepsilon}{2+\varepsilon}\frac{R^3}{r^3}}}}
%\end{flalign}
\end{align}
\begin{align}
V\tonde{r,\theta}&=\frac{3}{\varepsilon+2}Er\cos\theta\\
W\tonde{r,\theta}&=Er\cos\theta\Tonde{1+\frac{1-\varepsilon}{2+\varepsilon}\frac{R^3}{r^3}}
\end{align}
\end{document}