Debian Codegraph @

texmf-dist/doc/latex/einfart/README.md

raw
1 <!-- Copyright (C) 2021-2026 by Jinwen XU -->
2
3 # `einfart` : write you articles in a simple and clear way
4
5 > **New documentations are still being written. For now, only the core code is included in TeX Live and MiKTeX (old documentations have been removed from the distribution).**
6
7 `einfart` is a LaTeX class for typesetting articles, which has a simple and clear design.
8
9 Currently, it has native support to Chinese (simplified and traditional), English, French, German, Italian, Japanese, Portuguese (European and Brazilian), Russian and Spanish typesetting. And it may compile with either XeLaTeX or LuaLaTeX.
10
11 This is part of the `minimalist` class series.
12
13 > Package dependencies: [`amsfonts`](https://ctan.org/pkg/amsfonts), [`caption`](https://ctan.org/pkg/caption), [`ctex`](https://ctan.org/pkg/ctex), [*`draftwatermark`*](https://ctan.org/pkg/draftwatermark), [`embrac`](https://ctan.org/pkg/embrac), [`float`](https://ctan.org/pkg/float), [`fontspec`](https://ctan.org/pkg/fontspec), [`geometry`](https://ctan.org/pkg/geometry), [`graphicx`](https://ctan.org/pkg/graphicx), [`indentfirst`](https://ctan.org/pkg/indentfirst), [*`kpfonts-otf`*](https://ctan.org/pkg/kpfonts-otf), [*`lua-widow-control`*](https://ctan.org/pkg/lua-widow-control), [*`mathpazo`*](https://ctan.org/pkg/mathpazo), [`minimalist`](https://ctan.org/pkg/minimalist), [*`nowidow`*](https://ctan.org/pkg/nowidow), [`parskip`](https://ctan.org/pkg/parskip), [`projlib`](https://ctan.org/pkg/projlib), [`regexpatch`](https://ctan.org/pkg/regexpatch), [`silence`](https://ctan.org/pkg/silence), [`tikz-cd`](https://ctan.org/pkg/tikz-cd), [`unicode-math`](https://ctan.org/pkg/unicode-math), [`wrapfig2`](https://ctan.org/pkg/wrapfig2).
14
15 ## Features
16
17 Compared with usual document classes, it has the following features:
18
19 - Several carefully designed styles.
20 - Native multilingual support: Chinese (simplified and traditional), English, French, German, Italian, Japanese, Portuguese (European and Brazilian), Russian and Spanish.
21 > In particular, for simplified Chinese, traditional Chinese and Japanese, the fonts of the corresponding glyphs can be automatically switched.
22 - Ready-to-use theorem-type environments, with clever referencing supported.
23 - Support both the standard and the AMS writing fashion.
24 - ... and much more...
25
26 ## To get started
27
28 Prepration:
29
30 - Make sure that your TeX distribution is up-to-dated.
31 - Check the required fonts indicated below, and make sure that they are installed.
32
33 Once prepared:
34
35 - You may get started by looking at one of the [demo documents](https://github.com/Jinwen-XU/minimalist/tree/main/einfart/demo) that suits your need and edit the code there to get your own template.
36
37 If you run into a problem, or if you would like some elements to be changed or improved:
38
39 - Feel free to raise an issue or post a feature request via [the GitHub issue](https://github.com/Jinwen-XU/minimalist/issues).
40
41 ## Required fonts
42
43 The current document class requires the following open-source fonts that are not included in the standard TeX collection:
44
45 - The Source Han font series at [Adobe Fonts](https://github.com/adobe-fonts). More specifically:
46 - Source Han Serif, [go to its Release page](https://github.com/adobe-fonts/source-han-serif/releases).
47 - Source Han Sans, [go to its Release page](https://github.com/adobe-fonts/source-han-sans/releases).
48 - Source Han Mono, [go to its Release page](https://github.com/adobe-fonts/source-han-mono/releases).
49 > It is recommended to download the Super-OTC version, so that the download size would be smaller.
50
51 ## Improvements to the current font configuration
52
53 > The code in this section is rather experimental and may constantly get changed. The author uses these lines of code in his daily documents, but since it involves non-free fonts and/or uses complex Lua patches, the code below cannot be integrated into the published version.
54
55 If you are willing to use LuaLaTeX, then the following aspects may help you further improve the current font configuration.
56
57 - If you have the font `Palatino Linotype` installed, then replacing the default `TeXGyrePagellaX` using the following code gives you slightly better result:
58 ```latex
59 \directlua
60 {
61 fonts.handlers.otf.addfeature
62 {
63 name = "palatino-linotype-fix",
64 type = "kern",
65 data =
66 {
67 ["r"] = { ["ê"] = 120 },
68 ["v"] = { ["ê"] = 180 },
69 ["w"] = { ["ê"] = 180 },
70 ["y"] = { ["ê"] = 180 },
71 },
72 }
73 }
74 \setmainfont{Palatino Linotype}
75 [
76 Numbers = OldStyle ,
77 RawFeature = +palatino-linotype-fix
78 ]
79 ```
80 - If you have the font `Palatino Sans LT Pro` installed, then replacing the default `mathsf` font with this gives more pleasant visual effect:
81 ```latex
82 \setmathsf{Palatino Sans LT Pro}
83 \setmathfont{PalatinoSansLTPro-LightIta}[range=sfit]
84 ```
85 - The default configuration for math fonts has some imperfections. The following code helps to improve it. But for this you need to modify the `.cls` file itself and then maintain your local version of it. Here is how:
86 - First, add this definition at the beginning of the font configuration.
87 ```latex
88 \ExplSyntaxOff
89 % https://tex.stackexchange.com/a/505003
90 \def\mathkern@fix@for@lua
91 {
92 \directlua
93 {
94 local mathkerns = {
95 ["Asana-Math"] = {
96 [0x1D447] = {% T
97 bottomright = {
98 {height=0,kern=-120},
99 },
100 },
101 [0x1D449] = {% V
102 bottomright = {
103 {height=0,kern=-120},
104 },
105 },
106 [0x1D44A] = {% W
107 bottomright = {
108 {height=0,kern=-30},
109 },
110 },
111 [0x1D453] = {% f
112 bottomright = {
113 {height=0,kern=-135},
114 },
115 },
116 [0x1D44F] = {% b
117 topright = {
118 {height=0,kern=75},
119 },
120 },
121 },
122 ["KpMath-Regular"] = {
123 [0x1D6FD] = {% \beta
124 bottomright = {
125 {height=0,kern=30},
126 },
127 },
128 [0x1D6FF] = {% \delta
129 bottomright = {
130 {height=0,kern=30},
131 },
132 },
133 [0x1D702] = {% \eta
134 bottomright = {
135 {height=0,kern=30},
136 },
137 },
138 [0x1D703] = {% \theta
139 bottomright = {
140 {height=0,kern=10},
141 },
142 },
143 [0x1D714] = {% \omega
144 bottomright = {
145 {height=0,kern=30},
146 },
147 },
148 },
149 }
150 local function initmathkern(tfmdata)
151 local values = mathkerns[tfmdata.properties.psname]
152 if not values then return end
153 for cp, value in next, values do
154 local tcp = type(cp)
155 if tcp == 'string' then
156 cp = tfmdata.resources.unicodes[cp]
157 end
158 local char = tfmdata.characters[cp]
159 if char then
160 local mathkern = char.mathkerns
161 if not mathkern then
162 mathkern = {}
163 char.mathkerns = mathkern
164 end
165 for corner, v in next, value do
166 mathkern[corner] = v
167 end
168 end
169 end
170 end
171 fonts.constructors.newfeatures'otf'.register{
172 name = 'mathkern',
173 description = 'Overwrite mathkern values',
174 initializers = {
175 base = initmathkern,
176 },
177 }
178 }
179 }
180 \ExplSyntaxOn
181 ```
182 - Then, just before `\RequirePackage { unicode-math }`, add these lines:
183 ```latex
184 \sys_if_engine_luatex:T
185 {
186 \mathkern@fix@for@lua
187 }
188 ```
189 - Finally, replace `\setmathfont { KpMath-Regular.otf }` with `\setmathfont [ RawFeature = mathkern ] { KpMath-Regular.otf }`, and replace
190 ```latex
191 \setmathfont { texgyrepagella-math.otf }
192 [
193 range = { it / { Latin, latin }, bfit / { Latin, latin }, up / num, bfup / num }
194 ]
195 ```
196 with
197 ```latex
198 \setmathfont [ RawFeature = mathkern ] { Asana-Math.otf }
199 [
200 range = { it / { Latin, latin }, bfit / { Latin, latin }, up / num, bfup / num }
201 ]
202 ```
203
204 # License
205
206 This work is released under the LaTeX Project Public License, v1.3c or later.
207