因此,我尝试在 LaTeX 上获得如下结果: (来源:唐纳德·柯克的《最优控制理论》)
我当前的 LaTeX 代码:
\begin{align*}
u^*\left(t\right) &= -1, &t\in\left[t_0, t_f\right], c \geq 1\\ u^*\left(t\right) &= \begin{cases}
0, &t\in\left[t_0, t_1\right)\\
-1, & t\in\left[t_1, t_f\right]
\end{cases} & 0 < c < 1\\
u^*\left(t\right) &= \begin{cases}
0, &t\in\left[t_0, t_2\right)\\
1, & t\in\left[t_2, t_f\right]
\end{cases} & -1 < c < 0\\
u^*\left(t\right) &= 1, &t\in\left[t_0, t_f\right], c \leq -1\\
u^*\left(t\right) &= 0, &t\in\left[t_0, t_f\right], c = 0
\end{align*}
调整此点的正确方法是什么?
答案1
使用 的两个加一选项alignat
。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
u^*(t) &= -1, &&t\in[t_0, t_f], c \geq 1\\
u^*(t) &= \begin{cases}
0, \\
-1,
\end{cases}&& \def\arraystretch{1.2}\begin{array}{@{}l}
t\in[t_0, t_1)\\
t\in[t_1, t_f],
\end{array}
0 < c < 1\\
u^*(t) &= \begin{cases}
0, \\
1,
\end{cases} &&\def\arraystretch{1.2}\begin{array}{@{}l}
t\in[t_0, t_2)\\
t\in[t_2, t_f]
\end{array}
-1 < c < 0\\
u^*(t) &= 1, &&t\in[t_0, t_f], c \leq -1\\
u^*(t) &= 0, &&t\in[t_0, t_f], c = 0
\end{alignat*}
\begin{alignat*}{3}
u^*(t) &= -1, &&t\in[t_0, t_f], &&c \geq 1\\
u^*(t) &= \begin{cases}
0, \\
-1,
\end{cases}&& \def\arraystretch{1.2}\begin{array}{@{}l}
t\in[t_0, t_1)\\
t\in[t_1, t_f],
\end{array}
&&0 < c < 1\\
u^*(t) &= \begin{cases}
0, \\
1,
\end{cases} &&\def\arraystretch{1.2}\begin{array}{@{}l}
t\in[t_0, t_2)\\
t\in[t_2, t_f]
\end{array}
&&-1 < c < 0\\
u^*(t) &= 1, &&t\in[t_0, t_f], &&c \leq -1\\
u^*(t) &= 0, &&t\in[t_0, t_f], &&c = 0
\end{alignat*}
\end{document}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
u^*\left(t\right) &= -1, &t\in\left[t_0, t_f\right], c \geq 1\\
u^*\left(t\right) &= \begin{cases}
0, &t\in\left[t_0, t_1\right)\\
-1, & t\in\left[t_1, t_f\right]
\end{cases}\qquad\qquad & 0 < c < 1\\
u^*\left(t\right) &= \begin{cases}
0, &t\in\left[t_0, t_2\right)\\
1, & t\in\left[t_2, t_f\right]
\end{cases} & -1 < c < 0\\
u^*\left(t\right) &= 1, &t\in\left[t_0, t_f\right], c \leq -1\\
u^*\left(t\right) &= 0, &t\in\left[t_0, t_f\right], c = 0
\end{alignat*}
\end{document}
答案2
编写方程式的另一种方法:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
u^*(t) =
\begin{cases}
\begin{rcases}
-1 & t\in[t_0, t_f]
\end{rcases} & c \geq 1 \\[1ex]
\kern-\nulldelimiterspace
\begin{rcases}
\hphantom{-} 0 & t\in[t_0, t_1)\\
-1 & t\in[t_1, t_f]
\end{rcases} & 0 < c < 1 \\[3ex]
\kern-\nulldelimiterspace
\begin{rcases}
\hphantom{-} 0 & t\in[t_0, t_2)\\
-1 & t\in[t_2, t_f]
\end{rcases} & -1 < c < 0 \\[1ex]
\begin{rcases}
\hphantom{-} 1 & t\in[t_0, t_f]
\end{rcases} & c \leq -1 \\
\begin{rcases}
\hphantom{-} 0 & t\in[t_0, t_f]
\end{rcases} & c = 0 \\
\end{cases}
\]
\end{document}
答案3
非常特别指定,但它确实有用。但我觉得这个演示不太有吸引力。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\newcommand{\ph}{\hphantom{\bigg\lbrace}}%
\newcommand{\cond}[3]{\makebox[3em][l]{$#1$}{#2}\makebox[6em][l]{$#3$}}%
\newcommand{\sys}[1]{%
\biggl\lbrace
\begin{array}{@{}l@{}}#1\end{array}%
}%
\newcommand{\0}{\phantom{-}0}%
\begin{aligned}
u^*(t)&=\cond{-1,}{\ph}{t\in [0,t_f],}\text{for $1\le c_1$} \\
u^*(t)&=\sys{\cond{\0,}{}{t\in[0,t_1)} \\[0.75ex] \cond{-1,}{}{t\in[t_1,t_f],}}\text{for $0<c_1<1$}\\
u^*(t)&=\sys{\cond{\0,}{}{t\in[0,t_1')} \\[0.75ex] \cond{-1,}{}{t\in[t_1',t_f],}}\text{for $-1<c_1<0$}\\
u^*(t)&=\cond{+1,}{\ph}{t\in[0,t_f],}\text{for $c_1\le -1$}\\
u^*(t)&=\cond{\0,}{\ph}{t\in[0,t_f],}\text{for $c_1=0$}
\end{aligned}
\end{equation}
\end{document}