使用 Euler 字体 - Eufisky - The lost book
LaTeX 技巧

使用 Euler 字体

Eufisky posted @ 2018年5月14日 00:12 in LaTeX with tags latex 字体 , 1830 阅读

Euler in Modern Toolchains

Today, there exists an OpenType edition of Euler, Neo Euler, by Khaled Hosny. However, it was abandoned in 2011. If you download Neo Euler from its GitHub page, it is possible to use with either LuaLaTeX or XeLaTeX, but there are a few gotchas.

This is lengthy because I give many complex examples that you can cut and paste into your preamble. They should just about cover all the use cases I’ve ever heard anyone recommend.

The Classic Look

Neo Euler, like AMS Euler, contains only glyphs for upright math. To get the classic look of the euler and eulervm packages, or the book Concrete Mathematics, you’ll want to set the unicode-math option math-style=upright.

Then, you want to load only the glyphs Neo Euler provides, with a fallback math font for the rest. Here, I use Khaled Hosny’s newer math font, Libertinus Math. It shows some influence from Euler, especially in its integrals. Finally, make sure to load the Greek letters as the upright math alphabet, since unicode-math expects lowercase Greek letters to be slanted. It sets up the other alphabets the euler package does, including Euler Script as both \mathcal and \mathscr, but not all the alphabets unicode-math supports. Legacy documents should still compile with this preamble.

For the text font, this sets up the Computer Modern Unicode version of Concrete. (Note that the CMU Concrete Bold font is a recent addition. DEK did not create a bold face for Concrete Roman, and used Computer Modern Roman Bold Extended in Concrete Mathematics instead. The beton documentation traditionally recommended Computer Modern Sans Serif Demibold Condensed. Today, you might try Gill Sans/Gillius ADF and see if you like it.)

\documentclass{article}
\pagestyle{empty}

\usepackage{amsmath}
\DeclareMathOperator\Res{Res}
\newcommand*\diff{\mathop{}\!\mathup{d}}

\usepackage{amsthm}
\newtheorem{theorem}{Theorem}

\usepackage{unicode-math}

%%%
% Set up you text and math fonts
%%%

\unimathsetup{math-style=upright}
\setmainfont{CMU Concrete}
\defaultfontfeatures{Scale=MatchLowercase}
\setmathfont{Libertinus Math}
\setmathfont[range={"0000-"0001,"0020-"007E,
                    "00A0,"00A7-"00A8,"00AC,"00AF,"00B1,"00B4-"00B5,"00B7,
                    "00D7,"00F7,
                    "0131,
                    "0237,"02C6-"02C7,"02D8-"02DA,"02DC,
                    "0300-"030C,"030F,"0311,"0323-"0325,"032E-"0332,"0338,
                    "0391-"0393,"0395-"03A1,"03A3-"03A8,"03B1-"03BB,
                    "03BD-"03C1,"03C3-"03C9,"03D1,"03D5-"03D6,"03F5,
                    "2016,"2018-"2019,"2021,"2026-"202C,"2032-"2037,"2044,
                    "2057,"20D6-"20D7,"20DB-"20DD,"20E1,"20EE-"20EF,
                    "210B-"210C,"210E-"2113,"2118,"211B-"211C,"2126-"2128,
                    "212C-"212D,"2130-"2131,"2133,"2135,"2190-"2199,
                    "21A4,"21A6,"21A9-"21AA,"21BC-"21CC,"21D0-"21D5,
                    "2200,"2202-"2209,"220B-"220C,"220F-"2213,"2215-"221E,
                    "2223,"2225,"2227-"222E,"2234-"2235,"2237-"223D,
                    "2240-"224C,"2260-"2269,"226E-"2279,"2282-"228B,"228E,
                    "2291-"2292,"2295-"2299,"22A2-"22A5,"22C0-"22C5,
                    "22DC-"22DD,"22EF,"22F0-"22F1,
                    "2308-"230B,"2320-"2321,"2329-"232A,"239B-"23AE,
                    "23DC-"23DF,
                    "27E8-"27E9,"27F5-"27FE,"2A0C,"2B1A,
                    "1D400-"1D433,"1D49C,"1D49E-"1D49F,"1D4A2,"1D4A5-"1D4A6,
                    "1D4A9-"1D4AC,"1D4AE-"1D4B5,"1D4D0-"1D4E9,"1D504-"1D505,
                    "1D507-"1D50A,"1D50D-"1D514,"1D516-"1D51C,"1D51E-"1D537,
                    "1D56C-"1D59F,"1D6A8-"1D6B8,"1D6BA-"1D6D2,"1D6D4-"1D6DD,
                    "1D6DF,"1D6E1,"1D7CE-"1D7D7
                   }]{Neo Euler}
