[Tex/LaTex] n environment that imitates align but displays `textstyle` math

aligndisplaystylemath-mode

I'm currently typing a mathematical document which counts many sum symbols. I frequently use the align environment to render equations, although the default behaviour of this environment is to render the equations in displaystyle, which in my opinion wastes vertical space. I therefore have added \textstyle at the beginning of each line of math in this environment, but I'm looking for a more convenient solution.

So is there an environment that is similar to align with the exception it displays textstyle math by default ? Thank you.

Best Answer

Not sure what the usage for this is, but here's a possible way to go; it is based on the fact that in each cell of align a \displaystyle declaration is issued; of course this has severe limitations, because \dfrac will not work, for example.

\documentclass{article}
\usepackage{amsmath}

\newenvironment{talign}
 {\let\displaystyle\textstyle\align}
 {\endalign}
\newenvironment{talign*}
 {\let\displaystyle\textstyle\csname align*\endcsname}
 {\endalign}

\begin{document}

This is a normal \texttt{align} environment
\begin{align}
\log(1+x) &= \sum_{n\ge 1}(-1)^{n+1}\frac{x^n}{n} \\
\arctan x &= \sum_{n\ge 0}(-1)^{n}\frac{x^{2n+1}}{2n+1}
\end{align}
and this is a \texttt{talign} environment
\begin{talign}
\log(1+x) &= \sum_{n\ge 1}(-1)^{n+1}\frac{x^n}{n} \\
\arctan x &= \sum_{n\ge 0}(-1)^{n}\frac{x^{2n+1}}{2n+1}
\end{talign}
followed by an unnumbered one
\begin{talign*}
\log(1+x) &= \sum_{n\ge 1}(-1)^{n+1}\frac{x^n}{n} \\
\arctan x &= \sum_{n\ge 0}(-1)^{n}\frac{x^{2n+1}}{2n+1}
\end{talign*}

\end{document}

enter image description here

If you want to be able to use \displaystyle in the subformulas, then a more complicated approach is needed: the command \displaystyle is locally defined to issue \textstyle and to redefine itself to be the primitive \displaystyle.

\documentclass{article}
\usepackage{amsmath}

\let\texdisplaystyle\displaystyle
\def\displaytotextstyle{\textstyle\let\displaystyle\texdisplaystyle}

\newenvironment{talign}
 {\let\displaystyle\displaytotextstyle\align}
 {\endalign}
\newenvironment{talign*}
 {\let\displaystyle\displaytotextstyle\csname align*\endcsname}
 {\endalign}

\begin{document}

This is a normal \texttt{align} environment
\begin{align}
\log(1+x) &= \sum_{n\ge 1}(-1)^{n+1}\frac{x^n}{n} \\
\arctan x &= \sum_{n\ge 0}(-1)^{n}\frac{x^{2n+1}}{2n+1}
\end{align}
and this is a \texttt{talign} environment
\begin{talign}
\log(1+x) &= \sum_{n\ge 1}(-1)^{n+1}\dfrac{x^n}{n} \\
\arctan x &= \sum_{n\ge 0}(-1)^{n}\dfrac{x^{2n+1}}{2n+1}
\end{talign}
followed by an unnumbered one
\begin{talign*}
\log(1+x) &= \sum_{n\ge 1}(-1)^{n+1}\frac{x^n}{n} \\
\arctan x &= \sum_{n\ge 0}(-1)^{n}\frac{x^{2n+1}}{2n+1}
\end{talign*}

\end{document}
Related Question