8

I am trying to reproduce the following formula, where an integral has a “specification” assigned, placed on its bottom left; any idea on the proper/best way to do so?

enter image description here

Rpy
  • 133
  • Related: https://tex.stackexchange.com/questions/557655/low-level-command-for-controlling-left-superscript-spacing – Gaussler Jun 26 '23 at 06:08

4 Answers4

9

I set the specification as a subscript to a “phantom” integral. Some care is needed to get spacings right. Since the macro ends with \int, the limits will be read as usual.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\specint}[1]{% \mathop{}% for the spacing before the integral {\vphantom{\int}}_{(#1)}% !% remove the spurious spacing \int }

\begin{document}

[ \specint{\alpha}_0^1\frac{dQ}{T} \qquad \specint{\beta}_0^1\frac{dQ}{T} ] \begin{center} % to see what happens inline $\specint{\alpha}_0^1\frac{dQ}{T} \qquad \specint{\beta}_0^1\frac{dQ}{T}$ \end{center}

\end{document}

enter image description here

Comparison with the other proposed solutions

  1. \specint is my proposal
  2. \sideset doesn't work inline
  3. with \mathllap the spacing is weird
  4. with \prescript the specification sits lower than the lower limit (and there is no \mathop)
  5. with \raisebox the effect is awful as soon as inline math is tried
\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage[tiny]{titlesec} % spare on vertical spacing

\begin{document}

\section{\texttt{\string\specint}}

\newcommand{\specint}[1]{% \mathop{}% for the spacing before the integral {\vphantom{\int}}_{(#1)}% !% remove the spurious spacing \int }

[ \specint{\alpha}_0^1\frac{dQ}{T}

\specint{\beta}_0^1\frac{dQ}{T} ] \begin{center} $\specint{\alpha}_0^1\frac{dQ}{T}

\specint{\beta}_0^1\frac{dQ}{T}$ \end{center}

\section{\texttt{\string\sideset}}

[ \sideset{{(\alpha)}}{^{1}{0}}\int\frac{dQ}{T}

\sideset{{(\beta)}}{^{1}{0}}\int\frac{dQ}{T} ] \begin{center} $\sideset{{(\alpha)}}{^{1}{0}}\int\frac{dQ}{T}

\sideset{{(\beta)}}{^{1}{0}}\int\frac{dQ}{T}$ \end{center}

\section{\texttt{\string\mathllap}}

\newcommand\myint[3]{% \mkern23mu\int_{\mathllap{(#1)\mkern15mu}#2}^{#3}}

[ \myint{\alpha}{0}{1} \frac{dQ}{T}

\myint{\beta}{0}{1} \frac{dQ}{T} ] \begin{center} $\myint{\alpha}{0}{1} \frac{dQ}{T}

\myint{\beta}{0}{1} \frac{dQ}{T}$ \end{center}

\newpage

\section{\texttt{\string\prescript}}

[ \prescript{}{(\alpha)}{\int^1_0}\frac{dQ}{T}

\prescript{}{(\beta)}{\int^1_0}\frac{dQ}{T} ] \begin{center} $\prescript{}{(\alpha)}{\int^1_0}\frac{dQ}{T}

\prescript{}{(\beta)}{\int^1_0}\frac{dQ}{T}$ \end{center}

\section{\texttt{\string\raisebox}}

[ \raisebox{-.25cm}{$_{(\alpha)}$} \int_0^1 \frac{dQ}{T}

\raisebox{-.25cm}{${(\beta)}$} \int_0^1 \frac{dQ}{T} ] \begin{center} $\raisebox{-.25cm}{${(\alpha)}$} \int_0^1 \frac{dQ}{T}

\raisebox{-.25cm}{$_{(\beta)}$} \int_0^1 \frac{dQ}{T}$ \end{center}

\end{document}

enter image description here

egreg
  • 1,121,712
6

The \sideset command from amsmath is designed for this purpose.

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document} [ \sideset{{(\alpha)}}{^{1}{0}}\int\frac{dQ}{T},\sideset{{(\beta)}}{^{1}{0}}\int\frac{dQ}{T}, ] \end{document}

Sandy G
  • 42,558
4

I take it that the prefix term -- (\alpha) resp. (\beta) -- and the lower limit of integration -- 0 for both integrals considered here -- must share the same baseline. If this assumption is correct, the following solution, which uses the \mathllap macro provided by the mathtools package (a superset of the amsmath package), should be of interest.

It provides a user-level macro called \myint (feel free to come up with a different name...) that takes three arguments: the prefix, the lower limit of integration, and the upper limit of integration. The first argument should be non-empty -- otherwise, why bother with using \myint? -- while the second and third arguments may be empty.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for \mathllap macro
\newcommand\myint[3]{%
   \mkern23mu\int_{\mathllap{(#1)\mkern15mu}#2}^{#3}}

\begin{document}

[ \myint{\alpha}{0}{1} \frac{\mathrm{d}Q}{T},, \quad \myint{\beta}{0}{1} \frac{\mathrm{d}Q}{T},. ]

\end{document}


Addendum: As @mbert has pointed out in a comment, the mathtoools package provides a macro called \prescript that's ideally suited to take care of the job at hand.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for '\prescript' macro

\begin{document} [ \prescript{}{(\alpha)}{\int^1_0}\frac{\mathrm{d}Q}{T} \quad \prescript{}{(\alpha+\beta+\gamma)}{\int^1_0}\frac{\mathrm{d}Q}{T} \quad\textstyle \prescript{}{(\alpha+\beta+\gamma)}{\int^1_0}\frac{\mathrm{d}Q}{T}

] \end{document}

Mico
  • 506,678
3

Try this code:

\documentclass{article}
\usepackage{amsmath,adjustbox}

\begin{document}

\[
\raisebox{-.25cm}{$_{(\alpha)}$} \int_0^1 \frac{\text{dQ}}{\text{T}}, \quad \raisebox{-.25cm}{$_{(\beta)}$} \int_0^1 \frac{\text{dQ}}{\text{T}},
\]

\end{document}

Result:

enter image description here