\setmathfont[range=up/{greek,Greek}, script-features={}, sscript-features={}
            ]{Neo Euler}
\setmathfont[range=up/{latin,Latin,num}, script-features={}, sscript-features={}
            ]{Neo Euler}

\begin{document}

\begin{theorem}[Residue theorem]
  Let $f$ be analytic in the region $G$ except for the isolated
  singularities $a_1,a_2,\dots,a_m$. If $\gamma$ is a closed
  rectifiable curve in $G$ which does not pass through any of the
  points $a_k$ and if $\gamma\approx 0$ in $G$, then
  \[
    \frac{1}{2\symup{\pi i}} \int\limits_\gamma f\Bigl(x^{\mathbf{N}\in\mathbb{C}^{N\times 10}}\Bigr)
    = \sum_{k=1}^m n(\gamma;a_k)\Res(f;a_k)\,.
  \]
\end{theorem}

\begin{theorem}[Maximum modulus]
  Let $G$ be a bounded open set in $\BbbC$ and suppose that $f$ is a
  continuous function on $G^-$ which is analytic in $G$. Then
  \[
    \max\{\, |f(z)|:z\in G^- \,\} = \max\{\, |f(z)|:z\in \partial G \,\}\,.
  \]
\end{theorem}

First some large operators both in text:
$\iiint\limits_{Q}f(x,y,z) \diff x \diff y \diff z$
and
$\prod_{\gamma\in\Gamma_{\bar{C}}}\partial(\tilde{X}_\gamma)$;\
and also on display
\[
  \iiiint\limits_{Q}f(w,x,y,z) \diff w \diff x \diff y \diff z
  \leq
  \oint_{\partial Q} f'\Biggl(\max\Biggl\{
  \frac{\Vert w\Vert}{\vert w^2+x^2\vert};
  \frac{\Vert z\Vert}{\vert y^2+z^2\vert};
  \frac{\Vert w\oplus z\Vert}{\vert x\oplus y\vert}
  \Biggr\}\Biggr)\,.
\]
\end{document}

Neo Euler with CMU Concrete, classic style

This is a variant of the classic “Survey of Free Math Fonts for TeX and LaTeX.”

Extending to ISO Style with Concrete

If you want to get the full range of math alphabets, you would need to kitbash the Euler math font with others to supply the missing glyphs. Here is a version that selects ISO style (upright sum and product symbols, constants π and i, and numerals; Italic Γ function and variables), retains the upright ∂ from Neo Euler, keeps all the math alphabets that exist in Neo Euler (except the digits, which ought to match the text font and have bad spacing as superscripts anyway), and supplies the missing pieces of itbfbfup and bfit from the CMU Concrete family.

\unimathsetup{math-style=ISO, partial=upright, nabla=upright}
\setmainfont{CMU Concrete}
\defaultfontfeatures{Scale=MatchLowercase}
\setmathfont{Libertinus Math}
\setmathfont[range={"0000-"0001,"0020-"007E,
                    "00A0,"00A7-"00A8,"00AC,"00AF,"00B1,"00B4-"00B5,"00B7,
                    "00D7,"00F7,
                    "0131,
                    "0237,"02C6-"02C7,"02D8-"02DA,"02DC,
                    "0300-"030C,"030F,"0311,"0323-"0325,"032E-"0332,"0338,
                    "0391-"0393,"0395-"03A1,"03A3-"03A8,"03B1-"03BB,
                    "03BD-"03C1,"03C3-"03C9,"03D1,"03D5-"03D6,"03F5,
                    "2016,"2018-"2019,"2021,"2026-"202C,"2032-"2037,"2044,
                    "2057,"20D6-"20D7,"20DB-"20DD,"20E1,"20EE-"20EF,
                    "210B-"210C,"210E-"2113,"2118,"211B-"211C,"2126-"2128,
                    "212C-"212D,"2130-"2131,"2133,"2135,"2190-"2199,
                    "21A4,"21A6,"21A9-"21AA,"21BC-"21CC,"21D0-"21D5,
                    "2200,"2202-"2209,"220B-"220C,"220F-"2213,"2215-"221E,
                    "2223,"2225,"2227-"222E,"2234-"2235,"2237-"223D,
                    "2240-"224C,"2260-"2269,"226E-"2279,"2282-"228B,"228E,
                    "2291-"2292,"2295-"2299,"22A2-"22A5,"22C0-"22C5,
                    "22DC-"22DD,"22EF,"22F0-"22F1,
                    "2308-"230B,"2320-"2321,"2329-"232A,"239B-"23AE,
                    "23DC-"23DF,
                    "27E8-"27E9,"27F5-"27FE,"2A0C,"2B1A,
                    "1D400-"1D433,"1D49C,"1D49E-"1D49F,"1D4A2,"1D4A5-"1D4A6,
                    "1D4A9-"1D4AC,"1D4AE-"1D4B5,"1D4D0-"1D4E9,"1D504-"1D505,
                    "1D507-"1D50A,"1D50D-"1D514,"1D516-"1D51C,"1D51E-"1D537,
                    "1D56C-"1D59F,"1D6A8-"1D6B8,"1D6BA-"1D6D2,"1D6D4-"1D6DD,
                    "1D6DF,"1D6E1,"1D7CE-"1D7D7
                   }]{Neo Euler}
