更好的?

更好的?

我想在顯示模式下使以下求和符號與下標一樣寬(但不更高):

\[ \sum_{i_1, i_2,\cdots,i_m=1}^n\]

答案1

我不認為你想要這樣的東西

哦,太糟糕了!

或者

在此輸入影像描述

第一個圖像的程式碼

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\newcommand{\widesum}[2]{%
  \mathop{\vcenter{\hbox{\dowidesum{#1}{#2}}}}_{#1}^{#2}
}
\newcommand{\dowidesum}[2]{%
  \sbox0{$\scriptstyle#1$}%
  \dimen0=\wd0
  \sbox0{$\scriptstyle#2$}%
  \ifdim\wd0>\dimen0 \dimen0=\wd0\fi
  \resizebox{\dimen0}{\height}{$\displaystyle\sum$}%
}

\begin{document}

\[
\widesum{i_1, i_2,\cdots,i_m=1}{n}
\]

\end{document}

第二張圖片的程式碼

只要\height改成!

更好的?

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}

\[
\sum_{\substack{1\le i_k\le n\\1\le k\le m}}
\]

\end{document}

在此輸入影像描述

答案2

您可以xparse為此使用裝飾。

\documentclass{article}
\usepackage{xparse}

\ExplSyntaxOn

\box_new:N \l_tmpc_box
\cs_new:Nn \dim_max:nnn
{
  \dim_max:nn { \dim_max:nn { #1 } { #2 } } { #3 }
}

\NewDocumentCommand \dowidesum { m m }
{
  \hbox_set:Nn \l_tmpa_box { $\mathsurround=0pt\scriptstyle#1$ }
  \hbox_set:Nn \l_tmpb_box { $\mathsurround=0pt\scriptstyle#2$ }
  \hbox_set:Nn \l_tmpc_box { $\mathsurround=0pt\displaystyle\sum$ }
  \dim_set:Nn \l_tmpa_dim
  {
    \dim_max:nnn
    { \box_wd:N \l_tmpa_box }
    { \box_wd:N \l_tmpb_box }
    { \box_wd:N \l_tmpc_box }
  }
  \box_resize_to_wd_and_ht:Nnn \l_tmpc_box { \l_tmpa_dim } { \box_ht:N \l_tmpc_box }
  \mathop{\box_use:N \l_tmpc_box}\limits\sp{#1}\sb{#2}
}

\ExplSyntaxOff

\NewDocumentCommand \widesum {e{^_}}
{
  \dowidesum{#1}{#2}
}

\begin{document}

\[ \widesum_{i_1, i_2,\cdots,i_m=1}^n \]

\end{document}

在此輸入影像描述

相關內容