我正在寻找在子方程环境中对齐方程组的最佳方法,左侧带有括号,并带有引言。这是我目前所拥有的:
\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{empheq}
\begin{document}
\begin{subequations}\label{pb:init}
\begin{empheq}[left=\empheqlbrace]{gather}
\textnormal{find $u_1 : \Omega_1 \to \mathbb{R}$ and $u_2 : \Omega_2 \to \mathbb{R}$ such that}, \nonumber\\
\begin{gathered}\label{eq:initOmega1}
\begin{array}{rclll}
-\mu_1 \Delta u_1 & = & f_1 & \text{ in } & \Omega_1, \\
u_1 & = & 0 & \text{ on } & \Gamma_1,
\end{array}
\end{gathered} \\
\begin{gathered}\label{eq:initOmega2}
\begin{array}{rclll}
-\mu_2 \Delta u_2 & = & f_2 & \text{ in } & \Omega_2, \\
u_2 & = & 0 & \text{ on } & \Gamma_2,
\end{array}
\end{gathered}\\
\begin{gathered}\label{eq:initCouplage}
\begin{array}{rclll}
u_1 & = & u_2 & \text{ on } & \Gamma, \\
\mu_1\nabla u_1 \cdot n_1 & = & - \mu_2 \nabla u_2 \cdot n_2 & \text{ on } & \Gamma,
\end{array}
\end{gathered}
\end{empheq}
\end{subequations}
\end{document}
问题在于“=”符号没有彼此对齐,并且引导句位于中央而不是左侧。
你知道怎样做吗?
答案1
我不明白为什么介绍性文字应该在括号的范围内。
\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{empheq}
\usepackage{eqparbox}
\newcommand{\matheqbox}[2]{\eqmakebox[#1][l]{$\displaystyle#2$}}
\begin{document}
\begin{subequations}\label{pb:init}
Find $u_1\colon \Omega_1 \to \mathbb{R}$ and
$u_2\colon \Omega_2 \to \mathbb{R}$ such that
\begin{empheq}[left=\empheqlbrace]{align}
\label{eq:initOmega1}
\begin{split}
-\mu_1 \Delta u_1 &= \matheqbox{A}{f_1} \text{ in $\Omega_1$}, \\
u_1 &= \matheqbox{A}{0} \text{ on $\Gamma_1$},
\end{split}
\\[1ex]
\label{eq:initOmega2}
\begin{split}
-\mu_2 \Delta u_2 & = \matheqbox{A}{f_2} \text{ in $\Omega_2$}, \\
u_2 & = \matheqbox{A}{0} \text{ on $\Gamma_2$},
\end{split}
\\[1ex]
\label{eq:initCouplage}
\begin{split}
u_1 & = \matheqbox{A}{u_2} \text{ on $\Gamma$}, \\
\mu_1\nabla u_1 \cdot n_1 & = \matheqbox{A}{-\mu_2 \nabla u_2 \cdot n_2}
\text{ on $\Gamma$},
\end{split}
\end{empheq}
\end{subequations}
\end{document}
第一个参数应该\matheqbox
是任意标签(ASCII 字符),对于该技巧的每个应用来说都是不同的。
等号处没有对齐:
\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{empheq}
\usepackage{eqparbox}
\newcommand{\matheqbox}[2]{\eqmakebox[#1][l]{$\displaystyle#2$}}
\begin{document}
\begin{subequations}\label{pb:init}
Find $u_1\colon \Omega_1 \to \mathbb{R}$ and
$u_2\colon \Omega_2 \to \mathbb{R}$ such that
\begin{empheq}[left=\empheqlbrace]{align}
\label{eq:initOmega1}
\begin{split}
&\matheqbox{A}{-\mu_1 \Delta u_1 = f_1} \text{ in $\Omega_1$}, \\
&\matheqbox{A}{u_1 = 0} \text{ on $\Gamma_1$},
\end{split}
\\[1ex]
\label{eq:initOmega2}
\begin{split}
&\matheqbox{A}{-\mu_2 \Delta u_2 = f_2} \text{ in $\Omega_2$}, \\
&\matheqbox{A}{u_2 = 0} \text{ on $\Gamma_2$},
\end{split}
\\[1ex]
\label{eq:initCouplage}
\begin{split}
&\matheqbox{A}{u_1 = u_2} \text{ on $\Gamma$}, \\
&\matheqbox{A}{\mu_1\nabla u_1 \cdot n_1 = -\mu_2 \nabla u_2 \cdot n_2}
\text{ on $\Gamma$},
\end{split}
\end{empheq}
\end{subequations}
\end{document}
答案2
这是一个解决方案,它使用 (a) 三个独立的aligned
环境和 (b) 左侧和右侧的“数学框”来存储和显示前四个=
符号左侧和右侧的材料。另请注意,我已将介绍性句子从显示的方程式组中移除,并且我主张在当前用例中使用\colon
它而不是。:
\documentclass{article}
\usepackage{amssymb,amsmath,empheq}
%% code for right-hand-side and left-hand-side boxes
\newlength\mylenr
\newcommand\longblurbr{-\mu_2\nabla u_2\cdot n_2 \text{ on $\Gamma$.}}
\settowidth\mylenr{$\displaystyle\longblurbr$}
\newcommand\rbox[1]{\parbox{\mylenr}{$#1$}}
\newlength\mylenl
\newcommand\longblurbl{\mu_1\nabla u_1 \cdot n_1 }
\settowidth\mylenl{$\displaystyle\longblurbl$}
\newcommand\lbox[1]{\parbox{\mylenl}{\hfill$#1$}}
\begin{document}
Find $u_1 \colon \Omega_1 \to \mathbb{R}$ and $u_2 \colon \Omega_2 \to \mathbb{R}$ such that
\begin{subequations}\label{pb:init}
\begin{empheq}[left=\empheqlbrace]{gather}
\begin{aligned}\label{eq:initOmega1}
\lbox{-\mu_1 \Delta u_1} &= \rbox{f_1\text{ in $\Omega_1$,}} \\
\lbox{u_1} &= \rbox{0 \text{ on $\Gamma_1$,}}
\end{aligned}\\[1ex]
\begin{aligned} \label{eq:initOmega2}
\lbox{-\mu_2 \Delta u_2} &= \rbox{f_2\text{ in $\Omega_2$,}} \\
\lbox{u_2} &= \rbox{0 \text{ on $\Gamma_2$,}}
\end{aligned}\\[1ex]
\begin{aligned}\label{eq:initCouplage}
u_1 &= u_2 \text{ on $\Gamma$,} \\
\longblurbl &= \longblurbr
\end{aligned}
\end{empheq}
\end{subequations}
\end{document}