\setmathfont[range=up/{greek,Greek}, script-features={}, sscript-features={}
            ]{Neo Euler}
\setmathfont[range=up/{latin,Latin,num}, script-features={}, sscript-features={}
            ]{Neo Euler}
\setmathfont[range=up/num]{CMU Concrete}
\setmathfont[range=it/{latin,Latin,greek,Greek}]{CMU Concrete Italic}
\setmathfont[range=bfup/{Greek}]{CMU Concrete Bold}
\setmathfont[range=bfit/{latin,Latin,greek,Greek}]{CMU Concrete Bold Italic}

Neo Euler with CMU Concrete, ISO style

Euler plus Palatino (My Personal Favorite)

Here is the version that, after a lot of trial and error, I like the best.

Another common recommendation, including in the earlier answer, is to combine Euler math symbols with Palatino text. It sets the text font to Palatino, or one of its many clones, in this case Pagella (although you might have the original Palatino or Palatino Linotype). It then fills in all the missing parts of Neo Euler with another Palatino clone, Asana Math. It sets up \mathcalas Euler Script, \mathbfcal from the alternate style of Asana, \mathbb from Latin Modern Math (more legible and more similar to classic amsfonts), digits from Asana (as these need to match the main text) and all other symbols not defined in Euler from Asana.

We now have complete coverage of all Unicode math symbols, which allows us to set this example in ISO style. This uses italic math letters as the default, including uppercase Greek such as the Gamma function, but leaves symbols such as ∑ and ∏ intact and sets constants such as 2πi in the denominator as upright. (Observe that unicode-math is smart enough to set \symup{\pi i} as Euler and \mathrm and operator names in the text font.) It keeps the upright partial derivative and nabla, as Euler does not define cursive forms.

You can change back to math-style=upright to get a more classic look that still allows you to use all the math alphabets.

\unimathsetup{math-style=ISO, partial=upright, nabla=upright}
\setmainfont{TeX Gyre Pagella}
\defaultfontfeatures{Scale=MatchLowercase}
\setmathfont{Asana Math}
\setmathfont[range={"0000-"0001,"0020-"007E,
                    "00A0,"00A7-"00A8,"00AC,"00AF,"00B1,"00B4-"00B5,"00B7,
                    "00D7,"00F7,
                    "0131,
                    "0237,"02C6-"02C7,"02D8-"02DA,"02DC,
                    "0300-"030C,"030F,"0311,"0323-"0325,"032E-"0332,"0338,
                    "0391-"0393,"0395-"03A1,"03A3-"03A8,"03B1-"03BB,
                    "03BD-"03C1,"03C3-"03C9,"03D1,"03D5-"03D6,"03F5,
                    "2016,"2018-"2019,"2021,"2026-"202C,"2032-"2037,"2044,
                    "2057,"20D6-"20D7,"20DB-"20DD,"20E1,"20EE-"20EF,
                    "210B-"210C,"210E-"2113,"2118,"211B-"211C,"2126-"2128,
                    "212C-"212D,"2130-"2131,"2133,"2135,"2190-"2199,
                    "21A4,"21A6,"21A9-"21AA,"21BC-"21CC,"21D0-"21D5,
                    "2200,"2202-"2209,"220B-"220C,"220F-"2213,"2215-"221E,
                    "2223,"2225,"2227-"222E,"2234-"2235,"2237-"223D,
                    "2240-"224C,"2260-"2269,"226E-"2279,"2282-"228B,"228E,
                    "2291-"2292,"2295-"2299,"22A2-"22A5,"22C0-"22C5,
                    "22DC-"22DD,"22EF,"22F0-"22F1,
                    "2308-"230B,"2320-"2321,"2329-"232A,"239B-"23AE,
                    "23DC-"23DF,
                    "27E8-"27E9,"27F5-"27FE,"2A0C,"2B1A,
                    "1D400-"1D433,"1D49C,"1D49E-"1D49F,"1D4A2,"1D4A5-"1D4A6,
                    "1D4A9-"1D4AC,"1D4AE-"1D4B5,"1D4D0-"1D4E9,"1D504-"1D505,
                    "1D507-"1D50A,"1D50D-"1D514,"1D516-"1D51C,"1D51E-"1D537,
                    "1D56C-"1D59F,"1D6A8-"1D6B8,"1D6BA-"1D6D2,"1D6D4-"1D6DD,
                    "1D6DF,"1D6E1,"1D7CE-"1D7D7
                   }]{Neo Euler}
