How to change the English fonts in Elegantbook ?
ZhangWay1024 opened this issue · 3 comments
First of all, the Elegantbook template is so awesome in all ways, but somehow I just want to use some other English fonts in my book, such as 'EBGaramond'. I also used \usepackage{ebgaramond}
in my code, but it did not work. Thus I want ask is there any way to achive my goal?
We use newtxtext
package for (pdf)latex
compiler, and in newtxtext.sty
, there is an \AtEndPreamble
patch:
\AtEndPreamble{%
...
\renewcommand*{\rmdefault}{ntx\ntx@figurealign%
\ntx@figurestyle}
...
}
So the font settings of ebgaramond
package are overwritten, and then the text font won't be set to ebgaramond.
How To Fix
- You can use
xelatex
to compile your document, in this caseebgaramond
's\setmainfont
overwritesnewtxtext
's; - Accroding to https://tex.stackexchange.com/a/39418/180617, you can use
\makeatletter
\@namedef{ver@newtxtext.sty}{9999/12/31}
\makeatother
before \documentclass[...]{elegantbook}
, which is saying
\makeatletter
\@namedef{ver@newtxtext.sty}{9999/12/31}
\makeatother
\documentclass[11pt]{elegantbook}
\usepackage{ebgaramond}
...
Maybe we should add a cls option that allows authors to define English fonts themselves, behaving like chinesefont=none
? @EthanDeng
We use
newtxtext
package for(pdf)latex
compiler, and innewtxtext.sty
, there is an\AtEndPreamble
patch:\AtEndPreamble{% ... \renewcommand*{\rmdefault}{ntx\ntx@figurealign% \ntx@figurestyle} ... }
So the font settings of
ebgaramond
package are overwritten, and then the text font won't be set to ebgaramond.How To Fix
- You can use
xelatex
to compile your document, in this caseebgaramond
's\setmainfont
overwritesnewtxtext
's;- Accroding to https://tex.stackexchange.com/a/39418/180617, you can use
\makeatletter \@namedef{ver@newtxtext.sty}{9999/12/31} \makeatother
before
\documentclass[...]{elegantbook}
, which is saying\makeatletter \@namedef{ver@newtxtext.sty}{9999/12/31} \makeatother \documentclass[11pt]{elegantbook} \usepackage{ebgaramond} ...
Thank you for you replying!