| 1 |
|
| 2 |
|
| 3 |
\ProvidesPackage{fontspec-doc-style} |
| 4 |
|
| 5 |
\input{fontspec.dtx} |
| 6 |
\ExplSyntaxOff |
| 7 |
|
| 8 |
\usepackage{fontspec,booktabs,caption, |
| 9 |
xcolor,flafter,fancyvrb,hologo, |
| 10 |
graphicx,url,varioref,varwidth, |
| 11 |
microtype,framed,tocloft,xparse,docmute} |
| 12 |
|
| 13 |
\let\FancyVerbSpace\verbvisiblespace |
| 14 |
|
| 15 |
%% Various labelling commands: |
| 16 |
\newcommand*\name[1]{{#1}} |
| 17 |
\newcommand*\opt[1]{\texttt{#1}} |
| 18 |
\newcommand*\feat[1]{\texttt{#1}} |
| 19 |
|
| 20 |
\let\latin\textit |
| 21 |
\def\eg{\latin{e.g.}} |
| 22 |
\def\ie{\latin{i.e.}} |
| 23 |
\def\Eg{\latin{E.g.}} |
| 24 |
\def\Ie{\latin{I.e.}} |
| 25 |
\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}} |
| 26 |
|
| 27 |
\newcommand\note[1]{\unskip\footnote{#1}} |
| 28 |
|
| 29 |
\def\MacOSX{macOS} |
| 30 |
\def\AAT{\textsc{aat}} |
| 31 |
\def\ATSUI{\textsc{atsui}} |
| 32 |
|
| 33 |
\newcommand\NFSS{\textsc{nfss}} |
| 34 |
\newcommand\XeLaTeX{\hologo{XeLaTeX}} |
| 35 |
\newcommand\LuaLaTeX{\hologo{LuaLaTeX}} |
| 36 |
|
| 37 |
% tocloft formatting: |
| 38 |
\setlength\cftsubsecnumwidth{1.4\cftsubsecnumwidth} |
| 39 |
%\def\@cfttocstart{\small\begin{multicols}{2}} |
| 40 |
%\def\@cfttocfinish{\end{multicols}} |
| 41 |
|
| 42 |
\fvset{gobble=0} |
| 43 |
|
| 44 |
\captionsetup[table]{position=above} |
| 45 |
\captionsetup[figure]{position=above} |
| 46 |
|
| 47 |
|
| 48 |
%% Fonts |
| 49 |
|
| 50 |
\defaultfontfeatures{Numbers=OldStyle} |
| 51 |
\IfFontExistsTF{AldusNovaPro-Book.otf} |
| 52 |
{ |
| 53 |
\setmainfont{aldus-nova} |
| 54 |
\setsansfont{palatino-sans-light} |
| 55 |
} |
| 56 |
{ |
| 57 |
\setmainfont{texgyrepagella}[ |
| 58 |
Extension = .otf, |
| 59 |
UprightFont = *-regular , |
| 60 |
ItalicFont = *-italic , |
| 61 |
BoldFont = *-bold , |
| 62 |
BoldItalicFont = *-bolditalic , |
| 63 |
] |
| 64 |
\setsansfont{texgyreheros}[ |
| 65 |
Extension = .otf, |
| 66 |
UprightFont = *-regular , |
| 67 |
ItalicFont = *-italic , |
| 68 |
BoldFont = *-bold , |
| 69 |
BoldItalicFont = *-bolditalic , |
| 70 |
] |
| 71 |
} |
| 72 |
\setmonofont{lmmono10-regular.otf}[ |
| 73 |
Numbers={Lining,SlashedZero}, |
| 74 |
ItalicFont=lmmonoslant10-regular.otf, |
| 75 |
BoldFont=lmmonolt10-bold.otf, |
| 76 |
BoldItalicFont=lmmonolt10-boldoblique.otf, |
| 77 |
] |
| 78 |
\newfontfamily\ttcondensed{lmmonoltcond10-regular.otf} |
| 79 |
|
| 80 |
%% (La)TeX font-related declarations: |
| 81 |
\linespread{1.05} % Pagella needs more space between lines |
| 82 |
\frenchspacing % Remove ugly extra space after punctuation |
| 83 |
|
| 84 |
%% ToC |
| 85 |
\def\@dotsep{1000} |
| 86 |
\setcounter{tocdepth}{2} |
| 87 |
\setlength\columnseprule{0.4pt} |
| 88 |
\renewcommand\tableofcontents{\relax |
| 89 |
\begin{multicols}{2}[\section*{\contentsname}]\relax |
| 90 |
\@starttoc{toc}\relax |
| 91 |
\end{multicols}} |
| 92 |
|
| 93 |
|
| 94 |
%% Index |
| 95 |
\setcounter{IndexColumns}{2} |
| 96 |
\renewenvironment{theglossary} |
| 97 |
{\small\list{}{} |
| 98 |
\item\relax |
| 99 |
\glossary@prologue\GlossaryParms |
| 100 |
\let\item\@idxitem \ignorespaces |
| 101 |
\def\pfill{\hspace*{\fill}}} |
| 102 |
{\endlist} |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
%% varioref definitions: |
| 107 |
\labelformat{table}{Table~#1} |
| 108 |
\labelformat{section}{Section~#1} |
| 109 |
\labelformat{subsection}{Section~#1} |
| 110 |
|
| 111 |
\definecolor{niceblue}{rgb}{0.1,0.2,0.8} |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
%% EXAMPLES |
| 117 |
|
| 118 |
\newif\ifshowexamples |
| 119 |
\showexamplestrue |
| 120 |
|
| 121 |
\newsavebox\X |
| 122 |
\newsavebox\Y |
| 123 |
|
| 124 |
\newcounter{example} |
| 125 |
|
| 126 |
\newcommand\exref[1]{Example~\ref{ex:#1}} |
| 127 |
\newcommand\Exref[1]{Example~\ref{ex:#1}} |
| 128 |
|
| 129 |
\newenvironment{Xexample}[3][] |
| 130 |
{\VerbatimEnvironment\begin{Fexample}[#1]{#2}{#3}{X}} |
| 131 |
{\end{Fexample}} |
| 132 |
|
| 133 |
\newenvironment{Lexample}[3][] |
| 134 |
{\VerbatimEnvironment\begin{Fexample}[#1]{#2}{#3}{L}} |
| 135 |
{\end{Fexample}} |
| 136 |
|
| 137 |
\newenvironment{Fexample}[4][] |
| 138 |
{% |
| 139 |
\def\options{#1}% |
| 140 |
\def\filename{#2}% |
| 141 |
\def\captiontext{#3}% |
| 142 |
\def\prefix{#4} |
| 143 |
\refstepcounter{example}% |
| 144 |
\label{ex:\filename}% |
| 145 |
\ifshowexamples |
| 146 |
\IfFileExists{zzz-\theexample-\prefix-\filename.tex}{}{% |
| 147 |
\immediate\write18{rm -f zzz-\theexample-* ;}% |
| 148 |
}% |
| 149 |
\fi |
| 150 |
\VerbatimEnvironment |
| 151 |
\begin{VerbatimOut}{zzz-\theexample-\prefix-\filename.tex}} |
| 152 |
% text in the environment |
| 153 |
{\end{VerbatimOut} |
| 154 |
\begin{figure} |
| 155 |
\setlength\parindent{0pt}% |
| 156 |
\edef\@tempa{[gobble=0,fontsize=\noexpand\small,\options]}% |
| 157 |
\savebox\X{% |
| 158 |
\expandafter\BVerbatimInput |
| 159 |
\@tempa{zzz-\theexample-\prefix-\filename.tex}% |
| 160 |
}% |
| 161 |
\IfFileExists{zzz-\theexample-\prefix-\filename.pdf}{} |
| 162 |
{% |
| 163 |
\edef\XXcmd{% |
| 164 |
\unexpanded{% |
| 165 |
\RequirePackage{luatex85} |
| 166 |
\documentclass[margin=0.2mm]{standalone} |
| 167 |
\usepackage{booktabs,ifthen,graphicx,xcolor,varwidth} |
| 168 |
\usepackage{fontspec} |
| 169 |
\defaultfontfeatures{Ligatures=TeX} |
| 170 |
\begin{document} |
| 171 |
\begin{varwidth}{0.7\linewidth} |
| 172 |
\input} zzz-\theexample-\prefix-\filename.tex |
| 173 |
\unexpanded{ |
| 174 |
\end{varwidth} |
| 175 |
\end{document} |
| 176 |
}% |
| 177 |
}% |
| 178 |
\edef\1{% |
| 179 |
\csname prog@\prefix\endcsname "\unexpanded\expandafter{\XXcmd}"; |
| 180 |
printf '\@percentchar s' '\unexpanded\expandafter{\XXcmd}' > zzz-\theexample-\prefix-\filename-test.tex; |
| 181 |
}% |
| 182 |
\ifshowexamples |
| 183 |
\immediate\write18{\unexpanded\expandafter{\1}}% |
| 184 |
\fi |
| 185 |
}% |
| 186 |
\savebox\Y{% |
| 187 |
\IfFileExists{zzz-\theexample-\prefix-\filename.pdf} |
| 188 |
{\includegraphics{zzz-\theexample-\prefix-\filename.pdf}} |
| 189 |
{\color{red}\itshape ---Example graphic not generated---}% |
| 190 |
} |
| 191 |
% TYPESETTING |
| 192 |
\rule[0.5\baselineskip]{\columnwidth}{1pt}% |
| 193 |
\vspace{-1.2ex}% |
| 194 |
\def\@tempa{\small\textsf{Example~\theexample:~}}% |
| 195 |
\settowidth\@tempdima{\@tempa\captiontext}% |
| 196 |
\par |
| 197 |
\ifdim\@tempdima>\linewidth |
| 198 |
\settowidth\@tempdima{\@tempa}% |
| 199 |
\@tempa\parbox[t]{\linewidth-\@tempdima}{\small\captiontext}% |
| 200 |
\vspace{0.4\baselineskip}% |
| 201 |
\else |
| 202 |
\parbox{\linewidth}{\centering\@tempa~\captiontext}% |
| 203 |
\fi |
| 204 |
\par\rule[0.4\baselineskip]{\columnwidth}{0.4pt}\par |
| 205 |
\ifdim\dimexpr\wd\X+\wd\Y>\linewidth\relax |
| 206 |
\null\hfill\makebox[0pt][r]{\usebox\Y}\usebox\X |
| 207 |
\else |
| 208 |
\hfill\usebox\Y\hfill\usebox\X |
| 209 |
\fi |
| 210 |
\par\rule[0.5\baselineskip]{\columnwidth}{1pt} |
| 211 |
\end{figure} |
| 212 |
} |
| 213 |
|
| 214 |
\def\prog@X{xelatex |
| 215 |
-jobname=zzz-\theexample-X-\filename\space} |
| 216 |
|
| 217 |
\def\prog@L{lualatex |
| 218 |
-jobname=zzz-\theexample-L-\filename\space} |
| 219 |
|
| 220 |
%%%%%%%%%%%%%%%%%%%%%% |
| 221 |
|
| 222 |
\newcommand*\setexsize[1]{\let\examplesize#1} |
| 223 |
\newcommand*\setverbwidth[1]{\def\auxwidth{#1}} |
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
\newcounter{argument} |
| 228 |
\g@addto@macro\endmacro{\setcounter{argument}{0}} |
| 229 |
\newcommand*\darg[1]{% |
| 230 |
\stepcounter{argument}% |
| 231 |
\noindent{\ttfamily\char`\#\theargument~:~}#1\par} |
| 232 |
\newcommand*\doarg[1]{% |
| 233 |
\stepcounter{argument}% |
| 234 |
\noindent{\ttfamily\makebox[0pt][r]{[}\char`\#\theargument]:~}#1\par} |
| 235 |
|
| 236 |
\newcommand\unichar[2]{\textsc{\MakeLowercase{u+#1: #2}}} |
| 237 |
|
| 238 |
\newcommand\cmdbox[1]{% |
| 239 |
\smallskip\par\noindent |
| 240 |
\fbox{\begin{varwidth}{\linewidth} |
| 241 |
#1% |
| 242 |
\end{varwidth}}% |
| 243 |
\smallskip |
| 244 |
} |
| 245 |
\def\CMD#1{\texttt{\null#1\unskip}} |
| 246 |
|
| 247 |
|
| 248 |
\NewDocumentCommand \otf {somm} {% |
| 249 |
\featname & #3 & \texttt{#4} |
| 250 |
\IfBooleanT #1 { & \textdagger } |
| 251 |
\\ |
| 252 |
} |
| 253 |
\newenvironment{features}[1]{% |
| 254 |
\def\NOTE{} |
| 255 |
\def\thisfeatname{#1}% |
| 256 |
\def\featname{\thisfeatname~~\texttt=~~\null\gdef\featname{}}% |
| 257 |
\begin{table} |
| 258 |
\caption{Options for the OpenType font feature `\thisfeatname'.} |
| 259 |
\edef\@tempa{\noexpand\label{feat:\thisfeatname}}\@tempa |
| 260 |
\centering |
| 261 |
\begin{tabular}{@{}l@{}l@{\hspace{0.5\tabcolsep}}l@{\hspace{0.5\tabcolsep}}l@{}} |
| 262 |
\toprule |
| 263 |
Feature & Option & Tag & \\ |
| 264 |
\midrule |
| 265 |
}{ |
| 266 |
\bottomrule |
| 267 |
\end{tabular} |
| 268 |
\par\smallskip |
| 269 |
\footnotesize |
| 270 |
\textdagger\ These feature options can be disabled with \texttt{..Off} variants, and reset \\ to default state (neither explicitly on nor off) with \texttt{..Reset}. |
| 271 |
\NOTE |
| 272 |
\end{table} |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
%%%%%%%%%%% |
| 277 |
|
| 278 |
\def \MakePrivateLetters {% |
| 279 |
\catcode `\@ = 11 |
| 280 |
\catcode `\_ = 11 |
| 281 |
\catcode `\: = 11 |
| 282 |
} |
| 283 |
|
| 284 |
%% for LaTeX3 csnames |
| 285 |
\catcode `\_= 11 |
| 286 |
|
| 287 |
\renewcommand\partname{Part} |
| 288 |
|
| 289 |
|
| 290 |
% /© |
| 291 |
% |
| 292 |
% (COPYRIGHT GOES HERE) |
| 293 |
% |
| 294 |
% ©/ |