%!TEX TS-program = luatex %###################################### % FONTS % EB Garamond https://bitbucket.org/georgd/eb-garamond/downloads/ % Sorts Mill Goudy http://www.fontsquirrel.com/fonts/sorts-mill-goudy %###################################### \input luaotfload.sty \input eplain \beginpackages \usepackage{url} \usepackage{color} \usepackage{graphicx}% for the \XeTeX logo \endpackages \enablehyperlinks \input soul.sty %###################################### % code to provide backward compatibility with versions % of LuaTeX prior to v 0.85 \ifnum\luatexversion>84 \def\pdfinfo{\pdfextension info} \def\pdfcatalog{\pdfextension catalog} \def\pdfdest{\pdfextension dest} \def\pdfoutline{\pdfextension outline} \def\pdfobj{\pdfextension obj} \def\pdflastobj{\numexpr\pdffeedback lastobj\relax} \def\pdfnames{\pdfextension names} \def\pdfstartlink{\pdfextension startlink}% for the Eplain \def\pdfendlink{\pdfextension endlink}% \href command \let\pdfadjustspacing \adjustspacing% micro- \let\pdfprotrudechars \protrudechars% typography \fi %###################################### \input navigator \pdfcatalog{/PageMode /UseOutlines}% pdf bookmarks visible by default %++++++++++++++++++++++++++++++++++++++ % page layout \pagewidth 152mm \pageheight 229mm % instead of \pdfpagewidth and \pdfpageheight \hsize 122mm %\vsize 184mm \vsize 522pt \voffset -5.4mm \hoffset -10.4mm %++++++++++++++++++++++++++++++++++++++ \tolerance 1414 \hbadness 1414 \hyphenpenalty 500 \finalhyphendemerits 7500 \emergencystretch 5pt \hfuzz 0.3pt \vfuzz=\hfuzz % paragraph spacing \parskip 0pt \parindent 1.2em \baselineskip 15pt \frenchspacing \topskip12pt % new line macro \def\nl{\hfil\break} % for forcing a page break within a paragraph \def\pagebreak{\vadjust{\eject}} % page breaking macro, e.g. for the end of a chapter \def\newpage{\vfill\eject} % settings for the eplain \doublecolumns macro \abovecolumnskip\medskipamount \belowcolumnskip\medskipamount \gutter1.5em \font\rm=lmroman12-regular at 12pt \font\it=lmroman12-italic at 12pt \font\bf=lmroman12-bold at 12pt \font\Bf=lmroman12-bold at 13pt \font\tt=lmmono12-regular at 11pt \font\cm=cmr12 %++++++++++++++++++++++++++++++++++++++++++++++++ % footnote macro from the TeXbook \catcode`\@=11 \def\footnote#1{\edef\@sf{\spacefactor\the\spacefactor}#1\@sf \insert\footins\bgroup\eightpoint \interlinepenalty100 \let\par=\endgraf \leftskip=0pt \rightskip=0pt \splittopskip=10pt plus 1pt minus 1pt \floatingpenalty=20000 \smallskip\item{#1}\bgroup\strut\aftergroup\@foot\let\next} \skip\footins=12pt plus 2pt minus 4pt % space added when footnote exists \dimen\footins=30pc % maximum footnotes per page \font\eightrm=lmroman8-regular at 8pt \font\eightit=lmroman8-italic at 8pt \font\eightbf=lmroman8-bold at 8pt \font\eighttt=lmmono8-regular at 8pt % edited version of the \eightpoint macro % these macros are from `manmac.tex' \def\eightpoint{\def\rm{\fam0\eightrm}% \def\it{\fam\itfam\eightit}% \def\bf{\fam\bffam\eightbf}% \def\tt{\fam\ttfam\eighttt}% \normalbaselineskip=9pt \setbox\strutbox=\hbox{\vrule height7pt depth2pt width\z@}% \normalbaselines\rm} \catcode`\@=12 % %++++++++++++++++++++++++++++++++++++++++++++++++ \footline={\hss\rm\folio\hss} \def\unindent {% \setbox0=\lastbox} \def\vp {% \everypar{\unindent\everypar{}}} \def\heading#1{\goodbreak\bigskip \leftline{\Bf#1}\medskip\nobreak\vp\nobreak} %%%%%%%%%%%%%%%%%%%%%%% % START OF DOCUMENT %%%%%%%%%%%%%%%%%%%%%%% \outline{0}{LuaTeX} \noindent\rm Lua\TeX\ is the newest \TeX\ engine that supports Unicode and OpenType fonts. As with \XeTeX, Lua\TeX\ extends the \TeX\ {\tt\string\font} primitive to allow the use of modern outline fonts. \medskip These are the forms of the font command that are used for OS installed fonts: \verbatim % these fonts are in my Fonts folder \font\goudy="Sorts Mill Goudy:+lnum" at 10pt \font\goudyit="Sorts Mill Goudy Italic:+lnum" at 10pt |endverbatim or: \verbatim % another version for OS fonts % this version uses the font file name % the .otf or .ttf suffix seems to be optional \font\goudy="[GoudyStM.otf]:+lnum" at 10pt \font\goudyit="[GoudyStM-Italic.otf]:+lnum" at 10pt |endverbatim\medskip You can use braces instead of double quotes if you want: \verbatim \font\goudy={GoudyStM.otf:+lnum} at 10pt |endverbatim\medskip This form is used for fonts included with your \TeX\ distribution: \verbatim % these fonts are in my TeX Live folders \font\jun=Junicode.ttf at 10pt \font\juni=Junicode-Italic.ttf at 10pt |endverbatim\medskip From anywhere on your system: \verbatim % from a folder `myfonts' on a USB stick \font\goudy="[H:/myfonts/GoudyStM.otf]" at 10pt |endverbatim\medskip OpenType tags are separated from the font name by a colon and from each other by semicolons or commas if there are more than one. Lua\TeX\ does not have {\tt mapping=tex-text} to allow the use of traditional \TeX\ mark up for quote marks and dashes. If you want typographic quote marks and dashes when you are using a Unicode font you will have to enter them in the input file. (But the old mark up still works in Computer Modern: \hbox{\cm ` ' `` '', --, ---.)} \eject % tabular lining figures \font\gara="EB Garamond 12 Regular:+lnum;+tnum" at 12pt % italic \font\garai="EB Garamond 12 Italic" at 12pt % proportional lining figures \font\garalfp="EB Garamond 12 Regular:+lnum;+pnum" at 12pt % tabular oldstyle figures \font\garaosf="EB Garamond 12 Regular:+onum;+tnum" at 12pt % proportional oldstyle figures \font\garaosfp="EB Garamond 12 Regular:+onum;+pnum" at 12pt % lowercase to small cap \font\garasc="EB Garamond 12 Regular:+smcp" at 12pt % uppercase to small cap \font\garacsc="EB Garamond 12 Regular:+c2sc" at 12pt % fractions \font\garafrac="EB Garamond 12 Regular:+frac" at 12pt % subscripts \font\garasub="EB Garamond 12 Regular:+subs" at 12pt % superscripts \font\garasup="EB Garamond 12 Regular:+sups" at 12pt % scientific inferiors \font\garasinf="EB Garamond 12 Regular:+sinf" at 12pt % historical \font\garahist="EB Garamond 12 Regular:+dlig;+hlig;+hist;+cv01" at 12pt % ordinals \font\garaord="EB Garamond 12 Regular:+ordn" at 12pt % swash letters \font\garaswash="EB Garamond 12 Italic:+swsh" at 12pt \font\twelvett=cmtt12 \outline{0}{OpenType features} \heading{Examples of OpenType features in Lua\TeX} {\gara\noindent\baselineskip15pt \centerline{EB Garamond} Numerals: 1234567890 {\garalfp 1234567890} {\garaosf 1234567890} {\garaosfp 1234567890}\nl Fractions: {\garafrac 1/4 1/2 3/4 3/8 5/8 27/64 }\nl {\garasc Caps and Small Caps ({\twelvett smcp})} {\garacsc SMALL CAPS ({\twelvett c2sc})}\nl Ligatures: ff ffi ffl fi fl\nl Historical: {\garahist ct st species ss ssa ssi ssl si sl [Th]}\nl Superscripts, subscripts, ordinals, scientific inferiors:\nl {\garasup 0123456789+-=()n} {\garasub 0123456789+-=()} 1{\garaord st} 2{\garaord nd} 3{\garaord rd} CO{\garasinf 2} H{\garasinf 2}SO{\garasinf 4}\nl Swash Italics: {\garaswash ABCDEFGHIJKLMNOPQRSTUVWXYZ} }\bigskip % tabular lining figures \font\goudy="Sorts Mill Goudy:+lnum;+tnum" at 12pt % proportional oldstyle figures \font\goudyosfp="Sorts Mill Goudy:+onum;+pnum" at 12pt % lower case to small cap \font\goudysc="Sorts Mill Goudy:+smcp" at 12pt % upper case to small cap \font\goudycsc="Sorts Mill Goudy:+c2sc" at 12pt % fractions \font\goudyfrac="Sorts Mill Goudy:+frac" at 12pt % subscripts \font\goudysub="Sorts Mill Goudy:+subs" at 12pt % superscripts \font\goudysup="Sorts Mill Goudy:+sups" at 12pt % scientific inferiors \font\goudysinf="Sorts Mill Goudy:+sinf" at 12pt {\goudy\noindent\baselineskip15pt \centerline{Sorts Mill Goudy} Numerals: 1234567890 {\goudyosfp 1234567890}\nl Fractions: {\goudyfrac 1/4 1/2 3/4 3/8 5/8 27/64 1/72.27}\nl {\goudysc Caps and Small Caps ({\twelvett smcp})} {\goudycsc SMALL CAPS ({\twelvett c2sc})}\nl Ligatures: ff ffi ffl fi fl\nl Superscripts, subscripts, scientific inferiors: {\goudysup 0123456789+-=()n}\nl {\goudysub 0123456789+-=()} H{\goudysinf 2}O }\bigskip \outline{0}{Hyphenation} \heading{Hyphenation} Some German, to test hyphenation. {\doublecolumns\gara\uselanguage{ngerman}\baselineskip15pt\noindent Entweder mußte der Brunnen sehr tief sein, oder sie fiel sehr langsam; denn sie hatte Zeit genug, sich beim Fallen umzusehen und sich zu wundern, was nun wohl geschehen würde. Zuerst versuchte sie hinunter zu sehen, um zu wissen wohin sie käme, aber es war zu dunkel etwas zu erkennen. Da besah sie die Wände des Brunnens und bemerkte, daß sie mit Küchenschränken und Bücherbrettern bedeckt waren; hier und da erblickte sie Landkarten und Bilder, an Haken aufgehängt. Sie nahm im Vorbeifallen von einem der Bretter ein Töpfchen mit der Aufschrift: »Eingemachte Apfelsinen«, aber zu ihrem großen Verdruß war es leer. Sie wollte es nicht fallen lassen, aus Furcht Jemand unter sich zu tödten; und es gelang ihr, es in einen andern Schrank, an dem sie vorbeikam, zu schieben. }\singlecolumn \eject \outline{0}{PDF Stuff} \heading{PDF Stuff} PDF specific commands like {\tt\string\pdfcatalog}, {\tt\string\pdfinfo} used to be the same as those in pdf\TeX. As of Lua\TeX\ version 0.85 this is no longer the case. Here are the new forms of some commands given beside the old forms: \smallskip \halign{\qquad#\hfil\quad&#\hfil\cr pdf\TeX\ \& Lua\TeX\ $<$\ v. 0.85 & Lua\TeX\ $\ge$ v. 0.85\cr {\tt\string\pdfoutline} & {\tt\string\pdfextension\ outline}\cr {\tt\string\pdfdest} & {\tt\string\pdfextension\ dest}\cr {\tt\string\pdfinfo} & {\tt\string\pdfextension\ info}\cr {\tt\string\pdfcatalog} & {\tt\string\pdfextension\ catalog}\cr {\tt\string\pdfprotrudecharacters} & {\tt\string\protrudecharacters}\cr {\tt\string\pdfadjustspacing} & {\tt\string\adjustspacing}\cr {\tt\string\pdfpagewidth} & {\tt\string\pagewidth}\cr {\tt\string\pdfpageheight} & {\tt\string\pageheight}\cr } \smallskip See section 2.2 of the Lua\TeX\ \href{http://www.pragma-ade.com/general/manuals/luatex.pdf}{manual} for more details. One consequence of the change in PDF-specific commands in v.~0.85 is that when I originally wrote this document I couldn’t get Navigator to write PDF bookmarks. Eventually I found a workaround in this \href{https://gist.github.com/trueroad/41d0024be9eabef668ba}{example} of PDF bookmarks in Lua\TeX\ that I found online: \verbatim \ifnum\luatexversion>84 \def\pdfinfo{\pdfextension info} \def\pdfcatalog{\pdfextension catalog} \def\pdfdest{\pdfextension dest} \def\pdfoutline{\pdfextension outline} \def\pdfobj{\pdfextension obj} \def\pdflastobj{\numexpr\pdffeedback lastobj\relax} \def\pdfnames{\pdfextension names} \fi |endverbatim \newpage % From `Envisioning Information' by E.R. Tufte \def\tufte{We thrive in information||thick worlds because of our marvelous and everyday capacity to select, edit, single out, structure, highlight, group, pair, merge, harmonize, synthesize, focus, organize, condense, reduce, boil down, choose, categorize, catalog, classify, list, abstract, scan, look into, idealize, isolate, discriminate, distinguish, screen, pigeonhole, pick over, sort, integrate, blend, inspect, filter, lump, skip, smooth, chunk, average, approximate, cluster, aggregate, outline, summarize, itemize, review, dip into, flip through, browse, glance into, leaf through, skim, refine, enumerate, glean, synopsize, winnow the wheat from the chaff and separate the sheep from the goats.} \outline{0}{Microtypography} \heading{Microtypography} \font\test=file:lmroman12-regular:protrusion=default;expansion=default 0. The default: no protrusion, no expansion. {\doublecolumns \noindent\test\tufte\par \singlecolumn } \noindent 1. The same text with {\tt\string\protrudechars} and {\tt\string\adjustspacing} both set to 1. {\pdfprotrudechars1% comment these out to see the difference between protruding \pdfadjustspacing1% and non-protruding text and expanded and unexpanded text. \doublecolumns \noindent\test\tufte\par \singlecolumn } When {\tt\string\protrudechars} and {\tt\string\adjustspacing} are set to~1, the protrusion and expansion are applied after \TeX’s normal paragraph breaking routines have broken the paragraph into lines. The linebreaking here is the same as in example 0. \eject \noindent 2. Protrusion and expansion with {\tt\string\protrudechars} and {\tt\string\adjustspacing} both set to 2. {\pdfprotrudechars2% comment these out to see the difference between protruding \pdfadjustspacing2% and non-protruding text and expanded and unexpanded text. \doublecolumns \noindent\test\tufte\par \singlecolumn } When {\tt\string\protrudechars} and {\tt\string\adjustspacing} are set to 2 the changes caused by protrusion and expansion are taken into account {\it while} the paragraph is being built. Consequently the line breaking in this example is different to that in examples 0 and 1. The microtypography examples are taken from an \href{https://www.tug.org/TUGboat/tb31-1/tb97hagen-fonts.pdf}{article} by Hans Hagen. \medskip Lua\TeX\ has {\tt extend} and {\tt slant} options similar to those in \XeTeX: \font\gara="EB Garamond 12 Regular" at 12pt \font\garaext="EB Garamond 12 Regular:extend=1.5" at 12pt \font\garasl="EB Garamond 12 Regular:slant=0.25" at 12pt {\gara An {\garasl oblique introduction\/} to an {\garaext extended example}.} \outline{0}{Letterspacing} \heading{Letterspacing} Lua\TeX\ has a {\tt letterspace} font feature similar to the one in \XeTeX: \verbatim \font\goudyls="[GoudyStM.otf]:+lnum;letterspace=6" at 12pt |endverbatim \smallskip \font\goudyls="[GoudyStM.otf]:+lnum;letterspace=6" at 12pt \font\goudyscls="[GoudyStM.otf]:+lnum;+smcp;letterspace=6" at 12pt {\goudyls\noindent “Anyone who would letterspace lowercase would steal sheep.” \line{\goudy\hfil – \goudyscls f.w. goudy\quad} }\smallskip \noindent You could use this for short pieces of letterspaced capitals or small capitals, e.g. in headings or in page headers. Lua\TeX\ has also inherited the {\tt\string\letterspacefont} command from pdf\TeX: \verbatim \font\normalfont=myfont at 12pt \letterspacefont\lsfont\normalfont 100 |endverbatim The numbers are thousandths of an em. This can be used with the \TeX\ {\tt cmcsc10} font to make a letterspaced smallcap font: \verbatim \font\sc=cmcsc10 \letterspacefont\scls\sc 25 |endverbatim \font\sc=cmcsc10 \letterspacefont\scls\sc 25 {\scls Caps and Small Caps.} \noindent But if I try to make a letterspaced OpenType font with the pdf\TeX\ markup it does not work: \font\goudysc="file:GoudyStM.otf:+smcp;+lnum" at 12pt \letterspacefont\goudyscls\goudysc 50 {\goudyscls Caps and Small Caps} \noindent {\tt\string\letterspacefont} seems to disable the {\tt smcp} tag (or {\tt c2sc} or any other OpenType tag). Use the {\tt letterspace} font feature with the {\tt smcp} or {\tt c2sc} OpenType tag instead. Another way of letterspacing text would be to use the \href{http://texdoc.net/texmf-dist/doc/latex/soul/soul.pdf}{\tt soul}\footnote*{‘\ul{s}pace \ul{o}ut \ul{u}nder\ul{l}ine’} package. You can use the {\tt\string\sodef} macro to set the spacing that you prefer: \break {\tt\string\sodef}〈{\it cmd}〉$\{$〈{\it font}〉$\}$$\{$〈{\it inter-letter space}〉$\}$$\{$〈{\it inner space}〉$\}$ $\{$〈{\it outer space}〉$\}$ \noindent e.g. \verbatim \sodef\goudyscls{\goudysc}{.1em}{.5em plus.25em}{.5em plus .1em minus .1em} |endverbatim \sodef\goudyscls{\goudysc}{.1em}{.5em plus.25em}{.5em plus .1em minus .1em} \noindent {\goudy \goudyscls{Once upon a time} there were three bears. } This package also enables \ul{underlining}, \st{striking through}, and \hl{highlighting}. \bigskip Actually you can use the {\tt letterspace} font feature to set longer text if you want: {\goudyls\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. } {\widowpenalty10000 If I try to set paragraphs like this with {\tt letterspace} in \XeTeX\ I always get overfull lines. The spacing in ‘officia’ seems wrong though. The other two methods break the ligature. } \bigskip The same thing done with {\tt\string\letterspacefont}: \letterspacefont\goudylsfont\goudy 50 {\goudylsfont\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. } \bigskip And set using {\tt soul}: \sodef\goudysoul{\goudy}{.05em}{.25em plus.125em}{.25em plus .05em minus .05em} \noindent \goudysoul{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.} You can also use negative values in the three methods to squeeze letters closer together. \finishpdffile \bye