我一直在尝试拟合一个带有花括号的很长的方程式。到目前为止,它还不适合这个页面:
下面是代码:
\begin{equation}
\begin{aligned}
V_{j}\left ( s,q,z \right ) \equiv \max_{c_{j}^{d}, c_{j}^{m},y_{j}^{d},y_{j}^{m}} \left \{ \omega_{j} u(y_{j}) - v(y_{j}) + \beta \expect*{W\left ( \frac{1}{\psi_{2}(\eta)}\left ( \psi_{2}(\eta)s - c_{j} + y_{j} \right ),\frac{\phi_{1}^{+}}{\phi_{2}(\eta)}\left ( q + \tau_{j}^{c} - c_{j}^{m} + y_{j}^{m} \right ) ,z^{+} \right )|\eta} \right \}.
\end{aligned} \label{eqn:43}\\
\end{equation}\\
关于如何以一种新的方式将方程式放入页面中,您有什么建议吗?
我正在使用期望命令:
\newcommand{\expect}{\operatorname{E}\expectarg}
\DeclarePairedDelimiterX{\expectarg}[1]{[}{]}{%
\ifnum\currentgrouptype=16 \else\begingroup\fi
\activatebar#1
\ifnum\currentgrouptype=16 \else\endgroup\fi
}
同时使用相关包:
\documentclass[a4paper,12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{mathtools}
\usepackage[scaled=.90]{helvet} % /usepackage{times} is obsolete. These options provide a better implementation of exact same fonts.
\usepackage{mathptmx,courier}
\usepackage[english]{babel}
%\usepackage{amsmath}
\usepackage{graphicx,amsmath,stackengine,scalerel}
\newcommand\qunderline[1]{\ThisStyle{%
\ensurestackMath{\stackengine{-1pt}{\SavedStyle#1}
{\SavedStyle\underline{\hphantom{#1}}}{U}{c}{F}{F}{S}}}%
}
\usepackage{xfrac}
\usepackage{nicefrac}
\usepackage{accents}
\newcommand\munderbar[1]{%
\underaccent{\bar}{#1}}
\usepackage[retainorgcmds]{IEEEtrantools}
%\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{subfig}
\usepackage{float}%keeps figures in the text where the page the code is written
\usepackage{pgfplots}
\usepackage{tikz}
答案1
正如您所发现的,该方程太长,无法在一行中写完。虽然可以(但只能)在两行中写完,但我认为最好引入两个换行符。我建议使用单个multline
环境,将第 2 行和第 3 行放在一个aligned
环境中,并将这些行与分数项对齐。
\documentclass{article}
\usepackage{amsmath} % for 'multline' environment and '\DeclareMathOperator' macro
\DeclareMathOperator{\E}{E}
\usepackage{newtxtext,newtxmath} % mathptmx package is quite old
\begin{document}
\begin{multline}\label{eqn:43}
V_{j} ( s,q,z ) \equiv
\smash[b]{\max_{c_{j}^{d}, c_{j}^{m},y_{j}^{d},y_{j}^{m}}}
\biggl\{ \, \omega_{j} u(y_{j}) - v(y_{j}) \\
\begin{aligned}[b]
{}+ \beta \E \biggl[\, W \biggl(
&\frac{1}{\psi_{2}(\eta)}\bigl( \psi_{2}(\eta)s - c_{j} + y_{j} \bigr), \\
&\frac{\phi_{1}^{+}}{\phi_{2}(\eta)}\bigl( q + \tau_{j}^{c} - c_{j}^{m} + y_{j}^{m} \bigr) , z^{+} \biggr)
\biggm|\eta\,\biggr] \biggr\}\,.
\end{aligned}
\end{multline}
\end{document}
附录:在我发布上述答案后,原作者提供了有关文档设置的更多信息,包括页边距比初始答案中采用的默认值更窄(因此文本块要宽得多)。考虑到这条额外的信息,我不再建议使用基于 3 行multline
的设置,因为第 2 行和第 3 行会向右移动相当远,使它们看起来几乎与第 1 行没有连接。
相反,我会采用 2 行设置或采用在环境中multline
嵌套环境的解决方案。第一个环境用于对齐第 1 行和第 2 行,而第二个嵌套环境用于将第 3 行相对于第 2 行定位。这两种解决方案如下所示。aligned
equation
aligned
aligned
\documentclass[a4paper,12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath} % for 'multline' environment and '\DeclareMathOperator' macro
\DeclareMathOperator{\E}{E}
\usepackage{newtxtext,newtxmath} % mathptmx package is quite old
\begin{document}
\setcounter{equation}{42} % just for this example
\begin{multline}\label{eqn:43}
V_{j} ( s,q,z ) \equiv
\max_{c_{j}^{d}, c_{j}^{m},y_{j}^{d},y_{j}^{m}} \biggl\{
\, \omega_{j} u(y_{j}) - v(y_{j}) \\
%\begin{aligned}[b]
+ \beta \E \biggl[\, W \biggl(
\frac{1}{\psi_{2}(\eta)}\bigl( \psi_{2}(\eta)s - c_{j} + y_{j} \bigr), %\\
\frac{\phi_{1}^{+}}{\phi_{2}(\eta)}\bigl( q + \tau_{j}^{c} - c_{j}^{m} + y_{j}^{m} \bigr) , z^{+} \biggr)
\biggm|\eta\,\biggr] \biggr\}\,.
%\end{aligned}
\end{multline}
\begin{equation}\label{eqn:44}
\begin{aligned}[b]
V_{j} ( s,q,z ) \equiv
\smash[b]{\max_{c_{j}^{d}, c_{j}^{m},y_{j}^{d},y_{j}^{m}}}
\biggl\{ &\, \omega_{j} u(y_{j}) - v(y_{j}) \\
&\begin{aligned}[b]
{}+ \beta \E \biggl[\, W \biggl(
&\frac{1}{\psi_{2}(\eta)}\bigl( \psi_{2}(\eta)s - c_{j} + y_{j} \bigr), \\
&\frac{\phi_{1}^{+}}{\phi_{2}(\eta)}\bigl( q + \tau_{j}^{c} - c_{j}^{m} + y_{j}^{m} \bigr) , z^{+} \biggr)
\biggm|\eta\,\biggr] \biggr\}\,.
\end{aligned}
\end{aligned}
\end{equation}
\end{document}