I would like to learn how auto-program my document to display integrals with fractions nicely.
My MWE:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\int_{\frac{1}{2}}^{\frac{\pi}{10}} \frac{x^2+x+1}{e^x +3}$ \vspace{1cm} %standard display
$\frac{x^2+x+1}{e^x+\frac{3}{2}}$ \vspace{1cm} %standard display
\end{document}
What I would like to know is how do I program it so that if you have a limits with fractions use \tfrac for the limits but if you have a fraction on it own, use \dfrac.
Desired result:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\displaystyle\int_{\tfrac{1}{2}}^{\tfrac{\pi}{10}} \dfrac{x^2+x+1}{e^x +3}$ \vspace{1cm} %uses \tfrac for limits and \dfrac for fraction
$\dfrac{x^2+x+1}{e^x+\frac{3}{2}}$ \vspace{1cm} %uses \dfrac because its a fraction
\end{document}
\[
and\]
(or the non-advised$$
)), then this would happen automatically.\frac
? and use display math environments such as\[
for the displays then you will not need$\displaystyle
\[
,equation
, etc.