2

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}
    \begin{equation}
    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{equation}
\end{document}

Result with fourier: enter image description here

Result without fourier: enter image description here

8
  • 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.
    – Bernard
    Sep 22, 2017 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.
    – user236356
    Sep 22, 2017 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.
    – egreg
    Sep 22, 2017 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.
    – user236356
    Sep 22, 2017 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.
    – egreg
    Sep 22, 2017 at 13:40

2 Answers 2

2

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}

\begin{equation}
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{equation}

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

\end{document}

enter image description here

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}

\begin{equation}
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{equation}

\end{document}

enter image description here

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?)

2
  • 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?
    – user236356
    Sep 22, 2017 at 14:52
  • 1
    @user236356 Because the font designer decided differently. ;-)
    – egreg
    Sep 22, 2017 at 14:55
0

Here is one more example of the problems that arise when mixing lmodern and fourier. (It depends on the order in which they are loaded.)

\documentclass{article}
%\usepackage{lmodern,fourier} %plus symbol displays
\usepackage{fourier,lmodern}  %plus symbols does not display
\begin{document}
$a+b$
\end{document}
1
  • 1
    The first choice (loading lmodern, then fourier) makes sense: it chooses the Fourier fonts for Roman text and Maths and lmss for \sffamily and lmtt for \ttfamily (remember that fourier.sty only changes fonts for roman text and maths). The second choice doesn't make sense… and has nasty side effects. DO NOT load fourier at all if you want lmodern fonts for Roman, Sans and Mono text and for maths. Apr 14 at 9:50

You must log in to answer this question.

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