\setmathfont[range=up/{greek,Greek}, script-features={}, sscript-features={}
            ]{Neo Euler}
\setmathfont[range=up/{latin,Latin}, script-features={}, sscript-features={}
            ]{Neo Euler}
\setmathfont[range={bfup/{latin, Latin, greek, Greek}, frak, bffrak, cal},
             script-features={}, sscript-features={}
            ]{Neo Euler}
\setmathfont[range={up/num, bfup/num, it, bfit, scr, bfscr,
                    sfup, sfit, bfsfup, bfsfit, tt}
            ]{Asana Math}
\setmathfont[range=bfcal, Scale=MatchUppercase, Alternate]{Asana Math}
\setmathfont[range=bb, Scale=MatchUppercase]{Latin Modern Math}

Neo Euler plus Asana plus Latin Modern with Pagella

Euler Symbols, Palatino Letters

This alternative uses use only the math symbols from Neo Euler and overwrite all its math alphabets, for the most consistency between text and math modes.

\unimathsetup{math-style=ISO, partial=upright, nabla=upright}
\setmainfont{TeX Gyre Pagella}
\defaultfontfeatures{Scale=MatchLowercase}
\setmathfont{Asana Math}
\setmathfont[range={"0000-"0001,"0020-"007E,
                    "00A0,"00A7-"00A8,"00AC,"00AF,"00B1,"00B4-"00B5,"00B7,
                    "00D7,"00F7,
                    "0131,
                    "0237,"02C6-"02C7,"02D8-"02DA,"02DC,
                    "0300-"030C,"030F,"0311,"0323-"0325,"032E-"0332,"0338,
                    "0391-"0393,"0395-"03A1,"03A3-"03A8,"03B1-"03BB,
                    "03BD-"03C1,"03C3-"03C9,"03D1,"03D5-"03D6,"03F5,
                    "2016,"2018-"2019,"2021,"2026-"202C,"2032-"2037,"2044,
                    "2057,"20D6-"20D7,"20DB-"20DD,"20E1,"20EE-"20EF,
                    "210B-"210C,"210E-"2113,"2118,"211B-"211C,"2126-"2128,
                    "212C-"212D,"2130-"2131,"2133,"2135,"2190-"2199,
                    "21A4,"21A6,"21A9-"21AA,"21BC-"21CC,"21D0-"21D5,
                    "2200,"2202-"2209,"220B-"220C,"220F-"2213,"2215-"221E,
                    "2223,"2225,"2227-"222E,"2234-"2235,"2237-"223D,
                    "2240-"224C,"2260-"2269,"226E-"2279,"2282-"228B,"228E,
                    "2291-"2292,"2295-"2299,"22A2-"22A5,"22C0-"22C5,
                    "22DC-"22DD,"22EF,"22F0-"22F1,
                    "2308-"230B,"2320-"2321,"2329-"232A,"239B-"23AE,
                    "23DC-"23DF,
                    "27E8-"27E9,"27F5-"27FE,"2A0C,"2B1A,
                    "1D400-"1D433,"1D49C,"1D49E-"1D49F,"1D4A2,"1D4A5-"1D4A6,
                    "1D4A9-"1D4AC,"1D4AE-"1D4B5,"1D4D0-"1D4E9,"1D504-"1D505,
                    "1D507-"1D50A,"1D50D-"1D514,"1D516-"1D51C,"1D51E-"1D537,
                    "1D56C-"1D59F,"1D6A8-"1D6B8,"1D6BA-"1D6D2,"1D6D4-"1D6DD,
                    "1D6DF,"1D6E1,"1D7CE-"1D7D7
            }]{Neo Euler}
