16

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.

oowekyala
  • 401
  • My tabstackengine package may help in some cases; however, it does not give each line of the equation stack a separate number. – Steven B. Segletes Oct 22 '15 at 19:15
  • @StevenB.Segletes Damn I forgot to mention I never use equation numbering inside math environments. So this package could prove useful, I'll check it out. Thank you ! – oowekyala Oct 22 '15 at 19:23
  • 1
    Sometimes it suffices to \smash the big sum signs, instead of using \textstyle which also will make fractions and therelike small. (Consider using \dfrac in this case.) – Wauzl Oct 22 '15 at 19:28
  • Then here is one of my answers that gives an overview: http://tex.stackexchange.com/questions/35174/best-way-to-create-an-system-of-equations-environment/126112#126112. – Steven B. Segletes Oct 22 '15 at 19:30

3 Answers3

15

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}
egreg
  • 1,121,712
1

I replaced \displaystyle with \textstyle. Also, \dfrac will work as intended.

\documentclass{article}
\usepackage{amsmath}

\makeatletter \renewcommand{\align@preamble}{% &\hfil% \strut@% \setboxz@h{@lign$\m@th\textstyle{##}$}% \ifmeasuring@\savefieldlength@\fi% \set@field% \tabskip\z@skip% &\setboxz@h{@lign$\m@th\textstyle{{}##}$}% \ifmeasuring@\savefieldlength@\fi% \set@field% \hfil% \tabskip\alignsep@% } \makeatother

\begin{document}

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

\end{document}

0
\begin{align}
& \text{not displayed (inline) math inside align environment:} \cr
& \begin{array}{l}
\int_{-1}^1 x dx = \int_1^{-1} x dx
\end{array} \cr 
& \begin{array}{l}
\sup_{0<x<1} x^2 = 1
\end{array} \cr
& \text{usual displayed math inside align environment:} \cr
& \int_{-1}^1 x dx = \int_1^{-1} x dx \cr 
& \sup_{0<x<1} x^2 = 1
\end{align}
Mensch
  • 65,388