我该如何整理下面的方程式?我希望文本“物体运动概率”不超过边距,并将第二行推到左侧。目前它看起来是这样的
\documentclass{article}
\usepackage[twocolumn,margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
\lipsum
\begin{align}
\sum_{s,i,j,t} \lambda_1(\underbrace{||\hat{y}^t_\Psi - y^t||_2^2}_\text{human pose} + \underbrace{||\hat{x}_{\varphi,i}^t - x_i^t||_2^2}_\text{object pose}) + \lambda_2\underbrace{\hat{\alpha}^t_i \log \alpha^t_i}_{\mathclap{\text{object motion probability}}} \nonumber \\ + \lambda_1\underbrace{\delta_s^t||(\hat{y}^t_{\Phi,s} - y^t){\circ} (1-m_s)||_2^2}_\text{refined arms} + \lambda_2\underbrace{\hat{\beta}^t_{s,j} \log \hat{\beta}^t_{s,j}}_{\mathclap{\text{contact probability}}} \nonumber
\end{align}
\lipsum
\end{document}
答案1
您可以按照下列方式使用fleqn
该包的环境:nccmath
\documentclass{article}
\usepackage[twocolumn,margin=2cm]{geometry}
\usepackage{mathtools,nccmath}
\usepackage{lipsum}
\begin{document}
\lipsum
\begin{fleqn}
\begin{multline*}
\sum_{s,i,j,t} \lambda_1(\underbrace{\lVert\hat{y}^t_\Psi - y^t\rVert_2^2}_\text{human pose} + \underbrace{\lVert\hat{x}_{\varphi,i}^t - x_i^t\rVert_2^2}_\text{object pose})
+ \lambda_2\underbrace{\hat{\alpha}^t_i \log \alpha^t_i}_{\mathclap{\text{object motion probability}}}\\
+ \lambda_1\underbrace{\delta_s^t\lVert(\hat{y}^t_{\Phi,s} - y^t)\circ (1-m_s)\rVert_2^2}_\text{refined arms}
+ \lambda_2\underbrace{\hat{\beta}^t_{s,j} \log \hat{\beta}^t_{s,j}}_{\mathclap{\text{contact probability}}}
\end{multline*}
\end{fleqn}
\lipsum
\end{document}
答案2
\mathindent
如果设置为零,则所写的表达式 (刚好) 适合。
\lVert
请注意||
,您可以使用*
环境而不是\nonumber
每一行,并且使用_{\text{...}}
not _\text{...}
(后者偶然起作用但确实很奇怪并且极大地增加了将表达式转换为 html 或其他格式的复杂程度。)
\documentclass{article}
\usepackage[twocolumn,margin=2cm]{geometry}
\usepackage[fleqn]{amsmath}
\setlength\mathindent{0pt}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
\lipsum
\begin{multline*}
\sum_{s,i,j,t} \lambda_1(\underbrace{\lVert\hat{y}^t_\Psi -
y^t\rVert_2^2}_{\text{human pose}} + \underbrace{\lVert\hat{x}_{\varphi,i}^t -
x_i^t\rVert_2^2}_{\text{object pose}}) +
\lambda_2\underbrace{\hat{\alpha}^t_i \log \alpha^t_i}_{\mathclap{\text{object motion probability}}} r \\
+ \lambda_1\underbrace{\delta_s^t\lVert(\hat{y}^t_{\Phi,s} - y^t){\circ} (1-m_s)\rVert_2^2}_\text{refined arms} +
\lambda_2\underbrace{\hat{\beta}^t_{s,j} \log \hat{\beta}^t_{s,j}}_{\mathclap{\text{contact probability}}}
\end{multline*}
\lipsum
\end{document}
答案3
你怎样才能将方程式在求和符号处拆分,并将每个子表达式保留在单独的行中?
我还建议在每个 内进行一些小改动\underbrace
。如果插入支柱,则可以垂直拉伸内容并将每个注释推到同一级别。宏\xmathstrut
( ) 有一个与支柱高度相对应的mathtools
参数。size
如果您希望在多行中使用下标,请尝试\substack
。其变体subarray
(环境)也可以控制对齐。由于注释以数学(斜体)排版,因此您需要在每一行中使用。这可以在常规 中使用和( )\text{}
来自动化。\cellcollect
\endcellcollect
cellcoll
array
以下是代码
\documentclass{article}
\usepackage[twocolumn,margin=2cm]{geometry}
\usepackage{array}
\usepackage{mathtools}
\usepackage{lipsum}
\usepackage{collcell}
\newcommand\textcell[1]{\text{\scriptsize#1}}
\NewDocumentEnvironment{xsubarray}{mb}{%
\renewcommand\arraystretch{0.65}%
\begin{tabular}{>{\collectcell\textcell}#1<{\endcollectcell}}#2\end{tabular}}{}
\newcommand\xxstrut[1][0.5]{\xmathstrut{#1}}
\begin{document}
\lipsum
\begin{equation*}
\begin{split}
\sum_{s,i,j,t} \mathrlap{\lambda_1 \Bigl(
\underbrace{\xxstrut
\lVert\hat{y}^t_\Psi - y^t\rVert_2^2}_{\text{human pose}}
{}+{}
\underbrace{\xxstrut
\lVert\hat{x}_{\varphi,i}^t - x_i^t\rVert_2^2}_\text{object pose}
\Bigr)} & \\
& + \lambda_2 \Bigl(
\underbrace{\xxstrut
\hat{\alpha}^t_i \log \alpha^t_i}_{\mathclap{
\begin{xsubarray}{c}object motion\\probability\end{xsubarray}}}
{}+{}
\underbrace{\xxstrut
\hat{\beta}^t_{s,j} \log \hat{\beta}^t_{s,j}}_{\mathclap{
\begin{xsubarray}{c}contact\vphantom{bj}\\probability\end{xsubarray}}}
\Bigr) \\
& + \lambda_1 \Bigl(
\underbrace{\xxstrut
\delta_s^t\lVert(\hat{y}^t_{\Phi,s} - y^t){\circ} (1-m_s)\rVert_2^2}_\text{refined arms}
\Bigr).
\end{split}
\end{equation*}
\lipsum
\end{document}
答案4
您需要考虑超出下括号的文本的宽度,并将其设为零\mathclap
。
您也可以(本地)删除\multlinegap
。
\documentclass{article}
\usepackage[twocolumn,margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{lipsum}
\newcommand{\ubrace}[2]{{\underbrace{#1}_{#2}}}
\begin{document}
\lipsum[1][1-4]
\begingroup\setlength{\multlinegap}{0pt}
\begin{multline*}
\sum_{s,i,j,t}
\lambda_{1}\bigl(\,\ubrace{\|\hat{y}^t_\Psi - y^t\|_2^2\vphantom{^{}_{j}}}
{\text{human pose}}
+\ubrace{\|\hat{x}_{\varphi,i}^t - x_i^t\|_2^2}{\text{object pose}}\,\bigr)
+\lambda_2\ubrace{\hat{\alpha}^t_i \log \alpha^t_i\vphantom{^{}_{\phi}}}
{\mathclap{\text{object motion probability}}}
\hphantom{\scriptstyle\mathrm{bability}}
\\
+\lambda_1\ubrace{\delta_s^t\|(\hat{y}^t_{\Phi,s}-y^t)\circ(1-m_s)\|_2^2\vphantom{^{}_{j}}}
{\text{refined arms}}
+\lambda_2\ubrace{\hat{\beta}^t_{s,j} \log \hat{\beta}^t_{s,j}}
{\mathclap{\text{contact probability}}}
\hphantom{\scriptstyle\mathrm{ity}}
\end{multline*}
\endgroup
\lipsum[2][1-3]
\end{document}
注意虚线,以使下括号和命令处于相同的级别\ubrace
;您可以清楚地看到 + 符号的间距是错误的\underbrace
。还要注意 和\bigl(
,\bigr)
以及较窄的间距,以避免冲突。