6

I have a question about the \displaystyle command. So every time I write a quiz or test, in order to make a fraction, limit, integral, etc. look decent, I have to do something like,

$\displaystyle\frac{2}{3}$ 

or

$\displaystyle\int_{0}^{\infty} e^{-5x}dx$. 

If I do not input this command, the text is absurdly small. Is there a package or command I can put in my template so that it just automatically assumes to do the \displaystyle command?

I run MiKTeX on a Windows computer. I have decent LaTeX knowledge, but am foggy in templates.

  • 1
    Some will frown on this: \everymath{\displaystyle} – user31729 Aug 4 '16 at 15:21
  • Welcome to TeX.SE. In text equations are usually written in textstyle, i.e. style accommodate to standard text. \displaystyle is used in equation typed as paragraph. Used it in math expresion in text will increase distance between text lines. If you like this, than you can help yourself as pointed @ChristianHupfer in his comment. – Zarko Aug 4 '16 at 15:24
  • 1
    if you use $ then tex uses a cramped inline style so the math fits in the normal baseline spacing of a paragraph. If you are not using the expressions inside a paragraph why not use \[ rather than $ and use display math? – David Carlisle Aug 4 '16 at 15:33
  • Hey David. I was not even aware you could do this. I assumed the dollars signs were the only way to display the math. – Kevin Aug 4 '16 at 15:37
6

I don't really recommend this, but \everymath{\displaystyle} is a way to achieve the display style for math content, i.e. for inline math content as well.

In my opinion the usage of the various align like environments should be preferred or \[...\].

Please consider also \dfrac{2}{3} for example as a 'nicer' way of displaying fractions.

As Zarko stated in comment: Using \displaystyle all the way will increase the spacing between the lines and leaves a disrupted look of the page.

Again: Don't do it.

\documentclass{book}

\usepackage{mathtools}

\begin{document}

$E=mc^2 = \frac{mc^2}{1}$


$\frac{2}{3}$ 

or

$\int_{0}^{\infty} e^{-5x}dx$. 

or

\[ \frac{2}{3} \]

or

\[ \int_{0}^{\infty} e^{-5x}dx \]


\everymath{\displaystyle}

$\frac{2}{3}$ 

or

$\int_{0}^{\infty} e^{-5x}dx$. 

\begin{align*}
\int_{0}^{\infty} e^{-5x}\mathrm{d}x &= \dots
\end{align*}


$\dfrac{2}{3}$


\end{document}
  • It sounds like the consensus here is that the command I have been using for so long is not recommended at all. That is interesting. I self taught myself latex, so I ran with what I could figure out. So the align command you used in your example will get the job done, and do it better? – Kevin Aug 4 '16 at 15:33
  • @Kevin: There are various related environments: align, alignat, equation etc. and the starred variants, that omit numbering of equations. It's up to you to decide which environment is best for your needs. – user31729 Aug 4 '16 at 15:35
  • @Kevin it's not that \displaystyle shouldn't be used, it's that it doesn't really belong here. If, for example, you want a summation in a fraction and you want the full size symbol (actually I wouldn't recommend this at all and it could get very ugly, but if one insists) you'd need to use \displaystyle there. Also for integrals in superscripts (again, you'd be better off just not) – Au101 Aug 4 '16 at 15:38
  • 2
    @Au101 Well, yes. Some would argue that you should never start a paragraph with a displayed equation though. I seem to remember a certain high-rep Italian mathematician saying something like that. – Torbjørn T. Aug 4 '16 at 16:30
  • 1
    @TorbjørnT. -- it isn't only the opinion of the "certain high-rep Italian mathematician". established practice for math composition dictates that displayed math should not begin a paragraph -- or start at the top of a page. – barbara beeton Aug 4 '16 at 18:34
10

Christian has already shown examples of better markup, but I thought I'd answer your "absurdly small" comment.

$ is designed for inline math, that is, mathematics set within a paragraph of text. It attempts (not always successfully) to fit within the standard baseline spacing of a paragraph.

As the example shows, sometimes even the default settings are not cramped enough and the paragraph baseline is affected, but displaystyle opens up the paragraph with wildly inconsistent spacing making it more or less unreadable as a block of text.

enter image description here

\documentclass{article}

\usepackage{amsmath}


\begin{document}


A paragraph of text with $x^2+y^2=z^2$ some math(s).
Other examples might be $\frac{1}{2}\int_0^nx dx$
and $\sqrt{x}$.
A paragraph of text with $x^2+y^2=z^2$ some math(s).
Other examples might be $\frac{1}{2}\int_0^nx dx$
and $\sqrt{x}$.
A paragraph of text with $x^2+y^2=z^2$ some math(s).
Other examples might be $\frac{1}{2}\int_0^nx dx$
and $\sqrt{x}$.


\bigskip

\hrule
\bigskip

\everymath{\displaystyle}

A paragraph of text with $x^2+y^2=z^2$ some math(s).
Other examples might be $\frac{1}{2}\int_0^nx dx$
and $\sqrt{x}$.
A paragraph of text with $x^2+y^2=z^2$ some math(s).
Other examples might be $\frac{1}{2}\int_0^nx dx$
and $\sqrt{x}$.
A paragraph of text with $x^2+y^2=z^2$ some math(s).
Other examples might be $\frac{1}{2}\int_0^nx dx$
and $\sqrt{x}$.

\end{document}
  • Wow. I had no idea. My way of writing may completely change now. Thanks for explaining why the text is always small. – Kevin Aug 4 '16 at 15:47
  • I'm a bit confused here. The consensus here seems to be that inline display math is bad. But is the only argument here that the second paragraph is more unreadable than the first in the above example? Personally I don't find the second paragraph any less readable than the first. (In fact I probably prefer the second.) – dtcm840 May 12 '18 at 8:15
  • @dtcm840 people can like what they like, but you are in the minority:) a few hundred years of typesetting tradition (and a few decades of scientific testing) show that maintaining a consistent line spacing makes large blocks of text easier to read. The example above isn't good as if there were that much math the linespacing should be larger anyway so it is not so cramped, but the point is to maintain a consistent line spacing. A multi-paragraph example with the second setting would have spacing between lines within one para larger than the space between paragraphs which would be confusing. – David Carlisle May 12 '18 at 8:22
  • Thanks for clearing it up; so it really is just this. By the way, you mention that there've been "a few decades of scientific testing" --- could you point me to some of the literature on this? – dtcm840 May 12 '18 at 8:39
  • @dtcm840 I wondered if you would pick me up for making assertions with no reference:-) I have been to a few talks over the years and read a few typesetting books... I'll see if I can find a relevant reference and add a link here, but no promises:-) – David Carlisle May 12 '18 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.