2

Is there a way to change the way \frac behaves in inline math such as \[*code*\]? It keeps changing it to \dfrac which I don't want. It works for \(*code*\) but I want it centered and auto line skip and I don't want to do it manually. I don't want to manually change the text size, instead a general case that changes it for good.

enter image description here

Looks out of place in my opinion.

2
  • 3
    \tfrac (from amsmath) or \textstyle\frac should do the trick.
    – user94293
    Commented Feb 10, 2017 at 3:53
  • Thanks, much simpler than I thought. Now I feel unintelligent. Commented Feb 10, 2017 at 3:57

1 Answer 1

6

I want to extend the version in the comments. Of course you can use \tfrac, but if you want to keep \frac you can switch between math styles with \displaystyle and \textstyle as shown below:

fracs

\documentclass{article}
\usepackage{amsmath,amssymb,amsfonts}
\begin{document}
    This is text in LaTeX with some math \(P\left( -\frac{25}{19},\frac{40}{19} \right) = \frac{-25+80}{19}\) inline.
    The same in displaystyle: \[\left( -\frac{25}{19},\frac{40}{19}\right) = \frac{-25+80}{19}\]
    Now we imitate displaystyle in text: \(\displaystyle  P\left( -\frac{25}{19},\frac{40}{19} \right) = \frac{-25+80}{19}\) And of course some textstyle in displaystyle: \[\textstyle\left( -\frac{25}{19},\frac{40}{19}\right) = \frac{-25+80}{19}\]
\end{document}
2
  • unfortunately, \displaystyle fractions in text make the baselines very uneven, and the resulting page tends to look like it has a skin disease. best to delay the style decision until you've looked at the output. Commented Feb 10, 2017 at 9:58
  • @barbarabeeton I agree with you that is not always advantageous to the style, but I just wanted to show the different options.
    – TeXnician
    Commented Feb 10, 2017 at 10:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .