如何在多行闭括号内居中数学表达式?
How to center mathematical expression inside multi-line closed brackets?
如何将括号内的两条线居中。到目前为止的代码是:
\documentclass[a4paper,12pt,oneside]{report}
\usepackage{amsmath}
\begin{equation}
x_{t}^{\ast }(n)=
\left\{\!\begin{aligned}
& \hfil {x_{t}}\
\hfil & {0,\text{ otherwise}}
\end{aligned}\right\}
\end{equation}
这里有几个选项:
\documentclass{article}
\usepackage{amsmath,eqparbox,xparse}
% https://tex.stackexchange.com/a/34412/5764
\makeatletter
\NewDocumentCommand{\eqmathbox}{o O{c} m}{%
\IfValueTF{#1}
{\def\eqmathbox@##1##2{\eqmakebox[#1][#2]{$##1##2$}}}
{\def\eqmathbox@##1##2{\eqmakebox{$##1##2$}}}
\mathpalette\eqmathbox@{#3}
}
\makeatother
\begin{document}
\[
\renewcommand{\arraystretch}{1.2}
x_t^* (n) =
\left\{\begin{array}{@{} c @{}}
x_t \
0, \text{ otherwise}
\end{array}\right\}
\]
\[
x_t^* (n) =
\left\{\begin{aligned}
\eqmathbox[cond]{x_t} \
\eqmathbox[cond]{0, \text{ otherwise}}
\end{aligned}\right\}
\]
\end{document}
第一个使用带有单个 c
输入列的 array
。第二个使用 aligned
并使用相同的 <tag>
设置 \eqmathbox[<tag>]
中的每个条目。 eqparbox
然后找到具有相同 <tag>
的那些元素的最大宽度,并将每个元素设置在该宽度的框内(默认 <align>
ment 是 c
entred \eqmathbox[<tag>][<align>]{<stuff>}
).
如何将括号内的两条线居中。到目前为止的代码是:
\documentclass[a4paper,12pt,oneside]{report}
\usepackage{amsmath}
\begin{equation}
x_{t}^{\ast }(n)=
\left\{\!\begin{aligned}
& \hfil {x_{t}}\
\hfil & {0,\text{ otherwise}}
\end{aligned}\right\}
\end{equation}
这里有几个选项:
\documentclass{article}
\usepackage{amsmath,eqparbox,xparse}
% https://tex.stackexchange.com/a/34412/5764
\makeatletter
\NewDocumentCommand{\eqmathbox}{o O{c} m}{%
\IfValueTF{#1}
{\def\eqmathbox@##1##2{\eqmakebox[#1][#2]{$##1##2$}}}
{\def\eqmathbox@##1##2{\eqmakebox{$##1##2$}}}
\mathpalette\eqmathbox@{#3}
}
\makeatother
\begin{document}
\[
\renewcommand{\arraystretch}{1.2}
x_t^* (n) =
\left\{\begin{array}{@{} c @{}}
x_t \
0, \text{ otherwise}
\end{array}\right\}
\]
\[
x_t^* (n) =
\left\{\begin{aligned}
\eqmathbox[cond]{x_t} \
\eqmathbox[cond]{0, \text{ otherwise}}
\end{aligned}\right\}
\]
\end{document}
第一个使用带有单个 c
输入列的 array
。第二个使用 aligned
并使用相同的 <tag>
设置 \eqmathbox[<tag>]
中的每个条目。 eqparbox
然后找到具有相同 <tag>
的那些元素的最大宽度,并将每个元素设置在该宽度的框内(默认 <align>
ment 是 c
entred \eqmathbox[<tag>][<align>]{<stuff>}
).