# Incompatibility of lmodern and fourier?

Using the lmodern package, I had the typical font size issues in math mode: for example the sums were not large enough in some of my equations. To solve this I followed egreg's answer to the following question: sum symbol in tikzposter too small

The solution works for the sums but now my brackets are not scaled correctly anymore. Making a minimal working example I noticed that the issue is related to the fourier package. So I suppose there are incompatibilities somewhere. I know fourier has incompatibilities with other math fonts packages such as mathptmx, in my case it might be related to lmodern. Is it possible to use fourier and lmodern and avoid the scaling issues I have with my equations?

MWE:

\documentclass[a4paper, 12pt, twoside,openright]{report}
\usepackage{lmodern}
\usepackage[upright]{fourier}

% declare cmex to be arbitrary scalable
\DeclareFontShape{OMX}{cmex}{m}{n}{
<-7.5> cmex7
<7.5-8.5> cmex8
<8.5-9.5> cmex9
<9.5-> cmex10
}{}

\SetSymbolFont{largesymbols}{normal}{OMX}{cmex}{m}{n}
\SetSymbolFont{largesymbols}{bold}  {OMX}{cmex}{m}{n}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}

\begin{document}
$$U_{qq} = \sum_{i < j \leq N_m} q_i q_j \left[ \sideset{}{'}\sum_{\bm{n}} \frac{\text{erfc}(\alpha \lvert\bm{r}_{ij} + L\bm{n}\rvert)}{\lvert\bm{r}_{ij} + L\bm{n}\rvert} + \frac{1}{\pi L} \sum_{\bm{n} \not= 0} \frac{1}{n^2} \exp(- \frac{\pi^2 n^2}{\alpha^2 L^2} + \frac{2 \pi i}{L} \bm{n} \cdot \bm{r}_{ij}) \right]$$
\end{document}


Result with fourier:

Result without fourier:

• How do you want two math fonts packages to be compatible? You can manage to use some symbols from one package in the place of the corresponding symbols from the other, bur certainly not use both simultaneously. Sep 22 '17 at 10:07
• @Bernard, my understanding of the advantages of lmodern is limited. It's part of the template I've been asked to use and several discussions on this site seem to conclude that it's advisable to use it. Sep 22 '17 at 13:22
• If using that template is mandatory, then you should not load fourier. If it isn't, then remove \usepackage{lmodern} and the part from \DeclareFontShape to the second \SetSymbolFont. Sep 22 '17 at 13:29
• I just tried commenting the call to lmodern and the part from \DeclareFontShape as advised. Unfortunately, it brings back the scaling problem on the sums. Sep 22 '17 at 13:34
• I see no scaling problem. By designer's choice, the summation symbol is smaller than with other fonts. The font used for large symbols is fully scalable to begin with, so there's no similarity with the problem in lmodern. Sep 22 '17 at 13:40

If you do \SetSymbolFont{largesymbols}{normal}{OMX}{cmex}{m}{n} after loading fourier, you're overriding the large symbol font and the result will be a horrible mixture.

Loading lmodern is useless if fourier is loaded too after it. Besides, fourier doesn't have the same problem as lmodern about non scalability of large symbols, because the font it provides is fully scalable at the outset.

Here's an example.

\documentclass[a4paper, 12pt, twoside,openright]{report}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage[upright]{fourier}

\begin{document}

$$U_{qq} = \sum_{i < j \leq N_m} q_i q_j \left[ \sideset{}{'}\sum_{\bm{n}} \frac{\text{erfc}(\alpha \lvert\bm{r}_{ij} + L\bm{n}\rvert)}{\lvert\bm{r}_{ij} + L\bm{n}\rvert} + \frac{1}{\pi L} \sum_{\bm{n} \not= 0} \frac{1}{n^2} \exp(- \frac{\pi^2 n^2}{\alpha^2 L^2} + \frac{2 \pi i}{L} \bm{n} \cdot \bm{r}_{ij}) \right]$$

$\sum\displaystyle\sum${\Huge$\sum\displaystyle\sum$}

\end{document}


As you see, the font scales well with size. It's only that the large summation symbol is, by designer's choice, smaller than the counterpart in Computer Modern, in which large symbols are, by default, very large.

It's not really difficult to grow the summation symbol larger in display style, but I can't recommend it.

\documentclass[a4paper, 12pt, twoside,openright]{report}

\usepackage[upright]{fourier}

\DeclareFontFamily{FMX}{futm-extra}{}
\DeclareFontShape{FMX}{futm-extra}{m}{n}{
<-> s * [1.2] fourier-mex
}{}

\DeclareSymbolFont{extralargesymbols}{FMX}{futm-extra}{m}{n}
\DeclareMathSymbol{\sum}{\mathop}{extralargesymbols}{"50}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}

\DeclareMathOperator{\erfc}{erfc}

\begin{document}

$$U_{qq} = \sum_{i < j \leq N_m} q_i q_j \biggl[ \sideset{}{'}\sum_{\bm{n}} \frac{\erfc(\alpha \lvert\bm{r}_{ij} + L\bm{n}\rvert)} {\lvert\bm{r}_{ij} + L\bm{n}\rvert} + \frac{1}{\pi L} \sum_{\bm{n} \not= 0} \frac{1}{n^2} \exp(- \frac{\pi^2 n^2}{\alpha^2 L^2} + \frac{2 \pi i}{L} \bm{n} \cdot \bm{r}_{ij}) \biggr]$$

\end{document}


I used \biggl and \biggr rather than \left and \right. More important is the definition of \erfc, because \text is wrong (more acceptable would be \mathrm, but see What's the difference between \mathrm and \operatorname?)

• As far I can see right now, this works flawlessly in my document. Maybe you could elaborate as to why you can't recommend making the symbols larger in this way? Sep 22 '17 at 14:52
• @user236356 Because the font designer decided differently. ;-) Sep 22 '17 at 14:55