A Tex/Latex Enthusiast's View
Total Page:16
File Type:pdf, Size:1020Kb
LATEX&friends course in Helsinki a TEX/LATEX enthusiast’s view Gaetano Zanghirati University of Ferrara, Italy in cooperation with DOMAST Doctoral School in Mathematics and Statistics Helsinki, May 2019 Customizing Customizing font style and dimension Handle and creating counters for equations, theorems, sections, notes, . Customizing theorems and sections style Designing or modifying a Beamer template Customizing the template of a Beamer presentation A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Customizing font style and dimension Originally, D. Knuth conceived TEX to use its own font system: METAFONT Default font family for TEX & Co.: Computer Modern Features: high quality, scalable, wide range of typographical fine tuning capabilities(Curves geometrical description) tex compilers allow use of other fonts too There exist many different font types, such as: PS Type1: outline fonts(vector graphics), commonly used by pdftex/pdflatex Bitmap: raster graphics, usually have very poor quality (easily seen by zooming or printing) PS Type3: superset of Type1 with more functionalities from Postscript( e.g., in the TEX world, Type3 fonts are often used to embed bitmap fonts) Vector font Raster font A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Latin Modern vs super Computer Modern Fonts get generated the first time they are required (it takes unusually long compilation time) METAFONT is internally a quite complex font system Most popular font systems are Truetype font (ttf) and OpenType font (otf) Modern compilers (e.g., xetex and luatex) allow to make use of such popular fonts in LATEX documents With the standard compilers, those font types must first be converted (e.g., to Type1) to be available to LATEX Newest and improved versions have been developed during the years to exploit the technological advances of the devices (monitor, printers, beamers, . ) A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Latin Modern vs super Computer Modern Both Latin Modern (lmodern) and super Computer Modern (cm-super) are derived from Computer Modern (cm) font. cm-super is a vectorization of cm bitmap fonts, but mainly automatically done The vectorization of Latin Modern is “handmade” Latin Modern has revised metrics Latin Modern provides more glyphs, especially diacritical characters (72 text fonts, each one containing > 700 glyphs, and 20 math fonts) cm-super comes with more fonts but fewer glyphs Latin Modern development goes on. [Stefan Kottwitz, StackExchange-TeX, 2010] A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Latin Modern vs super Computer Modern Both are easy to use in any modern TEX distribution. cm-super takes up more space in the distribution, but lmodern generally takes up more space in the generated PDF (lmodern uses font subroutines, which all must be put in the PDF) lmodern is available in the same optical sizes as Computer Modern, cm-super is available in more optical sizes, but. ... cm-super should be used with the fix-cm package to fix a lot of broken design decisions (and to make the final PDF a bit smaller), which unfortunately, prevent to use most of the additional sizes Neither cm-super nor lmodern are as well-hinted (for onscreen reading) as the BlueSky Computer Modern fonts. Hinting is simply too hard to get right and the lmodern developers don’t focus on it Neither cm-super nor lmodern will give exactly identical page breaks as the traditional Computer Modern, but lmodern will be closer [Lev Bishop, Martin Scharrer, StackExchange-TeX, 2010, 2012] A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Font logical structure Font family: Roman (serif, rm) Sans serif (sf) Monospace (tt) Font series (= width & weight) Font shape Font size Font structure (declarative form): Families: Computer Modern, Times, Arial, Courier, . Categories: \rmdefault, \sfdefault, \ttdefault Series: boldface (\bfseries), medium (\mdseries), light, . Shape: italic (\itshape), slanted (\slshape), small caps (\scshape), upright (\upshape), outline, shaded, . Example: \renewcommand{\familydefault}{\rmdefault} Changing font: 1) select the family to change, 2) choose the new family Example: \renewcommand*{\rmdefault}{ppl}% Palatino Font switches: \normalfont, \rmfamily, \sffamily, \ttfamily A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Font logical structure Terminology for font families attributes: weight: thickness of the strokes that constitute its glyphs width: “horizontal” size of each glyph, relative to its height series: combination of weight and width shape: variant of the geometrical aspect of a given typeface (upright, italic,. ) size: the size at which the glyphs are expected to be view/printed if no zooming is applied optical size: the size range the typeface is designed for Remember: (type designers have found that) the most visually appealing fonts are ones that are designed for a particular size range, not a given font arbitrary scaled up and down 0 The installation and use of OpenType fonts in LATEX", John D. Owens, TUGboat 27 (2006), 112–119. A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Font logical structure Command form: \textmd, \textbf, \textit, \textsl, \textsc, \textup, \emph, ... intended to be used in normal text have the advantage of maintaining consistency with other LATEX construct (e.g., automatically take care of italic corrections) intended to typeset short pieces of text in a specific font A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Font sizes Traditionally measured in printer points (pt): 1” = 72.27 pt ≈ 0.35mm (for PostScript 1” = 72 pt = 1 bp) n TEX/LATEX: sizes available as (1:2) (\magstep...) Nowadays: either 6,7,8,. ,12,14,. ,20,24,30,36 or only one vectorized (scalable) design size Arbitrarily scalable fonts give not always best-looking results, because of human eyes perception (which is nonlinear) 10 predefined font sizes: \tiny tiny \Large Large \scriptsize script \LARGE LARGE \footnotesize footnote \huge \small small huge \normalsize normal \Huge \large large Huge A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Actual font sizes Standard classes AMS classes, (except Beamer) memoir Size 10pt 11pt 12pt 10pt 11pt 12pt Beamer \tiny 5 6 6 6 7 8 13:82 \scriptsize 7 8 8 7 8 9 16:59 \footnotesize 8 9 10 8 9 10 16:59 \small 9 10 10:95 9 10 10:95 16:59 \normalsize 10 10:95 12 10 10:95 12 19:907 \large 12 12 14:44 10:95 12 14:4 23:89 \Large 14:4 14:4 17:28 12 14:4 17:28 28:66 \LARGE 17:28 17:28 20:74 14:4 17:28 20:74 34:40 \huge 20:74 20:74 24:88 17:28 20:74 24:88 41:28 \Huge 24:88 24:88 24:88 20:74 24:88 24:88 41:28 A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Font default hooks and character access Hook Default Description \encodingdefault OT1 econdigng scheme for “main font” \familydefault \rmdefault family selected for “main font” \seriesdefault m series selected for “main font” \shapedefault n shape selected for “main font” \rmdefault cmr family selected by \rmfamily and \textrm \sfdefault cmss family selected by \sffamily and \textsf \ttdefault cmtt family selected by \ttfamily and \texttt \bfdefault bx series selected by \bfseries and \textbf \mddefault m series selected by \mdseries and \textmd \itdefault it shape selected by \itshape and \textit \sldefault sl shape selected by \slshape and \textsl \scdefault sc shape selected by \scshape and \textsc \updefault n shape selected by \upshape and \textup Accessing specific characters in the selected font: \fontencoding{T1}\selectfont \symbol{215} ! Œ; \symbol{’237} ! §; \symbol{"DE} ! Þ A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Font-changing commands in math Different mechanism: text font change commands give errors TEX and LATEX distinguish between 8 types of math chars (to correctly account for appropriate spacing) Two classes: symbols and alphabet characters Some entered from keyboard (most of the alphabet chars: f , W , . ), others given by commands (most of the symbols: \geq ≥, \int , \partial @,...) PredefinedR math alphabet identifiers: Hook Source code Effect \mathcal $\mathcal{T} \gets\{t\}$ T ftg \mathrm $\mathrm{supp}(S) \to [0,1]$ supp(S) ! [0; 1] \mathbf $\mathbf{v} = (1,0,2)^T$ v = (1; 0; 2)T 1 \mathsf $\mathsf{H}(3,2) = \frac{1}{4}$ H(3; 2) = 4 \mathtt $\mathtt{Rq} \leq \Gamma$ Rq ≤ Γ \mathnormal $\mathnormal{zt} \approx \varphi$ zt ≈ ' \mathit $displ \neq \mathit{offset}$ displ 6= offset A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 So many fonts available!! http://www.tug.dk/FontCatalogue/ Serif families Cursive fonts Abbrv. Name Abbrv. Name cmr Computer Modern Roman (default) pzc Zapf Chancery lmr Latin Modern Roman pbk Bookman Math-dedicated fonts bch Charter Abbrv. Name pnc New Century Schoolbook cmm Computer Modern ppl Palatino (math italic) ptm Times cmsy Computer Modern beramono BitStream Vera Mono (math symbols) luximono Luxi Mono zplm Palatino (math) Sans serif families Typewriter families Abbrv. Name Abbrv. Name cmss Computer Modern Sans Serif cmtt Computer Modern Typewriter (default) (default) lmss Latin Modern Sans Serif lmtt Latin Modern pag Avant Garde pcr Courier phv Helvetica A course on LaTeX&friends .:. G. Zanghirati & DOMAST .:. Helsinki, May 2019 Fonts: evolution Knuth’s Computer Modern fonts were originally encoded in 7 bits format (128 chars): they didn’t support accented glyphs. Consequence: accented characters, created via the \accent TEX primitive, broke non-English-words hyphenation algorithm 1989: re-implementation as 8-bit-based encoding (256 chars), both internally and externally 1990: European Computer Modern (EC) fonts. Implementation: cm-super package, suppoting many encodings (T1, TS1, T2A, T2B, T2C, X2) EC fonts: not completely satisfactory re-implementation of CM fonts. Solution: the fix-cm package: Latin Modern are the Type 1 (T1) PostScript successors of Knuth’s Computer Modern fonts, with a lot of diacritical chars available (meeting almost all European Latin-based languages) and Latin Modern Math fonts.