5

When I use \fontsize{foo}{bar}{baz} to increase the font size, not all the maths symbols increase accordingly. For example, the \int, \sqrt (display style) and lines when drawing fractions don't increase accordingly.

e.g.

\documentclass{article}
\usepackage{amsmath,amssymb,bm,fontenc,physics,lmodern,nicefrac}
\begin{document}
{\fontsize{50}{62.500000}{\rmfamily $\displaystyle\int_\mathbb{R}^{} \sqrt{\dfrac{1}{\sqrt{2\pi\sigma}} \exp(-\dfrac{x^2}{2\sigma^2})} \dd{x} = 1 $}}
\end{document}

produces

enter image description here

whereas without the fontsize command everything looks as it should:

enter image description here

Is there a package I can add or a small fix to sort this out?

What I've tried so far

I thought adding \DeclareMathSizes{50}{45}{35}{25} to the preamble would sort this out but it appears not.

Why the massive font?

This is actually output from using Python's matplotlib package, ultimately stemming from this issue Matplotlib some LaTeX symbols not scaling with increased figure sizes which based on this answer, is a result of what LaTeX is producing. Hence if I can figure out how to get LaTeX to produce the right out put then I can look at modifying matplotlib's behaviour. Hence a very minimal modification would be preferred.

8

This is the same problem as in Ugly alignment (size of square root symbol) with Latin Modern at 12pt

A minimal cure is to load fixcmex. Also, lmodern should be loaded earlier.

I wouldn't use neither physics nor nicefrac. Also it doesn't make much sense to load fontenc with no option.

\documentclass[border=10]{standalone}
\usepackage{lmodern,amsmath,amssymb,bm,physics,nicefrac,fixcmex}
\begin{document}
{\fontsize{50}{62.500000}{\rmfamily 
$\displaystyle\int_\mathbb{R}^{} \sqrt{\dfrac{1}{\sqrt{2\pi\sigma}} 
\exp(-\dfrac{x^2}{2\sigma^2})} \dd{x} = 1 $}}
\end{document}

enter image description here

| improve this answer | |
  • I believe loading fontenc without option is rather useless, isn't it? – campa Aug 23 '18 at 10:29
  • @campa Yes, I forgot to mention it. – egreg Aug 23 '18 at 10:33
  • Just what I needed, Thanks. Also, I forgot about fontenc. Also, is there a justification for erring away from physics and nicefrac? Nicefrac I occasionally use, but physics I use heavily. – oliversm Aug 23 '18 at 10:39
  • 2
    @oliversm physics is, in my opinion, a collection of badly written macros. Also, the fractions of nicefrac are good for recipe books, not for mathematics. – egreg Aug 23 '18 at 10:42
  • I have just seen that this solution doesn't play well with \mathbbm{1} from the bbm package. I will open up a separate question shortly, but perhaps there is a minimal fix to this answer? – oliversm Mar 21 '19 at 18:07

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.