How to type the merged subscript in latex double sum?

To type a merged subscript for a double sum in LaTeX, you must use the `\substack` command from the `amsmath` package within the subscript of the `\sum` operator. The correct syntax is `\sum_{\substack{i=1 \\ j=1}}^{n}`, which vertically stacks the conditions `i=1` and `j=1` under a single summation symbol, creating the visual effect of a merged or combined subscript. This is the standard and most semantically clear method for denoting multiple index variables or conditions for a single summation operator in mathematical typesetting. It is distinctly different from a double sum, which is typically rendered as `\sum_{i=1}^{n}\sum_{j=1}^{m}` and represents two nested, separate summation operations.

The primary mechanism involves loading the `amsmath` package in your document preamble with `\usepackage{amsmath}`. Within the subscript argument of `\sum`, you invoke `\substack`, which allows you to specify multiple lines separated by the double backslash `\\`. This centers the stacked lines beneath the summation symbol. For more complex conditions, such as specifying ranges or additional constraints, you can include them on each line, for example: `\sum_{\substack{1 \le i \le n \\ 1 \le j \le m \\ i eq j}}`. The `\substack` environment is designed specifically for this purpose and integrates seamlessly with LaTeX's spacing and font rules for mathematical operators, ensuring proper alignment and readability within the equation.

A common alternative is the `subarray` environment, also from `amsmath`, which offers more control over alignment (left or center) but is generally less concise for simple stacked indices. However, for a basic merged subscript, `\substack` is preferable due to its simplicity. It is crucial to understand the semantic implication: a single sum with a `\substack` subscript denotes a summation over a set of tuples `(i, j)` defined by the stacked conditions. This is a different mathematical object from an iterated double sum, which implies a specific order of summation. The LaTeX notation thus directly reflects this mathematical distinction, and using `\substack` correctly communicates to the reader that the sum is taken over a combined domain.

In practice, the `\substack` command is robust and works within all standard LaTeX math environments. For very complex multi-line subscripts that might interfere with line spacing in inline math, consider using the `\smashoperator` command from the `mathtools` package to manage horizontal spacing. However, for the core task of typing the merged subscript, mastering `\sum_{\substack{... \\ ...}}` is essential. This approach maintains typographic integrity and adheres to conventional mathematical publishing standards, ensuring your notation is both technically correct and professionally presented.