\setmathfont[range={up/{latin, Latin, greek, Greek, num},
                    it, bfup, bfit, bb, bbit, scr, bfscr, frak, bffrak,
                    sfup, sfit, bfsfup, bfsfit, tt }
            ]{Asana Math}
\setmathfont[Alternate, range={cal, bfcal}]{Asana Math}

Neo Euler/Asana Math Kitbash with Pagella

Backward-Compatiblity with PDFTeX

If you cannot use unicode-math, it is still possible to get Type 1 fonts, bold math symbols, upright Greek, and more. Here is a sample:

\documentclass{article}
\pagestyle{empty}

\usepackage{amsmath}
\DeclareMathOperator\Res{Res}
\newcommand*\diff{\mathop{}\!\mathrm{d}}

\usepackage{amsthm}
\newtheorem{theorem}{Theorem}

%%%
% Set up you text and math fonts
%%%

\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{ccfonts}
\usepackage{eucal}
\usepackage{eufrak}
\usepackage{eulervm}

\newcommand\BbbC{\ensuremath{\mathbb{C}}}
\DeclareSymbolFont{eulerup}{U}{zeur}{m}{n}
\DeclareMathSymbol{\uppi}{\mathord}{eulerup}{"19}
\DeclareMathSymbol{\upi}{\mathord}{eulerup}{"69}

\begin{document}

\begin{theorem}[Residue theorem]
  Let $f$ be analytic in the region $G$ except for the isolated
  singularities $a_1,a_2,\dots,a_m$. If $\gamma$ is a closed
  rectifiable curve in $G$ which does not pass through any of the
  points $a_k$ and if $\gamma\approx 0$ in $G$, then
  \[
    \frac{1}{2 \uppi \upi} \int\limits_\gamma f\Bigl(x^{\mathbold{N}\in\mathbb{C}^{N\times 10}}\Bigr)
    = \sum_{k=1}^m n(\gamma;a_k)\Res(f;a_k)\,.
  \]
\end{theorem}

\begin{theorem}[Maximum modulus]
  Let $G$ be a bounded open set in $\BbbC$ and suppose that $f$ is a
  continuous function on $G^-$ which is analytic in $G$. Then
  \[
    \max\{\, |f(z)|:z\in G^- \,\} = \max\{\, |f(z)|:z\in \partial G \,\}\,.
  \]
\end{theorem}

First some large operators both in text:
$\iiint\limits_{Q}f(x,y,z) \diff x \diff y \diff z$
and
$\prod_{\gamma\in\Gamma_{\bar{C}}}\partial(\tilde{X}_\gamma)$;\
and also on display
\[
  \iiiint\limits_{Q}f(w,x,y,z) \diff w \diff x \diff y \diff z
  \leq
  \oint_{\partial Q} f'\Biggl(\max\Biggl\{
  \frac{\Vert w\Vert}{\vert w^2+x^2\vert};
  \frac{\Vert z\Vert}{\vert y^2+z^2\vert};
  \frac{\Vert w\oplus z\Vert}{\vert x\oplus y\vert}
  \Biggr\}\Biggr)\,.
\]

\end{document}

Note that \mathrm selects the text font and \mathbf doesn’t work, so I instead define \uppi and \upi (\mathnormal would work until you changed the math font to something other than Euler, whereas these select upright Greek letters from Euler in any document) and use the \mathbold command from eulervm.

eulervm with ccfonts

Avatar_small
전설 서구 说:
2021年3月02日 01:03

Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though. 123 movies

Avatar_small
KSEB Bill 说:
2022年8月06日 22:15

Kerala State Electricity Board formed by Kerala State Government under the Electricity act 1948. KSEB determined to generate, transmit and distribute the electricity in the regions of Kerala State. As a customer, you can use the KSEB online payment of the electricity department to update your pending dues for the electricity used. KSEB Bill The bill may generat every month based on the reading grabbed from the electric meter fixed in your place that can be commercial or domestic. It is to remember that the price tag for the commercial and domestic is different even if the units shown are similar. As well, the payment to Kerala State Electricity board needs to pay on time to have a smooth service.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter