# On \atop again: how to obtain the same result without warning

I know this question has been already discussed but the answer does not seem to work in my case.

I am using the \atop command with the amsmath package to stack two symbols (more specifically $a=x$ and $b=y$) but, as well known, this is foreign to LaTeX.

The standard reply I found (and LaTeX warning suggestion) is to use \frac or \genfrac, but these will insert a line between the two symbols, that I do not want. The other suggestion is to use \overset, but this treats the symbol below as main and prints it bigger than the one above.

How do I obtain the same result as \atop without getting the LaTeX warning?

• See the stackengine and/or the tabstackengine package. – Steven B. Segletes Sep 14 '18 at 10:21

## 3 Answers

\genfrac won't produce a line if the third argument (which control the thickness of the rule) is set to 0pt; the syntax for \genfrac is

\genfrac{<left-delim>}{<right-delim>}{<thickness>}{<mathstyle>}{<numerator>}{<denominator>}


A little example:

\documentclass{article}
\usepackage{amsmath}

\newcommand\mycom[2]{\genfrac{}{}{0pt}{}{#1}{#2}}

\begin{document}
$A\mycom{a=x}{b=y}B$
\end{document}


• @GonzaloMedina sorry, I hadn't looked back at this. Your answer is more complete. It's all yours. – A.Ellett Jun 14 '13 at 5:07

The question does not tell the context, where the symbol stacking is used.

• \genfrac is shown in the other answer(s). It also uses the next smaller math style if available.

• \substack can be used in limits, because it does not change the math style:

Example using \substack:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\sum_{a=x \atop b=y}^{\text{atop}} \quad \sum_{\substack{a=x\\b=y}}^{\text{substack}} \quad \sum_{a=x}^{\text{normal}}$
\end{document}


You can use \underset see the following example

$$\prod\limits_{\underset{j\ne h}{j = 1}}^{4K} {\Gamma \left( {{a_h} - {a_j}} \right)}$$

• Welcome to TeX.SE. A quick hint: If you indent lines of code by four spaces, the site software will pretty-print them automatically. Separately, I think you should mention in your answer that \underset requires loading of the amsmath package and (even more importantly) that the second argument will be typeset in a smaller font than the first. This behavior is quite different from that of \substack, which does not impose a font size change from the one row to the next. – Mico Sep 14 '18 at 10:09