| 1 |
% \iffalse meta-comment |
| 2 |
% Copyright 2010,2011 Leonard Michlmayr |
| 3 |
% |
| 4 |
% This work may be distributed and/or modified under the |
| 5 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 6 |
% of this license or (at your option) any later version. |
| 7 |
% The latest version of this license is in |
| 8 |
% http://www.latex-project.org/lppl.txt |
| 9 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 10 |
% version 2005/12/01 or later. |
| 11 |
% |
| 12 |
% This work has the LPPL maintenance status `author-maintained'. |
| 13 |
% |
| 14 |
% The Current Maintainer of this work is Leonard Michlmayr |
| 15 |
% <leonard.michlmayr at gmail.com>. |
| 16 |
% |
| 17 |
% This work consists of the file textgreek.dtx |
| 18 |
% and the derived files textgreek.sty and textgreek.pdf |
| 19 |
% \fi |
| 20 |
% \iffalse |
| 21 |
%<package>\NeedsTeXFormat{LaTeX2e}[2009/09/24] |
| 22 |
%<package>\ProvidesPackage{textgreek} |
| 23 |
%<package> [2011/10/09 v0.7 Greek symbols in text] |
| 24 |
%<*driver> |
| 25 |
\documentclass[a4paper]{ltxdoc} |
| 26 |
\usepackage{textcomp} |
| 27 |
\usepackage{textgreek}[2011/09/24] |
| 28 |
\usepackage[american]{babel} |
| 29 |
\usepackage{upgreek} |
| 30 |
\usepackage{amstext} |
| 31 |
\usepackage{microtype} |
| 32 |
\usepackage[numbered]{hypdoc} |
| 33 |
\EnableCrossrefs |
| 34 |
\CodelineIndex |
| 35 |
\RecordChanges |
| 36 |
\begin{document} |
| 37 |
\DocInput{textgreek.dtx} |
| 38 |
\PrintChanges |
| 39 |
\makeatletter\c@IndexColumns = 2\makeatother |
| 40 |
\PrintIndex |
| 41 |
\end{document} |
| 42 |
%</driver> |
| 43 |
% \fi |
| 44 |
% |
| 45 |
% \iffalse\OnlyDescription\fi |
| 46 |
% \CheckSum{477} |
| 47 |
% |
| 48 |
% \CharacterTable |
| 49 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 50 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 51 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 52 |
% Exclamation \! Double quote \" Hash (number) \# |
| 53 |
% Dollar \$ Percent \% Ampersand \& |
| 54 |
% Acute accent \' Left paren \( Right paren \) |
| 55 |
% Asterisk \* Plus \+ Comma \, |
| 56 |
% Minus \- Point \. Solidus \/ |
| 57 |
% Colon \: Semicolon \; Less than \< |
| 58 |
% Equals \= Greater than \> Question mark \? |
| 59 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 60 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 61 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 62 |
% Right brace \} Tilde \~} |
| 63 |
% |
| 64 |
% \changes{v0.1}{2010/10/17}{Initial Version} |
| 65 |
% \changes{v0.7}{2011/10/09}{Split out the .ins file and fix the |
| 66 |
% argument of \cmd{\usedir}.} |
| 67 |
% |
| 68 |
% \GetFileInfo{textgreek.sty} |
| 69 |
% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } \DoNotIndex{\@ne} |
| 70 |
% \DoNotIndex{\advance,\begingroup,\catcode,\closein} |
| 71 |
% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup} |
| 72 |
% \DoNotIndex{\if,\fi,\iffalse,\iftrue} |
| 73 |
% \DoNotIndex{\edef,\csname,\endcsname,\expandafter,\gdef,\xdef} |
| 74 |
% \DoNotIndex{\ifcat,\ifmmode,\ifx,\mbox,\noexpand,\protect,\relax} |
| 75 |
% \DoNotIndex{\texorpdfstring} |
| 76 |
% \DoNotIndex{\bfseries,\centering,\@xiipt,\@xivpt,\@xpt,\@xviipt,\@xxvpt} |
| 77 |
% \DoNotIndex{\DeclareOption,\ExecuteOptions,\fontfamily,\fontsize} |
| 78 |
% \DoNotIndex{\footskip,\hbox,\headheight,\headsep,\hfil,\hfill} |
| 79 |
% \DoNotIndex{\hoffset,\hsize,\hspace,\kern,\MakeUppercase,\mdseries} |
| 80 |
% \DoNotIndex{\MessageBreak,\newcommand,\newpage,\space,\noindent} |
| 81 |
% \DoNotIndex{\oddsidemargin,\PackageError,\PackageWarning} |
| 82 |
% \DoNotIndex{\paperwidth,\paperheight,\par,\parbox,\parindent,\parsep} |
| 83 |
% \DoNotIndex{\ProcessOptions,\rmfamily,\selectfont,\setlength} |
| 84 |
% \DoNotIndex{\sfdefault,\sffamily,\space,\string,\textheight,\textwidth} |
| 85 |
% \DoNotIndex{\thinspace,\thispagestyle,\topmargin,\ttfamily,\upshape} |
| 86 |
% \DoNotIndex{\vbox,\vfil,\voffset,\vsize,\vskip} |
| 87 |
% \DoNotIndex{\ce,\char,\curr@fontshape,\DeclareFontEncoding} |
| 88 |
% \DoNotIndex{\DeclareRobustCommand,\temp,\tempa,\tempb,\tempc} |
| 89 |
% \DoNotIndex{\tempd,\tempe,\2,\3,\8} |
| 90 |
% \DoNotIndex{\fontseries,\providecommand,\renewcommand} |
| 91 |
% \DoNotIndex{\RequirePackage,\romannumeral,\usefont} |
| 92 |
% \DoNotIndex{\DeclareTextCommandDefault,\@@end} |
| 93 |
% |
| 94 |
% \title{The \textsf{\jobname} package\thanks{This document |
| 95 |
% corresponds to \textsf{textgreek}~\fileversion, dated~\filedate.}} |
| 96 |
% \author{Leonard Michlmayr \\ \texttt{leonard.michlmayr at gmail.com}} |
| 97 |
% \date{\filedate} |
| 98 |
% |
| 99 |
% \maketitle |
| 100 |
% |
| 101 |
% \begin{abstract} |
| 102 |
% The \LaTeX{} package \textsf{textgreek} provides NFSS text symbols |
| 103 |
% for Greek letters. This way the author can use Greek letters in |
| 104 |
% text without changing to math mode. The usual font selection |
| 105 |
% commands---e.g.\ |\textbf|---apply to these Greek letters as to |
| 106 |
% usual text and the font is upright in an upright |
| 107 |
% environment. Further, \textsf{hyperref} can use these symbols in |
| 108 |
% PDF-strings such as PDF-bookmarks. |
| 109 |
% \end{abstract} |
| 110 |
% |
| 111 |
% \tableofcontents |
| 112 |
% |
| 113 |
% \section{Introduction} |
| 114 |
% |
| 115 |
% The usual way to print Greek letters in \LaTeX{} uses the math |
| 116 |
% mode. E.g.\ |$\beta$| produces $\beta$. With the default math |
| 117 |
% fonts, the Greek letters produced this way are |
| 118 |
% \textit{italic}. Generally, this is ok, since they represent |
| 119 |
% variables and variables are typeset italic with the default math |
| 120 |
% font settings. In some circumstances, however, Greek letters don't |
| 121 |
% represent variables and should be typeset upright. E.g.\ in |
| 122 |
% ``\textbeta-decay'' or ``\textmugreek A''. |
| 123 |
% |
| 124 |
% The package \textsf{upgreek} provides commands to set upright Greek |
| 125 |
% letters in math mode, but it does not provide text symbols. You |
| 126 |
% could use them in text with |$\upbeta$-decay|, for example, |
| 127 |
% which gives $\upbeta$-decay, but the font will always be the |
| 128 |
% same and will not be adapted to the surrounding font. |
| 129 |
% |
| 130 |
% The package \textsf{textgreek} provides text commands for Greek |
| 131 |
% letters in text that adapt to the surrounding font. For example in |
| 132 |
% {\bf bold text, the command \verb|\textbeta| gives \textbeta{} while |
| 133 |
% \verb|$\upbeta$| gives $\upbeta$}. |
| 134 |
% |
| 135 |
% As textsymbols, Greek letters can also be used in unicode |
| 136 |
% PDF-strings, for example in PDF-bookmarks provided by the |
| 137 |
% \textsf{hyperref} package. See section \ref{hyperref}. |
| 138 |
% |
| 139 |
% \section{Usage} |
| 140 |
% The following list shows the commands provided by this package. You |
| 141 |
% can use these commands in any context. |
| 142 |
% \begin{multicols}{3} |
| 143 |
% \begin{tabbing} |
| 144 |
% |\straightepsilon|\quad\=\textOmega\quad\kill |
| 145 |
% |\textalpha|\>\textalpha\\ |
| 146 |
% |\textbeta|\>\textbeta\\ |
| 147 |
% |\textgamma|\>\textgamma\\ |
| 148 |
% |\textdelta|\>\textdelta\\ |
| 149 |
% |\textepsilon|\>\textepsilon\\ |
| 150 |
% |\textzeta|\>\textzeta\\ |
| 151 |
% |\texteta|\>\texteta\\ |
| 152 |
% |\texttheta|\>\texttheta\\ |
| 153 |
% |\textiota|\>\textiota\\ |
| 154 |
% |\textkappa|\>\textkappa\\ |
| 155 |
% |\textlambda|\>\textlambda\\ |
| 156 |
% |\textmu|\>\textmugreek\\ |
| 157 |
% |\textmugreek|\>\textmugreek\\ |
| 158 |
% |\textnu|\>\textnu\\ |
| 159 |
% |\textxi|\>\textxi\\ |
| 160 |
% |\textomikron|\>\textomikron\\ |
| 161 |
% |\textpi|\>\textpi\\ |
| 162 |
% |\textrho|\>\textrho\\ |
| 163 |
% |\textsigma|\>\textsigma\\ |
| 164 |
% |\texttau|\>\texttau\\ |
| 165 |
% |\textupsilon|\>\textupsilon\\ |
| 166 |
% |\textphi|\>\textphi\\ |
| 167 |
% |\textchi|\>\textchi\\ |
| 168 |
% |\textpsi|\>\textpsi\\ |
| 169 |
% |\textomega|\>\textomega\\ |
| 170 |
% |\textAlpha|\>\textAlpha\\ |
| 171 |
% |\textBeta|\>\textBeta\\ |
| 172 |
% |\textGamma|\>\textGamma\\ |
| 173 |
% |\textDelta|\>\textDelta\\ |
| 174 |
% |\textEpsilon|\>\textEpsilon\\ |
| 175 |
% |\textZeta|\>\textZeta\\ |
| 176 |
% |\textEta|\>\textEta\\ |
| 177 |
% |\textTheta|\>\textTheta\\ |
| 178 |
% |\textIota|\>\textIota\\ |
| 179 |
% |\textKappa|\>\textKappa\\ |
| 180 |
% |\textLambda|\>\textLambda\\ |
| 181 |
% |\textMu|\>\textMu\\ |
| 182 |
% |\textNu|\>\textNu\\ |
| 183 |
% |\textXi|\>\textXi\\ |
| 184 |
% |\textOmikron|\>\textOmikron\\ |
| 185 |
% |\textPi|\>\textPi\\ |
| 186 |
% |\textRho|\>\textRho\\ |
| 187 |
% |\textSigma|\>\textSigma\\ |
| 188 |
% |\textTau|\>\textTau\\ |
| 189 |
% |\textUpsilon|\>\textUpsilon\\ |
| 190 |
% |\textPhi|\>\textPhi\\ |
| 191 |
% |\textChi|\>\textChi\\ |
| 192 |
% |\textPsi|\>\textPsi\\ |
| 193 |
% |\textOmega|\>\textOmega\\ |
| 194 |
% \> \\ |
| 195 |
% |\textvarsigma|\>\textvarsigma\\ |
| 196 |
% |\straightphi|\>\straightphi\\ |
| 197 |
% |\scripttheta|\>\scripttheta\\ |
| 198 |
% |\straighttheta|\>\straighttheta\\ |
| 199 |
% |\straightepsilon|\>\straightepsilon\\ |
| 200 |
% \end{tabbing} |
| 201 |
% \end{multicols} |
| 202 |
% The \textsf{textcomp} package also defines |
| 203 |
% \cmd{\textmu}. \textsf{textgreek} will not replace a prior |
| 204 |
% definition of \cmd{\textmu} if recognized. Therefore it is often |
| 205 |
% better to use \cmd{\textmugreek} instead to avoid unexpected |
| 206 |
% results. |
| 207 |
% \subsection{Package Options} |
| 208 |
% You can choose the Greek fonts used. |
| 209 |
% \newcommand{\textsample}{\textalpha \textbeta \textgamma \textdelta |
| 210 |
% \textepsilon{} \textzeta\texteta\texttheta\textiota\textkappa{} |
| 211 |
% \textlambda\textmugreek\textnu\textxi\textomikron{} |
| 212 |
% \textpi\textrho\textsigma\texttau\textupsilon{} |
| 213 |
% \textphi\textchi\textpsi\textomega{} |
| 214 |
% \textAlpha\textBeta\textGamma\textDelta\textEpsilon{} |
| 215 |
% \textZeta\textEta\textTheta\textIota\textKappa{} |
| 216 |
% \textLambda\textMu\textNu\textXi\textOmikron{} |
| 217 |
% \textPi\textRho\textSigma\textTau\textUpsilon{} |
| 218 |
% \textPhi\textChi\textPsi\textOmega{} |
| 219 |
% \textvarsigma\straightphi\scripttheta\straighttheta\straightepsilon} |
| 220 |
% \begin{description} |
| 221 |
% \item[cbgreek] use the default fonts. This option is the |
| 222 |
% default. Font sample: {\usefont{LGR}{cmr}{m}{n} |
| 223 |
% \renewcommand*{\textgreekfontmap}{} \textsample{}} |
| 224 |
% \item[euler] use the Euler fonts as a companion for all fonts except |
| 225 |
% Helvetica. Font sample: { \usefont{U}{eur}{m}{n} \textsample } |
| 226 |
% \item[artemisia] use Artemisia fonts as a companion for all fonts |
| 227 |
% except Helvetica and Euler. Font sample: |
| 228 |
% {\renewcommand*{\textgreekfontmap}{} |
| 229 |
% \usefont{LGR}{artemisia}{m}{n} \textsample{}} |
| 230 |
% \end{description} |
| 231 |
% |
| 232 |
% \subsection{Advanced commands} |
| 233 |
% The package provides a number of options that allows to select a |
| 234 |
% font that will be used. The list of font substitutions is written to |
| 235 |
% the log file. \DescribeMacro{\textgreekfontmap} If you need to |
| 236 |
% customize the font substitutions, you can redefine |
| 237 |
% |\textgreekfontmap|. For example, the font map for the option |
| 238 |
% \textsf{euler} may also be set by: |
| 239 |
% \begin{verbatim} |
| 240 |
% \renewcommand*{\textgreekfontmap}{ |
| 241 |
% {phv/*/*}{U/psy/*/*} |
| 242 |
% {*/bx/n}{U/eur/b/n} |
| 243 |
% {*/b/n}{U/eur/b/n} |
| 244 |
% {*/*/n}{U/eur/m/n} |
| 245 |
% {*/*/it}{OML/*/*/*}} |
| 246 |
% \end{verbatim} |
| 247 |
% The list contains pairs of options: the font spec (without the |
| 248 |
% encoding) of the font to be replaced and the font spec (with |
| 249 |
% encoding) of the font to be used as companion. The wildcard * may be |
| 250 |
% used to match any family, series, or shape respectively. The first |
| 251 |
% match is effective. Fonts that do not matched at all will be |
| 252 |
% substituted with the same font-family, font-series, and font-shape |
| 253 |
% in the encoding LGR\@. Since the Euler font (eur) does not use the |
| 254 |
% encoding LGR, it has to be replaced by U/eur/m/n. |
| 255 |
% |
| 256 |
% \section{Examples} |
| 257 |
% |
| 258 |
% Most users will use this package to get upright Greek letters, but |
| 259 |
% you can use it for italic letters too: for example |
| 260 |
% |\textit{\textdelta}| \textit{\textdelta}. |
| 261 |
% |
| 262 |
% {\usefont{T1}{phv}{m}{n} When you are using Helvetica, the font |
| 263 |
% ``Symbol'' is used for Greek letters: \textsample} |
| 264 |
% |
| 265 |
% Remember that \TeX{} skips over whitespace directly following a |
| 266 |
% command. Add |{}| to get an interword space after a |
| 267 |
% command. E.g.\ \textsigma{} is genereted by |\textsigma{}|. |
| 268 |
% |
| 269 |
% \subsection{Use \textquotedblleft\textbeta-decay\textquotedblright {} |
| 270 |
% in a heading} |
| 271 |
% |
| 272 |
% The command used for the heading was |
| 273 |
% \begin{verbatim} |
| 274 |
% \subsection{Use \textquotedblleft\textbeta |
| 275 |
% -decay\textquotedblright {} in a heading} |
| 276 |
% \end{verbatim} |
| 277 |
% |
| 278 |
% \section{Compatibility}\label{hyperref} |
| 279 |
% |
| 280 |
% If you use the package \textsf{hyperref} I recommend to use the |
| 281 |
% option \textsf{unicode}, i.e.\ |
| 282 |
% |\usepackage[unicode]{hyperref}|. Hyperref will recognize the |
| 283 |
% textgreek letters and replace them with unicode in PDF-strings. |
| 284 |
% |
| 285 |
% You can use \textsf{upgreek} and \textsf{textgreek} in the same |
| 286 |
% document. If you want to use a textgreek letter inside a math |
| 287 |
% environment, you can place it into an |\mbox| or |\textnormal|, or |
| 288 |
% use |\text| from the package \textsf{amstext}, |
| 289 |
% e.g.\ |$\lambda||_{\text| |{\textbeta}}$|: $\lambda _{\text {\textbeta}}$. |
| 290 |
% |
| 291 |
% \section{Limitations} |
| 292 |
% |
| 293 |
% The variants \straighttheta, \straightphi, and \straightepsilon{} |
| 294 |
% are not included in the LGR font encoding and \straightepsilon{} is |
| 295 |
% not included in Symbol either. For the commands |\straighttheta|, |
| 296 |
% |\straightphi|, and |\straightepsilon| the missing symbols are |
| 297 |
% substituted from \texttt{OML/*/*/it} or Euler. |
| 298 |
% |
| 299 |
% You may need to customize |\textgreekfontmap| if you use other fonts |
| 300 |
% than Computer Modern and Latin Modern. |
| 301 |
% |
| 302 |
% The version number of this package is still below 1.0. Many details |
| 303 |
% may still change from version to version. |
| 304 |
% |
| 305 |
% \section{Copyright} |
| 306 |
% Copyright 2010,2011 Leonard Michlmayr |
| 307 |
% \smallskip |
| 308 |
% |
| 309 |
% \noindent This work may be distributed and/or modified under the |
| 310 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 311 |
% of this license or (at your option) any later version. |
| 312 |
% The latest version of this license is in |
| 313 |
% http://www.latex-project.org/lppl.txt |
| 314 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 315 |
% version 2005/12/01 or later. \smallskip |
| 316 |
% |
| 317 |
% \noindent This work has the LPPL maintenance status `author-maintained'. \smallskip |
| 318 |
% |
| 319 |
% \noindent The Current Maintainer of this work is Leonard Michlmayr. \smallskip |
| 320 |
% |
| 321 |
% \noindent This work consists of the file textgreek.dtx |
| 322 |
% and the derived files textgreek.sty and textgreek.pdf |
| 323 |
% \StopEventually{} |
| 324 |
% \section{Implementation} |
| 325 |
% Load the LGR font encoding. |
| 326 |
% \begin{macrocode} |
| 327 |
\InputIfFileExists{lgrenc.def}{% |
| 328 |
\PackageInfo{textgreek}{Loading the definitions for the Greek font% |
| 329 |
encoding.}}{% |
| 330 |
\PackageError{textgreek}{Cannot find the file lgrenc.def}{% |
| 331 |
lgrenc.def is a file that contains the definitions for the Greek |
| 332 |
font encoding LGR. Maybe it comes with the babel package.}} |
| 333 |
% \end{macrocode} |
| 334 |
% \subsection{Package Options} |
| 335 |
% \begin{macrocode} |
| 336 |
\DeclareOption{cbgreek}{% |
| 337 |
\renewcommand*{\textgreekfontmap}{% |
| 338 |
{eur/*/*}{U/eur/*/*} |
| 339 |
{phv/*/*}{U/psy/*/*}}}% |
| 340 |
% \end{macrocode} |
| 341 |
% \changes{v0.5}{2011/04/04}{use wildcards in the fontmap.} |
| 342 |
% \begin{macrocode} |
| 343 |
\DeclareOption{euler}{% |
| 344 |
\renewcommand*{\textgreekfontmap}{% |
| 345 |
{phv/*/*}{U/psy/*/*} |
| 346 |
{*/bx/n}{U/eur/b/n} |
| 347 |
{*/b/n}{U/eur/b/n} |
| 348 |
{*/*/n}{U/eur/m/n} |
| 349 |
{*/*/it}{OML/*/*/*}}}% |
| 350 |
% \end{macrocode} |
| 351 |
% \begin{macrocode} |
| 352 |
\DeclareOption{artemisia}{% |
| 353 |
\renewcommand*{\textgreekfontmap}{% |
| 354 |
{eur/*/*}{U/eur/*/*} |
| 355 |
{phv/*/*}{U/psy/*/*} |
| 356 |
{*/b/n}{LGR/artemisia/b/n} |
| 357 |
{*/bx/n}{LGR/artemisia/bx/n} |
| 358 |
{*/*/n}{LGR/artemisia/m/n} |
| 359 |
{*/b/it}{LGR/artemisia/b/it} |
| 360 |
{*/bx/it}{LGR/artemisia/bx/it} |
| 361 |
{*/*/it}{LGR/artemisia/m/it} |
| 362 |
{*/b/sl}{LGR/artemisia/b/sl} |
| 363 |
{*/bx/sl}{LGR/artemisia/bx/sl} |
| 364 |
{*/*/sl}{LGR/artemisia/m/sl} |
| 365 |
{*/*/sc}{LGR/artemisia/m/sc} |
| 366 |
{*/*/sco}{LGR/artemisia/m/sco}}}% |
| 367 |
% \end{macrocode} |
| 368 |
% \begin{macro}{\textgreekfontmap} |
| 369 |
% \changes{v0.5}{2011/04/05}{The new font matching macros support |
| 370 |
% the wildcard *.} Initialize |
| 371 |
% |\textgreekfontmap|, set the default option and process the |
| 372 |
% options. |
| 373 |
% \begin{macrocode} |
| 374 |
\newcommand*{\textgreekfontmap}{}% |
| 375 |
\ExecuteOptions{cbgreek} |
| 376 |
\ProcessOptions\relax% |
| 377 |
\PackageInfo{textgreek}{Loaded fontmap: \textgreekfontmap.} |
| 378 |
% \end{macrocode} |
| 379 |
% \end{macro} |
| 380 |
% \subsection{Font selection} |
| 381 |
% \begin{macro}{\textgreek@findfont} |
| 382 |
% Chose a companion font. \changes{v0.5}{2011/04/07}{Allow wildcards |
| 383 |
% in fontsspecs.} |
| 384 |
% \begin{macrocode} |
| 385 |
\def\textgreek@setfont#1/#2/#3/#4\relax{% |
| 386 |
\textgreek@ematch{#1}{*}{}{\fontencoding{#1}}% |
| 387 |
\textgreek@ematch{#2}{*}{}{\fontfamily{#2}}% |
| 388 |
\textgreek@ematch{#3}{*}{}{\fontseries{#3}}% |
| 389 |
\textgreek@ematch{#4}{*}{}{\fontshape{#4}}}% |
| 390 |
% \end{macrocode} |
| 391 |
% \changes{v0.3}{2010/10/30}{Make font substitutions customizable.} |
| 392 |
% Process a list of font substitutions. |
| 393 |
% \begin{macrocode} |
| 394 |
\def\textgreek@eof{}% |
| 395 |
\def\textgreek@return#1#2\textgreek@eof{% |
| 396 |
\fi#1}% |
| 397 |
\def\textgreek@ematch#1#2#3#4{% |
| 398 |
\begingroup% |
| 399 |
\edef\tempa{#1}\edef\tempb{#2}\def\tempc{*}% |
| 400 |
\def\return##1##2\endgroup{\fi\endgroup##1}% |
| 401 |
\ifx\tempa\tempb\return{#3}\fi% |
| 402 |
\ifx\tempa\tempc\return{#3}\fi% |
| 403 |
\iftrue\return{#4}\fi% |
| 404 |
\endgroup}% |
| 405 |
\def\textgreek@matchfont#1/#2/#3\relax#4#5{% |
| 406 |
\textgreek@ematch{#1}{\f@family}{% |
| 407 |
\textgreek@ematch{#2}{\f@series}{% |
| 408 |
\textgreek@ematch{#3}{\f@shape}{#4}{#5}}% |
| 409 |
{#5}}% |
| 410 |
{#5}% |
| 411 |
}% |
| 412 |
\def\textgreek@findfont@#1#2#3\textgreek@eof{% |
| 413 |
\textgreek@matchfont#1\relax% |
| 414 |
{\textgreek@setfont#2\relax}% |
| 415 |
{\textgreek@findfont#3\textgreek@eof}}% |
| 416 |
\def\textgreek@findfont#1\textgreek@eof{% |
| 417 |
\begingroup% |
| 418 |
\def\temp{#1}% |
| 419 |
\def\return##1##2\endgroup{\fi\endgroup##1}% |
| 420 |
\ifx\temp\textgreek@eof\else% |
| 421 |
\return{\textgreek@findfont@#1\textgreek@eof}% |
| 422 |
\fi\endgroup}% |
| 423 |
% \end{macrocode} |
| 424 |
% \end{macro} |
| 425 |
% \begin{macro}{\textgreekfont} |
| 426 |
% Select the Greek font encoding and apply font replacements. |
| 427 |
% \changes{v0.2}{2010/10/20}{apply font replacements before |
| 428 |
% \textbackslash selectfont} |
| 429 |
% \begin{macrocode} |
| 430 |
\newcommand*{\textgreekfont}{% |
| 431 |
\fontencoding{LGR}% |
| 432 |
\edef\textgreek@fontmap{\textgreekfontmap}% |
| 433 |
\expandafter\textgreek@findfont\textgreek@fontmap\textgreek@eof% |
| 434 |
\selectfont% |
| 435 |
}% |
| 436 |
% \end{macrocode} |
| 437 |
% \end{macro} |
| 438 |
% \changes{v0.6}{2011/09/24}{remove obsolote conversion tables |
| 439 |
% \cs{lgrtoeuler} and \cs{lgrtosymbol}} |
| 440 |
% \changes{v0.5}{2011/04/08}{Change the default variant for theta to |
| 441 |
% \straighttheta} \changes{v0.5}{2011/04/04}{Recognize that the |
| 442 |
% font-encoding of Symbol differs from LGR in some points} |
| 443 |
% \begin{macro}{\TextGreek} |
| 444 |
% Produce a Greek letter using the correct font. If the font is |
| 445 |
% Euler or Symbol, convert to the appropriate font encoding. |
| 446 |
% \changes{v0.4}{2011/03/30}{Avoid the ligature that changes sigma |
| 447 |
% to a word-final sigma with the help of \texttt{\textbackslash |
| 448 |
% noboundary}} |
| 449 |
% \begin{macrocode} |
| 450 |
\DeclareRobustCommand*{\TextGreek}[1]{% |
| 451 |
\begingroup% |
| 452 |
\textgreekfont% |
| 453 |
\edef\tempa{\f@family}% |
| 454 |
\let\tempd\f@encoding% |
| 455 |
\def\tempb{eur}\def\tempc{psy}% |
| 456 |
\def\tempe{OML}% |
| 457 |
\ifx\tempd\tempe\textgreek@return{\lgrtoeuler#1}\fi% |
| 458 |
\ifx\tempa\tempb\textgreek@return{\lgrtoeuler#1}\fi% |
| 459 |
\ifx\tempa\tempc\textgreek@return{\lgrtosymbol#1}\fi% |
| 460 |
#1% |
| 461 |
\textgreek@eof% |
| 462 |
\endgroup}% |
| 463 |
% \end{macrocode} |
| 464 |
% \end{macro} |
| 465 |
% \begin{macro}{\TextGreek@Select} |
| 466 |
% The macro |\TextGreek@Select|\marg{LGR}\marg{OML}\marg{symbol} |
| 467 |
% will produce a Greek letter using the font set by |\textgreekfont| |
| 468 |
% and selcting the character from the three arguments corresponding |
| 469 |
% to the font encoding. |
| 470 |
% \begin{macrocode} |
| 471 |
\DeclareRobustCommand*{\TextGreek@Select}[3]{% |
| 472 |
\begingroup% |
| 473 |
\textgreekfont% |
| 474 |
\edef\tempa{\f@family}% |
| 475 |
\let\tempd\f@encoding% |
| 476 |
\def\tempb{eur}\def\tempc{psy}% |
| 477 |
\def\tempe{OML}% |
| 478 |
\ifx\tempd\tempe\textgreek@return{#2}\fi% |
| 479 |
\ifx\tempa\tempb\textgreek@return{#2}\fi% |
| 480 |
\ifx\tempa\tempc\textgreek@return{#3}\fi% |
| 481 |
#1% |
| 482 |
\textgreek@eof% |
| 483 |
\endgroup}% |
| 484 |
% \end{macrocode} |
| 485 |
% \end{macro} |
| 486 |
% \subsection{Greek letter definitions} |
| 487 |
% \subsubsection{Utility macro} |
| 488 |
% \begin{macro}{\DeclareTextGreekSymbol} |
| 489 |
% \cmd{\DeclareTextGreekSymbol}\marg{letter}\marg{LGR}\oarg{OML}\oarg{U}\hskip |
| 490 |
% 0pt plus 20pt will define |\text|\textit{letter} using the |
| 491 |
% character code \textlangle\textit{LGR\/}\textrangle{} for |
| 492 |
% LGR-encoded fonts, \textlangle\textit{OML\/}\textrangle{} for math |
| 493 |
% fonts including Euler, and \textlangle\textit{U\/}\textrangle{} |
| 494 |
% for the Symbol font. If \textlangle\textit{OML\/}\textrangle{} is |
| 495 |
% not provided, an LGR font will be used instead, if |
| 496 |
% \textlangle\textit{U\/}\textrangle{} is missing |
| 497 |
% \textlangle\textit{LGR\/}\textrangle{} will be used |
| 498 |
% instead. \changes{v0.6}{2011/09/24}{In order to improve |
| 499 |
% performance, do not run through the conversion tables |
| 500 |
% (e.g.\ \texttt{\textbackslash lgrtoeuler}) but save all the |
| 501 |
% encodings for each letter in the macro itself.} |
| 502 |
% \begin{macrocode} |
| 503 |
\def\DeclareTextGreekSymbol#1#2{% |
| 504 |
\@ifnextchar[% |
| 505 |
{\DeclareTextGreekSymbol@{#1}{#2}}% |
| 506 |
{\@DeclareTextGreekSymbol{#1}{#2}% |
| 507 |
{\fontencoding{LGR}\fontfamily{cmr}\selectfont#2}{#2}}% |
| 508 |
}% |
| 509 |
% \end{macrocode} |
| 510 |
% \begin{macrocode} |
| 511 |
\def\@DeclareTextGreekSymbol#1#2#3#4{% |
| 512 |
\expandafter\DeclareTextCommandDefault\csname text#1\endcsname% |
| 513 |
{\TextGreek@Select{#2}{#3}{#4}}% |
| 514 |
}% |
| 515 |
% \end{macrocode} |
| 516 |
% \begin{macrocode} |
| 517 |
\def\DeclareTextGreekSymbol@#1#2[#3]{% |
| 518 |
\ifx\textgreek@eof#3\textgreek@return{% |
| 519 |
\DeclareTextGreekSymbol@@{#1}{#2}% |
| 520 |
{\fontencoding{LGR}\fontfamily{cmr}\selectfont#2}}% |
| 521 |
\else\textgreek@return{% |
| 522 |
\DeclareTextGreekSymbol@@{#1}{#2}{#3}}\fi% |
| 523 |
\textgreek@eof}% |
| 524 |
% \end{macrocode} |
| 525 |
% \begin{macrocode} |
| 526 |
\def\DeclareTextGreekSymbol@@#1#2#3{% |
| 527 |
\@ifnextchar[% |
| 528 |
{\DeclareTextGreekSymbol@@@{#1}{#2}{#3}}% |
| 529 |
{\@DeclareTextGreekSymbol{#1}{#2}{#3}{#2}}% |
| 530 |
}% |
| 531 |
% \end{macrocode} |
| 532 |
% \begin{macrocode} |
| 533 |
\def\DeclareTextGreekSymbol@@@#1#2#3[#4]{% |
| 534 |
\ifx\textgreek@eof#4\textgreek@return{% |
| 535 |
\@DeclareTextGreekSymbol{#1}{#2}{#3}{#2}}% |
| 536 |
\else\textgreek@return{% |
| 537 |
\@DeclareTextGreekSymbol{#1}{#2}{#3}{#4}}\fi% |
| 538 |
\textgreek@eof}% |
| 539 |
% \end{macrocode} |
| 540 |
% \end{macro} |
| 541 |
% \subsubsection{List of Greek letters} |
| 542 |
% \begin{macrocode} |
| 543 |
\DeclareTextGreekSymbol{alpha}{a}[\char11] |
| 544 |
\DeclareTextGreekSymbol{beta}{b}[\char12] |
| 545 |
\DeclareTextGreekSymbol{gamma}{g}[\char13] |
| 546 |
\DeclareTextGreekSymbol{delta}{d}[\char14] |
| 547 |
% \end{macrocode} |
| 548 |
% Euler provides two variants of epsilon: |
| 549 |
% {\usefont{U}{eur}{m}{n}\char15} and |
| 550 |
% {\usefont{U}{eur}{m}{n}\char34}. Use {\usefont{U}{eur}{m}{n}\char34} |
| 551 |
% with \cmd{\textepsilon}. |
| 552 |
% \begin{macrocode} |
| 553 |
\DeclareTextGreekSymbol{epsilon}{e}[\char34] |
| 554 |
\DeclareTextGreekSymbol{zeta}{z}[\char16] |
| 555 |
\DeclareTextGreekSymbol{eta}{h}[\char17] |
| 556 |
% \end{macrocode} |
| 557 |
% Euler provides two variants of theta: |
| 558 |
% {\usefont{U}{eur}{m}{n}\char18} and |
| 559 |
% {\usefont{U}{eur}{m}{n}\char35}. Use |
| 560 |
% {\usefont{U}{eur}{m}{n}\texttheta} for \cmd{\texttheta}. |
| 561 |
% \begin{macrocode} |
| 562 |
\DeclareTextGreekSymbol{theta}{j}[\char18][q] |
| 563 |
\DeclareTextGreekSymbol{iota}{i}[\char19] |
| 564 |
\DeclareTextGreekSymbol{kappa}{k}[\char20] |
| 565 |
\DeclareTextGreekSymbol{lambda}{l}[\char21] |
| 566 |
% \end{macrocode} |
| 567 |
% \begin{macro}{\textmu} |
| 568 |
% \changes{v0.4}{2010/11/07}{Don't override \textsf{textcomp}'s |
| 569 |
% \texttt{\textbackslash textmu}} \changes{v0.4}{2010/11/07}{Don't |
| 570 |
% provide \texttt{\textbackslash textmicro} anymore.} |
| 571 |
% \begin{macro}{\textmugreek} |
| 572 |
% I don't redefine |\textmu| if it is already provided by another |
| 573 |
% package. Use |\textmugreek| if you mean the Greek letter rather |
| 574 |
% than the micro symbol of the \textsf{textcomp} package. |
| 575 |
% \begin{macrocode} |
| 576 |
\expandafter\ifx\csname?\string\textmu\endcsname\relax% |
| 577 |
\DeclareTextGreekSymbol{mu}{m}[\char22] |
| 578 |
\fi |
| 579 |
\DeclareTextGreekSymbol{mugreek}{m}[\char22] |
| 580 |
% \end{macrocode} |
| 581 |
% \end{macro} |
| 582 |
% \end{macro} |
| 583 |
% \begin{macrocode} |
| 584 |
\DeclareTextGreekSymbol{nu}{n}[\char23] |
| 585 |
\DeclareTextGreekSymbol{xi}{x}[\char24] |
| 586 |
\DeclareTextGreekSymbol{omikron}{o} |
| 587 |
\DeclareTextGreekSymbol{pi}{p}[\char25] |
| 588 |
\DeclareTextGreekSymbol{rho}{r}[\char26] |
| 589 |
% \end{macrocode} |
| 590 |
% \changes{v0.5}{2011/04/07}{\texttt{\textbackslash noboundary} is |
| 591 |
% needed only for sigma} Since the word-end sigma \textvarsigma{} is |
| 592 |
% implemented as a ligature in LGR encoded fonts, we have to add |
| 593 |
% \cmd{\noboundary} to get a \textsigma. |
| 594 |
% \begin{macrocode} |
| 595 |
\DeclareTextGreekSymbol{sigma}{s\noboundary}[\char27][s] |
| 596 |
% \end{macrocode} |
| 597 |
% \begin{macro}{\textvarsigma} Provide \textvarsigma{} as \cmd{\textvarsigma}. |
| 598 |
% \changes{v0.5}{2011/04/04}{New symbol \textvarsigma.} |
| 599 |
% \begin{macrocode} |
| 600 |
\DeclareTextGreekSymbol{varsigma}{c}[][V] |
| 601 |
% \end{macrocode} |
| 602 |
% \end{macro} |
| 603 |
% \begin{macrocode} |
| 604 |
\DeclareTextGreekSymbol{tau}{t}[\char28] |
| 605 |
\DeclareTextGreekSymbol{upsilon}{u}[\char29] |
| 606 |
% \end{macrocode} |
| 607 |
% Euler provides two variants of phi: {\usefont{U}{eur}{m}{n}\char30} |
| 608 |
% and {\usefont{U}{eur}{m}{n}\char39}. Use |
| 609 |
% {\usefont{U}{eur}{m}{n}\char39} for \cmd{\textphi}. |
| 610 |
% \begin{macrocode} |
| 611 |
\DeclareTextGreekSymbol{phi}{f}[\char39][j] |
| 612 |
\DeclareTextGreekSymbol{chi}{q}[\char31][c] |
| 613 |
\DeclareTextGreekSymbol{psi}{y}[\char32] |
| 614 |
\DeclareTextGreekSymbol{omega}{w}[\char33] |
| 615 |
\DeclareTextGreekSymbol{Alpha}{A} |
| 616 |
\DeclareTextGreekSymbol{Beta}{B} |
| 617 |
\DeclareTextGreekSymbol{Gamma}{G}[\char0] |
| 618 |
\DeclareTextGreekSymbol{Delta}{D}[\char1] |
| 619 |
\DeclareTextGreekSymbol{Epsilon}{E} |
| 620 |
\DeclareTextGreekSymbol{Zeta}{Z} |
| 621 |
\DeclareTextGreekSymbol{Eta}{H} |
| 622 |
\DeclareTextGreekSymbol{Theta}{J}[\char2][Q] |
| 623 |
\DeclareTextGreekSymbol{Iota}{I} |
| 624 |
\DeclareTextGreekSymbol{Kappa}{K} |
| 625 |
\DeclareTextGreekSymbol{Lambda}{L}[\char3] |
| 626 |
\DeclareTextGreekSymbol{Mu}{M} |
| 627 |
\DeclareTextGreekSymbol{Nu}{N} |
| 628 |
\DeclareTextGreekSymbol{Xi}{X}[\char4] |
| 629 |
\DeclareTextGreekSymbol{Omikron}{O} |
| 630 |
\DeclareTextGreekSymbol{Pi}{P}[\char5] |
| 631 |
\DeclareTextGreekSymbol{Rho}{R} |
| 632 |
\DeclareTextGreekSymbol{Sigma}{S}[\char6] |
| 633 |
\DeclareTextGreekSymbol{Tau}{T} |
| 634 |
\DeclareTextGreekSymbol{Upsilon}{U}[\char7] |
| 635 |
\DeclareTextGreekSymbol{Phi}{F}[\char8] |
| 636 |
\DeclareTextGreekSymbol{Chi}{Q}[][C] |
| 637 |
\DeclareTextGreekSymbol{Psi}{Y}[\char9] |
| 638 |
\DeclareTextGreekSymbol{Omega}{W}[\char10] |
| 639 |
% \end{macrocode} |
| 640 |
% \subsubsection{Variants} |
| 641 |
% \begin{macro}{\straightphi} |
| 642 |
% \changes{v0.5}{2011/04/03}{New symbol \straightphi} The phi symbol |
| 643 |
% \straightphi{} is a variant of phi \textphi. Sometimes this variant |
| 644 |
% is used specifically, e.g.\ in quantum field theory. The Unicode |
| 645 |
% code point is \texttt{U+03D5}. |
| 646 |
% \begin{macrocode} |
| 647 |
\DeclareTextCommand{\straightphi}{PU}% |
| 648 |
{\83\325} % U+03D5 GREEK PHI SYMBOL |
| 649 |
% \end{macrocode} |
| 650 |
% The Greek fonts aim at Greek text. Therefore the phi symbol is not |
| 651 |
% included. I use the math symbol for italic fonts and euler else. |
| 652 |
% \begin{macrocode} |
| 653 |
\DeclareTextCommandDefault{\straightphi}{% |
| 654 |
\begingroup\textgreekfont% |
| 655 |
\edef\tempa{\f@family}% |
| 656 |
\edef\tempb{\f@shape}% |
| 657 |
\def\tempc{eur}\def\tempd{psy}% |
| 658 |
\def\tempe{it}% |
| 659 |
\ifx\tempa\tempc\textgreek@return{\char30}\fi% |
| 660 |
\ifx\tempa\tempd\textgreek@return{f}\fi% |
| 661 |
\ifx\tempb\tempe\textgreek@return{% |
| 662 |
\fontencoding{OML}\selectfont\char30}\fi% |
| 663 |
\textgreek@ematch{\f@series}{bx}{\fontseries{b}}{}% |
| 664 |
\fontencoding{U}\fontfamily{eur}\selectfont\char30% |
| 665 |
\textgreek@eof% |
| 666 |
\endgroup}% |
| 667 |
% \end{macrocode} |
| 668 |
% \end{macro} |
| 669 |
% \begin{macro}{\scripttheta} |
| 670 |
% \changes{v0.5}{2011/04/06}{New symbol \scripttheta} The theta |
| 671 |
% symbol \scripttheta{} is a variant of theta \texttheta. The Unicode |
| 672 |
% code point is \texttt{U+03D1}. It is available as |\scripttheta|. |
| 673 |
% \begin{macrocode} |
| 674 |
\DeclareTextCommand{\scripttheta}{PU}% |
| 675 |
{\83\321}% U+03D1 GREEK THETA SYMBOL |
| 676 |
% \end{macrocode} |
| 677 |
% \begin{macrocode} |
| 678 |
\DeclareTextCommandDefault{\scripttheta}{% |
| 679 |
\TextGreek@Select{j}{\char35}{J}}% |
| 680 |
% \end{macrocode} |
| 681 |
% \end{macro} |
| 682 |
% \begin{macro}{\straighttheta} |
| 683 |
% \changes{v0.5}{2011/04/06}{New symbol \straighttheta} The theta |
| 684 |
% \straighttheta{} is presumably the common variant of theta |
| 685 |
% \texttheta. The cbgreek fonts and artemisia use the script |
| 686 |
% variant. |
| 687 |
% \begin{macrocode} |
| 688 |
\DeclareTextCommand{\straighttheta}{PU}% |
| 689 |
{\83\270} % U+03B8 GREEK THETA SYMBOL |
| 690 |
% \end{macrocode} |
| 691 |
% \begin{macrocode} |
| 692 |
\DeclareTextCommandDefault{\straighttheta}{% |
| 693 |
\begingroup\textgreekfont% |
| 694 |
\edef\tempa{\f@family}% |
| 695 |
\edef\tempb{\f@shape}% |
| 696 |
\def\tempc{eur}\def\tempd{psy}% |
| 697 |
\def\tempe{it}% |
| 698 |
\ifx\tempa\tempc\textgreek@return{\char18}\fi% |
| 699 |
\ifx\tempa\tempd\textgreek@return{q}\fi% |
| 700 |
\ifx\tempb\tempe\textgreek@return{% |
| 701 |
\fontencoding{OML}\selectfont\char18}\fi% |
| 702 |
\textgreek@ematch{\f@series}{bx}{\fontseries{b}}{}% |
| 703 |
\fontencoding{U}\fontfamily{eur}\selectfont\char18% |
| 704 |
\textgreek@eof% |
| 705 |
\endgroup}% |
| 706 |
% \end{macrocode} |
| 707 |
% \end{macro} |
| 708 |
% \begin{macro}{\straightepsilon} |
| 709 |
% \changes{v0.5}{2011/04/06}{New symbol \straightepsilon} The epsilon |
| 710 |
% \straightepsilon{} is a variant of epsilon |
| 711 |
% \textepsilon. |
| 712 |
% \begin{macrocode} |
| 713 |
%% U+03F5 GREEK LUNATE EPSILON SYMBOL |
| 714 |
\DeclareTextCommand{\straightepsilon}{PU}{\83\365}% |
| 715 |
% \end{macrocode} |
| 716 |
% \begin{macrocode} |
| 717 |
\DeclareTextCommandDefault{\straightepsilon}{% |
| 718 |
\begingroup\textgreekfont% |
| 719 |
\edef\tempa{\f@family}% |
| 720 |
\edef\tempb{\f@shape}% |
| 721 |
\def\tempc{eur}\def\tempd{psy}% |
| 722 |
\def\tempe{it}% |
| 723 |
\ifx\tempa\tempc\textgreek@return{\char15}\fi% |
| 724 |
\ifx\tempa\tempd\textgreek@return{% |
| 725 |
\fontfamily{eur}\fontseries{b}\selectfont\char15}\fi% |
| 726 |
\ifx\tempb\tempe\textgreek@return{% |
| 727 |
\fontencoding{OML}\selectfont\char15}\fi% |
| 728 |
\textgreek@ematch{\f@series}{bx}{\fontseries{b}}{}% |
| 729 |
\fontencoding{U}\fontfamily{eur}\selectfont\char15% |
| 730 |
\textgreek@eof% |
| 731 |
\endgroup}% |
| 732 |
% \end{macrocode} |
| 733 |
% \end{macro} |
| 734 |
% \Finale |
| 735 |
\endinput |