对齐环境中的换行和编号

对齐环境中的换行和编号

我正在尝试在 align 环境中对一组方程进行编号。\tag{...} 出于某种原因不起作用。此外,我想在文本元素中设置换行符以节省空间。有人能帮我吗?下面是我的代码,后面是它在 pdf 中的样子的图片,底部是它在 pdf 中的样子的图片应该看起来像!非常感谢!祝好,马克

\documentclass{article}


\usepackage{amssymb}
\usepackage[overload]{empheq}
\begin{document}
\begin{align*}
 \text{Full Endowment GE:} & \left \{
        \begin{aligned}
            & \text{Conditional GE}: & \left \{ 
                        \begin{aligned}
                            & \text{Partial Effect}: & \left \{ X_{ij}=Y_iY_j \left(\frac{\tau_{ij}}{{P_j}\Pi_i}\right)^{1-\sigma} \right. \\
                            & & \Pi_i\equiv\left(\sum\limits_{j=1}^{C}Y_j\left(\frac{\tau_{ij}}{P_j}\right)^{(1-\sigma)}\right)^{1/(1-\sigma)} \\
                            & & P_j=\left(\sum\limits_{i=1}^{C} Y_i\left(\frac{\tau_{ij}}{\Pi_i}\right)^{1-\sigma}\right)^{1/(1-\sigma)} \\
                         \end{aligned}  
             \right. \\               
            &  & p_i=({Y_i})^{\frac{1}{1-\sigma}}\frac{1}{\alpha_i\Pi_i} \\
            &  & E_i=\phi_iY_i=\phi_ip_iQ_i
        \end{aligned}
    \right.
\end{align*}

\end{document}

我的方程式如下:(

它应该是这样的

答案1

这是可行的方法:

在此处输入图片描述

\documentclass{article}

\usepackage[margin = 1in]{geometry}% Just for this example

\usepackage{amsmath}

\newcommand{\tallestelement}{\Biggr)^{1 / (1 - \sigma)}} % Tallest element across all rows

\begin{document}

\begin{align}
  \text{Direct (PE)} \left\{
    \vphantom{\tallestelement} % Tallest element across all rows
  \right. \hspace{1em}
  X_{ij} &= Y_i Y_j \Bigl( \frac{\tau_{ij}}{P_j \Pi_i} \Bigr)^{1 - \sigma} \\
  \smash{\begin{tabular}{@{}c@{}}
    Conditional \\ (GE)
  \end{tabular} \left\{
    \begin{aligned}
      \vphantom{\tallestelement} \\ % Tallest element across all rows
      \vphantom{\tallestelement} \\ % Tallest element across all rows
      \vphantom{\tallestelement} % Tallest element across all rows
    \end{aligned}
    \right.
  } \hspace{8em}
  \Pi_i  &\equiv \Biggl( \sum_{j = 1}^C Y_j \Bigl( \frac{\tau_{ij}}{P_j} \Bigr)^{1 - \sigma} \Biggr)^{1 / (1 - \sigma)} \\
  \smash{\begin{tabular}{@{}c@{}}
    Full \\ Endowment \\ (GE)
  \end{tabular} \left\{
    \begin{aligned}
      \vphantom{\tallestelement} \\ % Tallest element across all rows
      \vphantom{\tallestelement} \\ % Tallest element across all rows
      \vphantom{\tallestelement} \\ % Tallest element across all rows
      \vphantom{\tallestelement} \\ % Tallest element across all rows
      \vphantom{\tallestelement} % Tallest element across all rows
    \end{aligned}
    \right.
  } \hspace{14.5em}
  P_j    &= \Biggl( \sum_{i = 1}^C Y_i \Bigl( \frac{\tau_{ij}}{\Pi_i} \Bigr)^{1 - \sigma} \Biggr)^{1 / (1 - \sigma)} \\
  \vphantom{\tallestelement} % Tallest element across all rows
  p_i    &= (Y_i)^{1 / (1 - \sigma)} \frac{1}{\alpha_i \Pi_i} \\
  \vphantom{\tallestelement} % Tallest element across all rows
  E_i    &= \phi_i Y_i = \phi_i p_i Q_i
\end{align}

\end{document}

我在每一行都添加了一个\vphantom{\tallestelement},从而均匀分布内容。这让方程组看起来更加直观。

答案2

将所有这些都塞进一个align环境中似乎很麻烦。此解决方案使用 TikZ,它可能适合您,也可能不适合您:

在此处输入图片描述

这是生成此代码的代码

\documentclass{article}
\usepackage{geometry}
\usepackage{amssymb}
\usepackage[overload]{empheq}

\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\newcommand\tikzmark[1]{\tikz[remember picture,overlay]\coordinate (#1) at (0,0.75ex);}

\begin{document}
\begin{equation}
  \prod_{i=1}^{\infty}\text{\scriptsize\sffamily some other equation}
\end{equation}
Random text
\vspace{2ex}

\hspace*{\fill}%%
\begin{minipage}{3.25in}
\begin{align}
  \tikzmark{A1} X_{ij}&  =Y_iY_j \left(\frac{\tau_{ij}}{{P_j}\Pi_i}\right)^{1-\sigma}                                             \\
  \tikzmark{A2} \Pi_i & \equiv\left(\sum\limits_{j=1}^{C}Y_j\left(\frac{\tau_{ij}}{P_j}\right)^{(1-\sigma)}\right)^{1/(1-\sigma)} \\
  \tikzmark{A3} P_j   & =\left(\sum\limits_{i=1}^{C} Y_i\left(\frac{\tau_{ij}}{\Pi_i}\right)^{1-\sigma}\right)^{1/(1-\sigma)}       \\
  \tikzmark{A4} p_i   & =({Y_i})^{\frac{1}{1-\sigma}}\frac{1}{\alpha_i\Pi_i}                                                        \\
  \tikzmark{A5} E_i   & =\phi_iY_i=\phi_ip_iQ_i
\end{align}
\end{minipage}

\begin{tikzpicture}[remember picture,
                    overlay,
                    bracket tag/.style={midway,anchor=east,xshift=-3pt,align=center},
                    my label/.style={text width=1.85cm,align=center,anchor=east},]
  \coordinate (L1/T) at ($(A1)+(-6pt,0.5cm)$);
  \coordinate (L1/B) at ($(A1-|L1/T)+(0pt,-0.5cm)$);

\draw [decorate,decoration={brace,amplitude=4pt,mirror}] (L1/T) -- (L1/B) node (L1/L) [bracket tag] {:};
  \node[my label] (PE) at (L1/L) {Direct (PE)};

  \coordinate (L2/T) at ($(L1/T-|PE.west)+(0pt,3pt)$);
  \coordinate (L2/B) at ($(L2/T|-A3)+(0pt,-0.5cm)$);

\draw [decorate,decoration={brace,amplitude=4pt,mirror}] (L2/T) -- (L2/B) node (L2/L) [bracket tag] {:};
  \node[my label] (CGE) at (L2/L) {Conditional\\GE};

  \coordinate (L3/T) at ($(L2/T-|CGE.west)+(0pt,3pt)$);
  \coordinate (L3/B) at ($(L3/T|-A5)+(0pt,-0.5cm)$);

\draw [decorate,decoration={brace,amplitude=4pt,mirror}] (L3/T) -- (L3/B) node (L3/L) [bracket tag] {:};
  \node[my label] (FE) at (L3/L) {Full\\Endowment\\GE};

\end{tikzpicture}

\end{document}

答案3

你愿意使用蒂克兹 matrix of nodes而不是?如果是这样,那么你可以生产

在此处输入图片描述

使用代码:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing}
\tikzset{brace/.style={decorate, decoration={brace, mirror}}}
\usepackage{amssymb}
\newcommand\Eqnum{\refstepcounter{equation}(\theequation)}

\begin{document}

\begin{center}
  \begin{tikzpicture}
    \matrix (M)[matrix of nodes,
                column 1/.style ={every node/.style={text width=20mm}},
                column 2/.style ={every node/.style={text width=20mm}},
                column 3/.style ={every node/.style={text width=20mm}},
                column 5/.style ={every node/.style={anchor=west}},
                nodes in empty cells]
    { & & Partial effect (PE):
        & $X_{ij}$ & $\displaystyle =Y_iY_j
          \left(\frac{\tau_{ij}}{{P_j}\Pi_i}\right)^{1-\sigma}$
        & \Eqnum \\
      & Conditional GE: &
        & $\Pi_i$ & $\displaystyle \equiv\left(\sum\limits_{j=1}^{C}Y_j
           \left(\frac{\tau_{ij}}{P_j}\right)^{(1-\sigma)}
           \right)^{1/(1-\sigma)}$
        & \Eqnum\\
      Full Endowment GE: &&
        & $P_j$ & $\displaystyle =\left(\sum\limits_{i=1}^{C} Y_i
             \left(\frac{\tau_{ij}}{\Pi_i}\right)^{1-\sigma}
             \right)^{1/(1-\sigma)}$
        & \Eqnum\\
        & &  & $p_i$ &=$\displaystyle ({Y_i})^{\frac{1}{1-\sigma}}
                \frac{1}{\alpha_i\Pi_i}$ & \Eqnum\\
          & &  &  $E_i$ & $\displaystyle =\phi_iY_i=\phi_ip_iQ_i$
        & \Eqnum\\
     };
     \draw[brace](M-1-1.north east)--(M-5-1.south east);
     \draw[brace](M-1-2.north east)--(M-3-2.south east);
     \draw[brace](M-1-3.north east)--(M-1-3.south east);
  \end{tikzpicture}
\end{center}

\end{document}

相关内容