From 1479b7379fbf61f282f9c000d5b676913fb2555e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 17 Jul 2008 23:09:59 +0000 Subject: polyglossia update (17jul08) git-svn-id: svn://tug.org/texlive/trunk@9647 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/xelatex/polyglossia/polyglossia.dtx | 7815 ++++++++++++++++++++ 1 file changed, 7815 insertions(+) create mode 100644 Master/texmf-dist/source/xelatex/polyglossia/polyglossia.dtx (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/xelatex/polyglossia/polyglossia.dtx b/Master/texmf-dist/source/xelatex/polyglossia/polyglossia.dtx new file mode 100644 index 00000000000..ada0c828c82 --- /dev/null +++ b/Master/texmf-dist/source/xelatex/polyglossia/polyglossia.dtx @@ -0,0 +1,7815 @@ +%\iffalse +% polyglossia.dtx generated using mkpolyglossiadtx.pl +% (derived from makedtx.pl version (c) Nicola Talbot) +% +% Created on 2008/7/15 14:23 +%<*internal> +\iffalse +% +%<*README> + + ¦----------------------------------------------¦ + ¦ ¦ + ¦ THE POLYGLOSSIA PACKAGE v1.0 ¦ + ¦ ¦ + ¦ Modern multilingual typesetting with XeLaTeX ¦ + ¦ ¦ + ¦----------------------------------------------¦ + +This package for provides a complete Babel replacement for users of XeLaTeX. +The initial version includes support for 54 different languages. + +Polyglossia makes it possible to automate the following tasks: + +* Loading the appropriate hyphenation patterns. +* Setting the script and language tags of the current font (if possible and + available), using the package fontspec. +* Switching to a font assigned by the user to a particular script or language. +* Adjusting some typographical conventions in function of the current language + (such as afterindent, frenchindent, spaces before or after punctuation marks, + etc.). +* redefining the document strings (like “chapter”, “figure”, “bibliography”). +* Adapting the formatting of dates (for non-gregorian calendars via external + packages bundled with polyglossia: currently the hebrew, islamic and farsi + calendars are supported). +* For languages that have their own numeration system, modifyinf the formatting + of numbers appropriately. +* Ensuring the proper directionality if the document contains languages + written from right to left (via the package bidi, available separately). + +Several features of Babel that do not make sense in the XeTeX world (like font +encodings, shorthands, etc) are not supported. + +Polyglossia is distributed in the traditional way with *.dtx and *.ins files, +and also comes with a TDS-conformant ready-to-unpack zip file. + +To install from source (i.e. using polyglossia.dtx), run + xelatex polyglossia.dtx +which will generate all files and produce the pdf documentation all at once. +Alternatively if you have the file polyglossia.ins run + xetex polyglossia.ins +and follow the instructions displayed. + + ------------------------------ + François Charette, July 2008 + + ------------------------------ +% +%<*internal> +\fi +% +% +%<*internal> +\begingroup +% +%<*batchfile> +\input docstrip.tex +\keepsilent +\preamble + ____________________________ + + The polyglossia package + (C) 2008 François Charette + License information appended + + +\endpreamble +\postamble + + Copyright (C) by François Charette + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either version 1.3 + of this license of (at your option) any later version. + The latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of LaTeX + version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is François Charette. + + +\endpostamble +\askforoverwritefalse +\generate{\file{polyglossia.sty}{\from{polyglossia.dtx}{polyglossia.sty}}} +\generate{\file{farsical.sty}{\from{polyglossia.dtx}{farsical.sty}}} +\generate{\file{hebrewcal.sty}{\from{polyglossia.dtx}{hebrewcal.sty}}} +\generate{\file{hijrical.sty}{\from{polyglossia.dtx}{hijrical.sty}}} +\generate{\file{cal-util.def}{\from{polyglossia.dtx}{cal-util.def}}} +\generate{\file{gloss-albanian.ldf}{\from{polyglossia.dtx}{gloss-albanian.ldf}}} +\generate{\file{gloss-arabic.ldf}{\from{polyglossia.dtx}{gloss-arabic.ldf}}} +\generate{\file{gloss-bahasai.ldf}{\from{polyglossia.dtx}{gloss-bahasai.ldf}}} +\generate{\file{gloss-bahasam.ldf}{\from{polyglossia.dtx}{gloss-bahasam.ldf}}} +\generate{\file{gloss-basque.ldf}{\from{polyglossia.dtx}{gloss-basque.ldf}}} +\generate{\file{gloss-brazil.ldf}{\from{polyglossia.dtx}{gloss-brazil.ldf}}} +\generate{\file{gloss-breton.ldf}{\from{polyglossia.dtx}{gloss-breton.ldf}}} +\generate{\file{gloss-bulgarian.ldf}{\from{polyglossia.dtx}{gloss-bulgarian.ldf}}} +\generate{\file{gloss-catalan.ldf}{\from{polyglossia.dtx}{gloss-catalan.ldf}}} +\generate{\file{gloss-coptic.ldf}{\from{polyglossia.dtx}{gloss-coptic.ldf}}} +\generate{\file{gloss-croatian.ldf}{\from{polyglossia.dtx}{gloss-croatian.ldf}}} +\generate{\file{gloss-czech.ldf}{\from{polyglossia.dtx}{gloss-czech.ldf}}} +\generate{\file{gloss-danish.ldf}{\from{polyglossia.dtx}{gloss-danish.ldf}}} +\generate{\file{gloss-divehi.ldf}{\from{polyglossia.dtx}{gloss-divehi.ldf}}} +\generate{\file{gloss-dutch.ldf}{\from{polyglossia.dtx}{gloss-dutch.ldf}}} +\generate{\file{gloss-english.ldf}{\from{polyglossia.dtx}{gloss-english.ldf}}} +\generate{\file{gloss-esperanto.ldf}{\from{polyglossia.dtx}{gloss-esperanto.ldf}}} +\generate{\file{gloss-estonian.ldf}{\from{polyglossia.dtx}{gloss-estonian.ldf}}} +\generate{\file{gloss-farsi.ldf}{\from{polyglossia.dtx}{gloss-farsi.ldf}}} +\generate{\file{gloss-finnish.ldf}{\from{polyglossia.dtx}{gloss-finnish.ldf}}} +\generate{\file{gloss-french.ldf}{\from{polyglossia.dtx}{gloss-french.ldf}}} +\generate{\file{gloss-galician.ldf}{\from{polyglossia.dtx}{gloss-galician.ldf}}} +\generate{\file{gloss-german.ldf}{\from{polyglossia.dtx}{gloss-german.ldf}}} +\generate{\file{gloss-greek.ldf}{\from{polyglossia.dtx}{gloss-greek.ldf}}} +\generate{\file{gloss-hebrew.ldf}{\from{polyglossia.dtx}{gloss-hebrew.ldf}}} +\generate{\file{gloss-hindi.ldf}{\from{polyglossia.dtx}{gloss-hindi.ldf}}} +\generate{\file{gloss-icelandic.ldf}{\from{polyglossia.dtx}{gloss-icelandic.ldf}}} +\generate{\file{gloss-interlingua.ldf}{\from{polyglossia.dtx}{gloss-interlingua.ldf}}} +\generate{\file{gloss-irish.ldf}{\from{polyglossia.dtx}{gloss-irish.ldf}}} +\generate{\file{gloss-italian.ldf}{\from{polyglossia.dtx}{gloss-italian.ldf}}} +\generate{\file{gloss-latin.ldf}{\from{polyglossia.dtx}{gloss-latin.ldf}}} +\generate{\file{gloss-latvian.ldf}{\from{polyglossia.dtx}{gloss-latvian.ldf}}} +\generate{\file{gloss-lsorbian.ldf}{\from{polyglossia.dtx}{gloss-lsorbian.ldf}}} +\generate{\file{gloss-magyar.ldf}{\from{polyglossia.dtx}{gloss-magyar.ldf}}} +\generate{\file{gloss-norsk.ldf}{\from{polyglossia.dtx}{gloss-norsk.ldf}}} +\generate{\file{gloss-nynorsk.ldf}{\from{polyglossia.dtx}{gloss-nynorsk.ldf}}} +\generate{\file{gloss-polish.ldf}{\from{polyglossia.dtx}{gloss-polish.ldf}}} +\generate{\file{gloss-portuges.ldf}{\from{polyglossia.dtx}{gloss-portuges.ldf}}} +\generate{\file{gloss-romanian.ldf}{\from{polyglossia.dtx}{gloss-romanian.ldf}}} +\generate{\file{gloss-russian.ldf}{\from{polyglossia.dtx}{gloss-russian.ldf}}} +\generate{\file{gloss-samin.ldf}{\from{polyglossia.dtx}{gloss-samin.ldf}}} +\generate{\file{gloss-sanskrit.ldf}{\from{polyglossia.dtx}{gloss-sanskrit.ldf}}} +\generate{\file{gloss-scottish.ldf}{\from{polyglossia.dtx}{gloss-scottish.ldf}}} +\generate{\file{gloss-serbian.ldf}{\from{polyglossia.dtx}{gloss-serbian.ldf}}} +\generate{\file{gloss-slovak.ldf}{\from{polyglossia.dtx}{gloss-slovak.ldf}}} +\generate{\file{gloss-slovenian.ldf}{\from{polyglossia.dtx}{gloss-slovenian.ldf}}} +\generate{\file{gloss-spanish.ldf}{\from{polyglossia.dtx}{gloss-spanish.ldf}}} +\generate{\file{gloss-swedish.ldf}{\from{polyglossia.dtx}{gloss-swedish.ldf}}} +\generate{\file{gloss-syriac.ldf}{\from{polyglossia.dtx}{gloss-syriac.ldf}}} +\generate{\file{gloss-thai.ldf}{\from{polyglossia.dtx}{gloss-thai.ldf}}} +\generate{\file{gloss-turkish.ldf}{\from{polyglossia.dtx}{gloss-turkish.ldf}}} +\generate{\file{gloss-ukrainian.ldf}{\from{polyglossia.dtx}{gloss-ukrainian.ldf}}} +\generate{\file{gloss-usorbian.ldf}{\from{polyglossia.dtx}{gloss-usorbian.ldf}}} +\generate{\file{gloss-welsh.ldf}{\from{polyglossia.dtx}{gloss-welsh.ldf}}} +\generate{\file{arabicdigits.map}{\from{polyglossia.dtx}{arabicdigits.map}}} +\generate{\file{farsidigits.map}{\from{polyglossia.dtx}{farsidigits.map}}} +\generate{\file{thaidigits.map}{\from{polyglossia.dtx}{thaidigits.map}}} +% +%\endbatchfile +%<*internal> +\generate{\file{polyglossia.ins}{\from{polyglossia.dtx}{batchfile}}} +\nopreamble\nopostamble +\generate{\file{README}{\from{polyglossia.dtx}{README}}} +\generate{\file{TODO}{\from{polyglossia.dtx}{TODO}}} +\generate{\file{gloss-template.ldf}{\from{polyglossia.dtx}{gloss-template.ldf}}} +\generate{\file{examples.tex}{\from{polyglossia.dtx}{examples.tex}}} +\generate{\file{example-arabic.tex}{\from{polyglossia.dtx}{example-arabic.tex}}} +\generate{\file{example-thai.tex}{\from{polyglossia.dtx}{example-thai.tex}}} +\endgroup +% +% +%<*driver> +\documentclass[11pt]{ltxdoc} +\usepackage{xltxtra} +\usepackage{xspace,fancyvrb} +\usepackage[neverdecrease]{paralist} +\usepackage[dvipdfm]{color} +\definecolor{myblue}{rgb}{0.02,0.04,0.48} +\definecolor{lightblue}{rgb}{0.61,.8,.8} +\definecolor{myred}{rgb}{0.65,0.04,0.07} +\definecolor{darkgray}{gray}{0.3} +\definecolor{lightgray}{gray}{0.6} +\definecolor{mygreen}{rgb}{0,.43,0} +\usepackage[dvipdfm, + bookmarks=true, + colorlinks=true, + linkcolor=myblue, + urlcolor=myblue, + citecolor=myblue, + hyperindex=false, + hyperfootnotes=false, + pdftitle={Polyglossia: A Babel replacement for XeLaTeX}, + pdfauthor={F Charette }, + pdfkeywords={xetex, xelatex, multilingual, babel, hyphenation} + ]{hyperref} +\usepackage{polyglossia,farsical} +\setmainlanguage[variant=uk]{english} +\setotherlanguages{arabic,hebrew,syriac,greek,russian} +\newcommand*\Cmd[1]{\cmd{#1}\DescribeMacro{#1}\xspace} +\newcommand*\pkg[1]{\textsf{\color{myblue}#1}} +\newcommand*\file[1]{\texttt{\color{myblue}#1}} +\newcommand*\TR[1]{\textcolor{myred}{#1}} +\newcommand*\TB[1]{\textcolor{myblue}{\bf #1}} +\def\eg{\textit{e.g.,}\xspace} +\def\ie{\textit{i.e.,}\xspace} +\def\ca{\textit{ca.}\@\xspace} +\def\Eg{\textit{E.g.,}\xspace} +\def\Ie{\textit{I.e.,}\xspace} +\def\etc{\@ifnextchar.{\textit{etc}}{\textit{etc.}\@\xspace}} + +\newlength{\oldparindent} +\newcommand{\parindentoff}{\setlength{\oldparindent}{\parindent} \setlength{\parindent}{0pt}} +\newcommand{\parindenton}{\setlength{\parindent}{\oldparindent}} + +%% Sidenotes << copied from fontspec.dtx +\newcommand\warn[2]{% + \edef\thisversion{#1}% + \ifhmode\unskip~\fi{\ifx\thisversion\fileversion\color{red}\fi + $\leftarrow$}% + \marginpar{\raggedleft + \small% + {\ifx\thisversion\fileversion\color{red}\fi$\rightarrow$}% + \,{\notefont #1:~#2}}} + +\newcommand\new[1]{% + \edef\thisversion{#1}% + \ifhmode\unskip~\fi{\ifx\thisversion\fileversion\color{blue}\else\color[gray]{0.5}\fi + $\leftarrow$}% + \marginpar{\raggedleft + \small\ifx\thisversion\fileversion\color{blue}\else\color[gray]{0.5}\fi + $\rightarrow$\,{\notefont #1:~New!}}} +\newcommand\displaycmd[2]{% + \\\DescribeMacro{#2}\centerline{\cmd{#1}}} +\renewenvironment{itemize}{\begin{compactitem}[\char"2023]}%[{\fontspec{DejaVu Sans}\char"25BB}]}% + {\end{compactitem}} +\renewenvironment{enumerate}{\begin{compactenum}}{\end{compactenum}} + +%% Sidenote font +\newfontfamily\notefont[Scale=MatchLowercase]{Lucida Sans Unicode} +%%% + +%% fontspec declarations: +\setromanfont[Mapping=tex-text]{Linux Libertine} +\defaultfontfeatures{Scale=MatchLowercase} +\setmonofont{DejaVu Sans Mono}%{Consolas} +\setsansfont{Lucida Sans Unicode} +\newfontfamily\arabicfont[Script=Arabic,Scale=1.5]{Scheherazade} +\newfontfamily\farsifont[Script=Arabic,Scale=1.33]{Farsi Simple Bold} +\newfontfamily\syriacfont[Script=Syriac,Scale=1.5,ExternalLocation="/mnt/data/fonts/syriac/"]{SyrCOMJerusalem.otf} +\newfontfamily\hebrewfont[Script=Hebrew]{SBL Hebrew} + +\newcommand\Babel{\pkg{babel}\xspace} + +\linespread{1.05} +\frenchspacing +\EnableCrossrefs +\CodelineIndex +\RecordChanges +% COMMENT THE NEXT LINE TO INCLUDE THE CODE +\AtBeginDocument{\OnlyDescription} +\begin{document} +\ifxetex + \DocInput{polyglossia.dtx} +\fi +\end{document} +% +% +% \fi +% +% \errorcontextlines=999 +% \makeatletter +% +% \GetFileInfo{polyglossia.sty} +% +% \title{\textcolor{lightblue}{\huge +% \fontspec[ExternalLocation="/mnt/data/fonts/greek/"]{GFSAmbrosia.otf} +% Π$\;\,$ο$\;\,$λ$\;\,$υ$\;\,$γ$\;\,$λ$\;\,$ω$\;\,$σ$\;\,$σ$\;\,$ι$\;\,$α}\\[16pt] +% \color{myblue}Polyglossia: A Babel Replacement for \XeLaTeX} +% \author{\scshape\color{myblue}François Charette} +% \date{\filedate \qquad \fileversion\\ +% \footnotesize (\textsc{pdf} file generated on \today)} +% +% \maketitle +% \tableofcontents +% +% +% \DeleteShortVerb{\|} +% \MakeShortVerb{\¦} +% +% ^^A\begin{abstract} +% ^^ABlablabla +% ^^A\end{abstract} +% +% +% \section{Introduction} +% +% Polyglossia is a package for facilitating multilingual typesetting with \XeLaTeX. +% Basically, it can be used as a replacement of \Babel{} for performing the +% following tasks automatically: +% +% \begin{enumerate} +% \item Loading the appropriate hyphenation patterns. +% \item Setting the script and language tags of the current font (if possible and +% available), via the package \pkg{fontspec}. +% \item Switching to a font assigned by the user to a particular script or language. +% \item Adjusting some typographical conventions in function of the current language +% (such as afterindent, frenchindent, spaces before or after punctuation marks, +% etc.). +% \item Redefining all document strings (like “chapter”, “figure”, “bibliography”). +% \item Adapting the formatting of dates (for non-gregorian calendars via external +% packages bundled with polyglossia: currently the hebrew, islamic and farsi +% calendars are supported). +% \item For languages that have their own numeration system, modifying the formatting +% of numbers appropriately (this also includes redefining the alphabetic sequence +% for non-Latin alphabets). +% \item Ensuring the proper directionality if the document contains languages +% that are written from right to left (via the package \pkg{bidi}, +% available separately). +% \end{enumerate} +% +% Several features of \Babel{} that do not make sense in the \XeTeX\ world (like font +% encodings, shorthands, etc.) are (obviously) not supported. +% Generally speaking, \pkg{polyglossia} aims to remain as compatible as possible +% with the fundamental features of \Babel{} while being cleaner, light-weight, +% and modern. The package \pkg{antomega} has been much beneficial in our attempt to +% reach this objective. +% +% \paragraph{Requirements:} The current version of \pkg{polyglossia} makes use of some convenient +% macros defined in the \pkg{etoolbox} package by Philipp Lehmann. Being designed +% specifically for \XeLaTeX, it obviously also relies on \pkg{fontspec} by Will +% Robertson. For languages written from right to left, it needs the package \pkg{bidi} +% (by the present author). Polyglossia also bundles three packages for calendaric +% computations (\pkg{hebrewcal}, \pkg{hijrical}, and \pkg{farsical}). +% +% \section{Loading language definition files} +% +% \subsection{The recommended way} +% You can determine the default language by means of the command: +% \displaycmd{\setdefaultlanguage[⟨options⟩]\{lang\}}{\setdefaultlanguage} +% (or equivalently \Cmd\setmainlanguage). +% Secondary languages can be loaded with +% \displaycmd{\setotherlanguage[⟨options⟩]\{lang\}}{\setotherlanguage}. +% These commands have the advantage of being explicit and of allowing to set +% language-specific options.\footnote{ % +% More on language-specific options below.} +% It is also possible to load a series of secondary languages at once using +% \displaycmd{\setotherlanguages\{lang1,lang2,lang3,…\}}{\setotherlanguages}. +% Language-specific options can be set or changed at any time by means of +% \displaycmd{\setkeys\{⟨lang⟩\}\{opt1=value1,opt2=value2,…\}}{\setkeys}. +% +% +% \subsection{The “Babel way”} +% As with \Babel{}, \pkg{polyglossia} also allows to load language definition files +% as package options. In most cases, option \texttt{⟨lang⟩} will load the file +% \file{gloss-⟨lang⟩.ldf}. Note however that the \textit{first} language listed in \\ +% \centerline{\cmd{\usepackage[lang1,lang2,…]{polyglossia}}} +% will be the default language for the document, which +% is the opposite convention of \Babel. +% Note also that this method may not work in some cases, and should be +% considered deprecated. +% +% \subsection{Supported languages} +% +% Table~\ref{tab:lang} lists all languages currently supported. +% Those in red have specific options and/or command +% that are explained in section \ref{specific} below. +% +% \begin{table}[h]\centering +% \label{tab:lang} +% \begin{tabular}{lllll}\hline +% albanian & czech & \TR{german} & \TR{magyar}& slovak \\ +% \TR{arabic}& danish & \TR{greek} & norsk & slovenian\\ +% bahasai & divehi & \TR{hebrew} & nynorsk & spanish \\ +% bahasam & dutch & hindi & polish & swedish \\ +% basque &\TR{english}& icelandic & portuges & \TR{syriac} \\ +% brazil &\TR{esperanto}& interlingua & romanian & \TR{thai} \\ +% breton & estonian & irish &\TR{russian}& turkish \\ +% bulgarian&\TR{farsi} & italian & samin & ukrainian \\ +% catalan & finnish & latin & sanskrit &\TR{usorbian} \\ +% coptic & french & latvian & scottish & welsh \\ +% croatian & galician & \TR{lsorbian} &\TR{serbian}& \\ +% \hline +% \end{tabular} +% \caption{Languages currently supported in \pkg{polyglossia}} +% \end{table} +% +% Some options are convenient shortcuts for loading languages with +% specific options: +% +% \begin{itemize} +% \item american = english with option ‘variant=american’ +% \item USenglish = english with option ‘variant=american’ +% \item UKenglish = english with option ‘variant=british’ +% \item british = english with option ‘variant=british’ +% \item australian = english with option ‘variant=australian’ +% \item newzealand = english with option ‘variant=newzealand’ +% \item ogerman = german with option ‘spelling=old’ +% \item monogreek = greek with option ‘variant=monotonic’ (or ‘mono’) +% \item polygreek = greek with option ‘variant=polytonic’ (or ‘poly’) +% \item ancientgreek = greek with option ‘variant=ancient’ +% \end{itemize} +% Another option (turned off by default) is ‘nolocalmarks’, which +% prevents the redefinition of the internal \LaTeX\ macros +% \cmd\markboth\ and \cmd\markright. +% +% \section{Language-switching commands} +% +% Whenever a language definition file \file{gloss-⟨lang⟩.ldf} is loaded, +% the command \cmd{\text⟨lang⟩[⟨options⟩]\{…\}} \DescribeMacro{\text⟨lang⟩} +% becomes available for short insertions of text in that language. +% For example ¦\textrussian{\today}¦ yields \textrussian{\today} +% Longer passages are better put between the environment ¦⟨lang⟩¦ +% (again with the possibility of setting language options locally. +% \DescribeEnv{⟨lang⟩} +% For instance the following allows us to quote the beginning +% of Homer’s \textit{Iliad}: +% +% \begin{Verbatim}[formatcom=\color{myblue}] +% \begin{greek}[variant=ancient] +% μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος οὐλομένην, ἣ μυρί' Ἀχαιοῖς ἄλγε' +% ἔθηκε, πολλὰς δ' ἰφθίμους ψυχὰς Ἄϊδι προί̈αψεν ἡρώων, αὐτοὺς δὲ ἑλώρια +% τεῦχε κύνεσσιν οἰωνοῖσί τε πᾶσι, Διὸς δ' ἐτελείετο βουλή, ἐξ οὗ δὴ τὰ +% πρῶτα διαστήτην ἐρίσαντε Ἀτρεί̈δης τε ἄναξ ἀνδρῶν καὶ δῖος Ἀχιλλεύς. +% \end{greek} +% \end{Verbatim} +% +% \begin{greek}[variant=ancient] +% μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος οὐλομένην, ἣ μυρί' Ἀχαιοῖς ἄλγε' ἔθηκε, +% πολλὰς δ' ἰφθίμους ψυχὰς Ἄϊδι προί̈αψεν ἡρώων, αὐτοὺς δὲ ἑλώρια τεῦχε κύνεσσιν +% οἰωνοῖσί τε πᾶσι, Διὸς δ' ἐτελείετο βουλή, ἐξ οὗ δὴ τὰ πρῶτα διαστήτην ἐρίσαντε +% Ἀτρεί̈δης τε ἄναξ ἀνδρῶν καὶ δῖος Ἀχιλλεύς. +% \end{greek} +% \bigskip +% +% Note that for Arabic one cannot use the environment ¦arabic¦, +% as \cmd\arabic\ is defined internally by \LaTeX. In this case +% we need to use the environment ¦Arabic¦ instead\DescribeEnv{Arabic}. +% This is the beginning of Ibn Khaldūn’s \textit{Muqaddima}: +% +% \begin{Verbatim}[formatcom={\color{myblue}\addfontfeature{Script=Arabic}}] +% \begin{Arabic} +% اعلم أنّ فنّ التاريخ فنّ عزيز المذهب، جمّ الفوائد، شريف الغاية؛ إذ هو +% يوقفنا على أحوال الماضين من الأمم في أخلاقهم، والأنبياء في سيرهم، والملوك +% في دولهم وسياستهم؛ حتّى تتمّ فائدة الإقتداء في ذلك لمن يرومه في أحوال +% الدين والدنيا. +% \end{Arabic} +% \end{Verbatim} +% +% \begin{Arabic} +% اعلم أنّ فنّ التاريخ فنّ عزيز المذهب، جمّ الفوائد، شريف الغاية؛ إذ هو يوقفنا على +% أحوال الماضين من الأمم في أخلاقهم، والأنبياء في سيرهم، والملوك في دولهم +% وسياستهم؛ حتّى تتمّ فائدة الإقتداء في ذلك لمن يرومه في أحوال الدين والدنيا. +% \end{Arabic} +% +% \subsection{Other commands} +% The following commands are probably of lesser interest to the end user, but +% ought to be mentioned here. +% \begin{itemize} +% \item \Cmd\selectbackgroundlanguage: this selects the global font setup and +% the numeration definitions for the default language. +% +% \item \Cmd\resetdefaultlanguage\ (experimental): +% completely switches the default language +% to another one in the middle of a document: \textit{this may have adverse effects}! +% +% \item \Cmd\normalfontlatin: in an environment where \cmd\normalfont\ has been redefined +% to a non-latin script, this will call the font defined with \cmd\setromanfont\ etc. +% Likewise it is possible to use \Cmd\rmfamilylatin, \Cmd\sffamilylatin, +% and \Cmd\ttfamilylatin. +% +% \item Also some macros defined in \Babel’s \file{hyphen.cfg} (and thus usually +% compiled into the xelatex format) are redefined, but keep a similar +% behaviour, namely \Cmd\selectlanguage, \Cmd\foreignlanguage, +% and the environment ¦otherlanguage¦\DescribeEnv{otherlanguage}. +% \end{itemize} +% ^^A +% Since the \XeLaTeX\ format incorporates \Babel{}'s \file{hyphen.cfg}, +% the low-level commands for hyphenation and language switching +% defined there are also accessible.\footnote{ % +% The file \file{hyphen\_cfg} (available on the +% \href{http://scripts.sil.org/svn-view/xetex/TRUNK/texmf/tex/xelatex/polyglossia/hyphen\_cfg}{\XeTeX\ subversion repository}) +% is meant to eventually replace \Babel’s \file{hyphen.cfg}. If you want +% to experiment with it, rename it into \file{hyphen.cfg}, copy it to +% \texttt{…/tex/xelatex/polyglossia/} and rebuild the xelatex format.} +% +% \section{Language-specific options and commands}\label{specific} +% +% This section gives a list of all languages for which options and end-user commands are defined. +% The default value of each option is given in italic. +% +% \subsection{arabic} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{calendar} = \textit{islamic} (= hijri) or gregorian +% \item \TB{locale} = \textit{default},\footnote{ % +% For Egypt, Sudan, Yemen and the Golf states.} +% mashriq,\footnote{ % +% For Iraq, Syria, Jordan, Lebanon and Palestine.} +% libya, algeria, tunisia, morocco, or mauritania. +% This setting influences the spelling of the month names for the Gregorian calendar, +% as well as the form of the numerals (unless overriden by the following option). +% \item \TB{numerals} = \textit{mashriq} or maghrib +% (the latter is the default when locale = algeria, tunisia or morocco) +% \end{itemize} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\abjad and \Cmd\abjadmaghribi (see section \ref{abjad}) +% \end{itemize} +% +% \subsection{english} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{variant} = \textit{american} (= us), british (= uk), australian or newzealand +% \item \TB{ordinalmonthday} = true/\textit{false} (true by default only when variant = british) +% \end{itemize} +% +% \subsection{esperanto} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\hodiau\ and \Cmd\hodiaun are special forms of \cmd\today\ (see the \Babel\ documentation) +% \end{itemize} +% +% \subsection{farsi} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{numerals} = western or \textit{eastern} +% \item \TB{locale} (not yet implemented) +% \item \TB{calendar} (not yet implemented) +% \end{itemize} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\abjad (see section \ref{abjad}) +% \end{itemize} +% +% \subsection{german} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{spelling} = \textit{new} or old +% \end{itemize} +% +% \subsection{greek} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{variant} = \textit{monotonic} (= mono), polytonic (= poly), or ancient +% \item \TB{numerals} = \textit{greek} or arabic +% \item \TB{attic} = \textit{false}/true +% \end{itemize} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\Greeknumber and \Cmd\greeknumber \ (see section \ref{abjad}). +% \item The command \Cmd\atticnumeral (= \Cmd\atticnum) (activated with +% the option ¦attic=true¦), displays numbers using the acrophonic +% numbering system (defined in the Unicode range +% \textsf{U+10140–U+10174}).\footnote{ % +% See the documentation of the \pkg{xgreek} package for more details.} +% \end{itemize} +% +% \subsection{hebrew} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{numerals} = hebrew or \textit{arabic} +% \item \TB{calendar} = hebrew or \textit{gregorian} +% \end{itemize} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\hebrewnumeral\ (= \Cmd\hebrewalph) (see section \ref{abjad}). +% \end{itemize} +% +% +% \subsection{lsorbian and usorbian} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\oldtoday : see the \Babel documentation. +% \end{itemize} +% +% \subsection{magyar} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\ontoday\ (= \Cmd\ondatemagyar): special forms of \cmd\today\ +% (see the \Babel\ documentation). +% \end{itemize} +% +% +% \subsection{russian} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{spelling} = \textit{modern} or old (for captions and date only, not for hyphenation) +% \end{itemize} +% +% \subsection{serbian} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{script} = \textit{cyrillic} or latin +% \end{itemize} +% +% \subsection{syriac} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{numerals} = \textit{western} (i.e., 1234567890) or eastern +% (for which the Oriental Arabic numerals are used: \textarabic{١٢٣٤٥٦٧٨٩٠}). +% \end{itemize} +% \textbf{Commands}: +% \begin{itemize} +% \item \Cmd\abjadsyriac (see section \ref{abjad}) +% \end{itemize} +% +% \subsection{thai} +% \textbf{Options}: +% \begin{itemize} +% \item \TB{numerals} = thai or \textit{arabic} +% \end{itemize} +% +% To insert the word breaks, you need to use an external processor. +% See the documentation to \pkg{thai-latex} and the file \file{testthai.tex} +% that comes with this package. +% +% \section{Alphabetic numeration in Greek, Arabic, Hebrew, Syriac and Farsi}\label{abjad} +% +% In certain languages, numbers can be represented +% by a special alphanumerical notation.\footnote{ % +% See, e.g., \url{http://en.wikipedia.org/wiki/Greek_numerals}, +% \url{http://en.wikipedia.org/wiki/Abjad_numerals}, +% and \url{http://en.wikipedia.org/wiki/Hebrew_numerals}.} +% ^^A \url{http://en.wikipedia.org/wiki/Syriac_alphabet} +% Note that the Hebrew implementation in \pkg{polyglossia} is currently less +% sophisticated than the one in \Babel, where various special cases are taken into +% account. +% +% The Greek numerals are obtained with \Cmd\greeknumeral (or \Cmd\Greeknumeral\ in uppercase). +% Example: ¦\greeknumeral{1863}¦ yields \textgreek{\greeknumeral{1863}}. +% +% The Arabic \textit{abjad} numbers can be generated with the command \Cmd\abjad. +% Example: ¦\abjad{1863}¦ yields {\arabicfont\abjad{1863}}. +% In the Maghrib the conventions are somewhat different, and the maghribi forms +% of the \textit{abjad} numerals are obtained with the \Cmd\abjadmaghribi\ command. +% Example: ¦\abjadmaghribi{1863}¦ yields {\arabicfont\abjadmaghribi{1863}}. +% +% Hebrew numerals are generated with the command \Cmd\hebrewnumeral. +% Example: +% ¦\hebrewnumeral{1863}¦ yields {\hebrewfont\hebrewnumeral{1863}}. +% +% Support is also provided for Syriac abjad numerals, which can be generated +% with \Cmd\abjadsyriac. +% Example: ¦\abjadsyriac{463}¦ yields {\syriacfont\abjadsyriac{463}}. +% +% \section{Calendars} +% +% \subsection{Hebrew calendar (hebrewcal.sty)} +% The package \file{hebrewcal.sty} is almost a verbatim copy of \file{hebcal.sty} +% that comes with \Babel. +% The command \Cmd\Hebrewtoday\\ formats the current date in the Hebrew calendar +% (depending of the current writing direction this will automatically set either +% in Hebrew script or in roman transliteration). +% +% \subsection{Islamic calendar (hijrical.sty)} +% This new package computes dates in the Islamic (Hijra) calendar, which is lunar.\footnote{ % +% It makes use of the arithmetical algorithm in chapter 6 of +% Reingold \& Gershowitz, \textit{Calendrical calculation: the Millenium edition} +% (Cambridge University Press, 2001).\label{reingold}} +% It provides two macros for the end-user. +% The command +% \displaycmd{\HijriFromGregorian\{⟨year⟩\}\{⟨month⟩\}\{⟨day⟩\}}{\HijriFromGregorian} +% sets the counters ¦Hijriday¦, ¦Hijrimonth¦ and ¦Hijriyear¦. +% \Cmd\Hijritoday\ formats the Hijri date for the current day (depending of the +% current writing direction this is set either in Arabic or in roman transliteration). +% It also accepts an optional argument to add or subtract a correction +% (in days) to the date computed by the arithmetical algorithm.\footnote{ % +% The Islamic calendar is indeed a purely lunar calendar based on the observation +% of the first visibility of the lunar crescent at the beginning of the lunar month, +% so their can be differences between different localities, as well as between +% civil and religious authorities.} +% For instance if ¦\Hijritoday¦ yields the date “7 Rajab 1429” (which is the date that was +% displayed on the front page of \href{http://www.aljazeera.net}{aljazeera.net} on +% 11th July 2008), ¦\Hijritoday[1]¦ would rather print “8 Rajab 1429” (the date +% indicated the same day on the site \href{http://www.gulfnews.com}{gulfnews.com}). +% +% \subsection{Farsi (jalālī) calendar (farsical.sty)} +% Again this is taken almost verbatim from ¦Arabiftoday.sty¦ (in the \pkg{Arabi} package), +% itself a slight modification of the file ¦ftoday.sty¦ in Farsi\TeX.\footnote{ % +% I intend to rewrite \pkg{farsical} from scratch using the algorithm in +% Reingold \& Gershowitz (ref.~n.~\ref{reingold}).} +% Here we have renamed the command \cmd\ftoday\ to +% \Cmd\Jalalitoday. Example: today is \Jalalitoday. +% +% +% ^^A\section{Varia} +% +% +% \section{Acknowledgements} +% \pkg{Polyglossia} is notable for being a recycle box of previous contributions +% by other people. I take this opportunity to thank the following individuals, +% whose splendid work has made my task almost trivial in comparision: Johannes +% Braams and the numerous contributors to the \Babel{} package (in particular +% Boris Lavva and others for its Hebrew support), Alexej Kryukov (\pkg{antomega}), Will +% Robertson (\pkg{fontspec}), Apostolos Syropoulos (\pkg{xgreek}), Youssef Jabri +% (\pkg{arabi}), and Vafa Khalighi (\pkg{xepersian}). I should also thank other +% individuals for their assistance in supporting specific languages: Yves Codet +% (Sanskrit), Zdenek Wagner (Hindi), and other members of the \XeTeX\ user +% community. And of course my gratitude also goes to Jonathan Kew, the formidable +% author of \XeTeX! +% +% +% +% +% \StopEventually{} +% \section{Implementation} +% \iffalse +%<*polyglossia.sty> +% \fi +% \clearpage +% +% \subsection{polyglossia.sty} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{polyglossia}[2008/07/11 v1.0 + Babel replacement for XeLaTeX] +\RequirePackage{etoolbox} % TEMPORARY? but so convenient! +\RequirePackage{fontspec} %which itself depends on xkeyval +\providecommand*{\xpg@warning}[1]{% + \PackageWarning{polyglossia}% + {#1}} +\providecommand*{\xpg@info}[1]{% + \PackageInfo{polyglossia}% + {#1\@gobble}} %% the \@gobble is to prevent displaying the line nr +\providecommand*{\xpg@nopatterns}[1]{% + \xpg@warning{No hyphenation patterns were loaded for `#1'\MessageBreak + I will use the patterns loaded for \string\language=0\MessageBreak instead}} +\providecommand*{\xpg@nolang}[1]{% + \xpg@warning{Couldn't find file gloss-#1.ldf!}}% + %TODO try at least to load the hyphenation patterns for #1. +\def\xpg@ill@value#1#2{% + \xpg@warning{Illegal value (#1) for #2}} + +\def\xpg@csifdef@warn#1{% + \ifcsundef{#1}{\PackageWarning{polyglossia}{ #1 is not defined}}% + {\expandafter\protect\csname #1\endcsname}} + +\def\xpg@csifdef#1{\ifcsundef{#1}{\relax}{\expandafter\protect\csname #1\endcsname}} + + +\def\@@ensure@dir#1{\ifcsundef{@ensure@dir}{#1}{\@ensure@dir{#1}}} +\def\@@ensure@maindir#1{\ifcsundef{@ensure@maindir}{#1}{\@ensure@maindir{#1}}} + +\def\opt@enabled{on} +\def\opt@disabled{off} +\define@key{polyglossia}{localmarks}[on]{% + \def\@tmpa{#1} + \ifx\@tmpa\opt@enabled + \def\local@marks##1{% + \def\markboth####1####2{% + \begingroup% + \let\label\relax \let\index\relax \let\glossary\relax% + \unrestored@protected@xdef\@themark% + {{\foreignlanguage{##1}{% + \protect\@@ensure@maindir{####1}}}% + {\foreignlanguage{##1}{% + \protect\@@ensure@maindir{####2}}}}% + \@temptokena \expandafter{\@themark}% + \mark{\the\@temptokena}% + \endgroup% + \if@nobreak\ifvmode\nobreak\fi\fi}% + \def\markright####1{% + \begingroup% + \let\label\relax \let\index\relax \let\glossary\relax% + \expandafter\@markright\@themark% + {\foreignlanguage{##1}{\protect\@@ensure@maindir{####1}}}% + \@temptokena \expandafter{\@themark}% + \mark{\the\@temptokena}% + \endgroup% + \if@nobreak\ifvmode\nobreak\fi\fi}% + \def\@markright####1####2####3{\@temptokena{\protect\@@ensure@maindir{####1}}% + \unrestored@protected@xdef\@themark{{\the\@temptokena}% + {{\protect\@@ensure@maindir{####3}}}}}} + \else\ifx\@tmpa\opt@disabled + \def\local@marks#1{} + \xpg@info{Option: localmarks=off} + \fi% + \fi% +} +\setkeys{polyglossia}{localmarks=on} + +%%TODO Use the etoolbox macros instead! +%\def\oaddto#1#2{% +% \ifx#1\@undefined +% \def#1{#2}% +% \else +% \ifx#1\relax +% \def#1{#2}% +% \else +% {\toks@\expandafter{#1#2}% +% \xdef#1{\the\toks@}}% +% \fi +% \fi +%} + +\newcommand{\setdefaultlanguage}[2][]{% + \IfFileExists{gloss-#2.ldf}% + {\ifcsundef{#2@loaded}% from etoolbox.sty + {\input{gloss-#2.ldf}% + \xpg@info{Default language is #2.} + \def\languagename{#2}% + % This is needed because \arabic is a built-in LaTeX command: + % so now we have \begin{Arabic}... instead of \begin{arabic}... + \edef\@tmpa{arabic}% + \edef\@tmpb{#2}% + \ifx\@tmpb\@tmpa% + \newenvironment{Arabic}[1][]{\begin{otherlanguage}[####1]{arabic}}% + {\end{otherlanguage}}% + \else% + \newenvironment{#2}[1][]{\begin{otherlanguage}[####1]{#2}}% + {\end{otherlanguage}}% + \fi% + \expandafter\newcommand\csname text#2\endcsname[2][]{% + \ifcsdef{RL}% + {\ifcsundef{#2@RL}% + {\@ensure@LR{\foreignlanguage[####1]{#2}{####2}}}% + {\@ensure@RL{\foreignlanguage[####1]{#2}{####2}}}}% + {\foreignlanguage[####1]{#2}{####2}}% + }% + \csletcs{local#2}{text#2}% + \csgdef{#2@loaded}{}% + \gdef\xpg@main@language{#2}% + }% + {\PackageWarning{polyglossia}{gloss-#2.ldf is already loaded!}}% + %% The following settings are for the default language and script: + \ifcsundef{#2@RL}{}% + {\@rlmaintrue\@rl@footnotetrue% + \let\@@oddfoot\@oddfoot% + \let\@@evenfoot\@evenfoot% + \let\@oddfoot\@@evenfoot% + \let\@evenfoot\@@oddfoot% + \let\@@oddhead\@oddhead% + \let\@@evenhead\@evenhead% + \let\@oddhead\@@evenhead% + \let\@evenhead\@@oddhead% + }% + \AtBeginDocument{% + \selectlanguage[#1]{#2}% + \selectbackgroundlanguage{#2}}% + }% + %ELSE + {\xpg@nolang{#2}}}% + +\let\setmainlanguage=\setdefaultlanguage + +\newcommand{\resetdefaultlanguage}[2][]{% + \ifcsundef{#2@loaded}{% + \PackageError{polyglossia}{gloss-#2.ldf is not loaded!}}% + {\def\languagename{#2}% + \ifcsundef{#2@RL}{}{\@rlmaintrue\@rl@footnotetrue}% + \selectlanguage[#1]{#2}% + \selectbackgroundlanguage{#2}}} + +% This saves the normalfont for the latin script since we may change normalfont in other scripts +\let\normalfontlatin=\normalfont% +\let\rmfamilylatin=\rmfamily% +\let\sffamilylatin=\sffamily% +\let\ttfamilylatin=\ttfamily% + +\def\reset@latin@script{% + \let\rmfamily=\rmfamilylatin% + \let\sffamily=\sffamilylatin% + \let\ttfamily=\ttfamilylatin% + \normalfontlatin} + +\def\reset@LR{\xpg@csifdef{setLR}} + +\let\@@fterindentfalse\@afterindentfalse +\def\french@indent{\let\@afterindentfalse\@afterindenttrue + \@afterindenttrue} +\def\nofrench@indent{\let\@afterindentfalse\@@fterindentfalse + \@afterindentfalse} + +\newcommand{\selectbackgroundlanguage}[1]{% + \xpg@csifdef{selectnormalfont#1}% + \xpg@csifdef{#1@globalnumbers}% + } + +\newcommand{\setotherlanguage}[2][]{% + \IfFileExists{gloss-#2.ldf}% + {\ifcsundef{#2@loaded}% + {\input{gloss-#2.ldf}% + \setkeys{#2}{#1}% + \edef\@tmpa{arabic}% + \edef\@tmpb{#2}% + \ifx\@tmpb\@tmpa% + \newenvironment{Arabic}[1][]{\begin{otherlanguage}[####1]{arabic}}% + {\end{otherlanguage}}% + \else% + \newenvironment{#2}[1][]{\begin{otherlanguage}[####1]{#2}}% + {\end{otherlanguage}}% + \fi% + \expandafter\newcommand\csname text#2\endcsname[2][]{% + \ifcsdef{RL}{% + \ifcsundef{#2@RL}% + {\@ensure@LR{\foreignlanguage[####1]{#2}{####2}}}% + {\@ensure@RL{\foreignlanguage[####1]{#2}{####2}}}% + }{% else + \foreignlanguage[####1]{#2}{####2}% + }}% + \csletcs{local#2}{text#2}% + \csgdef{#2@loaded}{}% + }% + {\PackageWarning{polyglossia}{gloss-#2.ldf is already loaded!}}% + }% + %ELSE + {\xpg@nolang{#2}}% + %TODO ? \expandafter\ifx\csname l@#2\endcsname\@undefined + %\xpg@nopatterns{#2}\expandafter\adddialect\csname l@#2\endcsname 0% + %\else\expandafter\expandafter\protect\language=\csname l@#2\endcsname\fi% +} + +\newcommand\setotherlanguages[1]{% + \def\do##1{\setotherlanguage{##1}}% + \docsvlist{#1}}% from etoolbox.sty + +\def\common@language{% + \protect\language=0% + \lefthyphenmin=2\righthyphenmin=3} + +\def\noextrascurrent#1{\xpg@csifdef{noextras@#1}} + +\def\xpg@initial@setup{\ifcsundef{languagename}{}% + {\noextrascurrent{\languagename}}% + \common@language} + +\AtBeginDocument{\xpg@initial@setup} + +\ifcsundef{foreignlanguage}{}% + {\let\foreignlanguage\@undefined} + +\newcommand{\foreignlanguage}[3][]{% + \ifcsundef{#2@loaded}{\xpg@nolang{#2}}{% + {\def\languagename{#2}% + \setkeys{#2}{#1}% + \xpg@csifdef@warn{#2@font}% + \xpg@csifdef@warn{#2@language}% + \xpg@csifdef{date#2}% + \xpg@csifdef{#2@numbers}% + \use@localhyphenmins{#2}% + \xpg@csifdef{inlineextras@#2}% + #3}% +}} + +\ifcsundef{selectlanguage}{}% + {\let\selectlanguage\@undefined} + +\newcommand{\selectlanguage}[2][]{% + \ifcsundef{#2@loaded}{\xpg@nolang{#2}}{% + \def\xpg@pop@language{% + \xpg@set@language{\languagename}% + \let\emp@langname\@undefined}% + \aftergroup\xpg@pop@language% + \setkeys{#2}{#1}% + \xpg@set@language{#2}% +}} + +\newcommand{\xpg@set@language}[1]{% + \select@language{#1}% + \if@filesw% + \protected@write\@auxout{}{\protect\select@language{#1}}% + \addtocontents{toc}{\protect\select@language{#1}}% + \addtocontents{lof}{\protect\select@language{#1}}% + \addtocontents{lot}{\protect\select@language{#1}}% + \fi% +} + +\ifcsundef{select@language}{}% + {\let\select@language\@undefined} + +\newcommand{\select@language}[1]{% + \xpg@initial@setup% + \edef\languagename{#1}% + \ifcsundef{RL}{}% + {\ifcsundef{#1@RL}{\setLR}{\setRL}}% + \xpg@csifdef@warn{#1@font}% + \xpg@csifdef@warn{#1@language}% + \use@localhyphenmins{#1}% + \xpg@csifdef{captions#1}% + \xpg@csifdef{date#1}% + \xpg@csifdef{#1@numbers}% + \local@marks{#1}% + \xpg@csifdef{blockextras@#1}% +} + +\let\xpg@pop@language\relax + +\ifcsundef{otherlanguage}{}% + {\let\otherlanguage\@undefined} +\ifcsundef{endotherlanguage}{}% + {\let\endotherlanguage\@undefined} + +\newenvironment{otherlanguage}[2][]{% + \selectlanguage[#1]{#2}% + }{} + +\newcommand{\setlocalhyphenmins}[3]{% + \providehyphenmins{#1}{#2#3}} + +\def\use@localhyphenmins#1{% + \ifcsundef{#1hyphenmins}{}% + {\expandafter\expandafter\expandafter\set@hyphenmins\csname #1hyphenmins\endcsname\relax}} + +%% package options +\DeclareOption{nolocalmarks}{\setkeys{polyglossia}{localmarks=off}} +\DeclareOption{quiet}{% + \gdef\@latex@info#1{\relax}% no latex info + \gdef\@font@info#1{\relax}% no latex font info + \gdef\@font@warning#1{\relax}% no latex font warnings + \gdef\zf@PackageInfo#1{\relax}% no fontspec info + \gdef\xpg@info#1{\relax}}% no polyglossia info +\DeclareOption{USenglish}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=american]{english}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=american]{english}}}% + \@temp} +\DeclareOption{american}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=american]{english}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=american]{english}}}% + \@temp} +\DeclareOption{UKenglish}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=british]{english}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=british]{english}}}% + \@temp} +\DeclareOption{british}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=british]{english}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=british]{english}}}% + \@temp} +\DeclareOption{australian}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=australian]{english}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=australian]{english}}}% + \@temp} +\DeclareOption{newzealand}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=newzealand]{english}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=newzealand]{english}}}% + \@temp} +\DeclareOption{ngerman}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[spelling=new]{german}}}% + {\edef\@temp{\noexpand\setotherlanguage[spelling=new]{german}}}% + \@temp} +\DeclareOption{polygreek}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=poly]{greek}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=poly]{greek}}}% + \@temp} +\DeclareOption{monogreek}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=mono]{greek}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=mono]{greek}}}% + \@temp} +\DeclareOption{ancientgreek}{% +\ifcsundef{xpg@main@language}% + {\edef\@temp{\noexpand\setdefaultlanguage[variant=ancient]{greek}}}% + {\edef\@temp{\noexpand\setotherlanguage[variant=ancient]{greek}}}% + \@temp} +%%% FIXME: this does not work when gloss-