24

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?

2

3 Answers 3

33

\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}

enter image description here

2
12

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}

Result

1

You can use \underset see the following example

\begin{equation}
\prod\limits_{\underset{j\ne h}{j = 1}}^{4K} {\Gamma \left( {{a_h} - {a_j}} \right)} 
\end{equation}
1
  • 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, 2018 at 10:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .