% \CheckSum{202} % \iffalse % % file `ibycus.dtx'. % Copyright (c) 2004, 2005 Peter Heslin, Walter Schmidt % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (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 2003/12/01 or later. % % This work has the LPPL maintenance status "maintained". % % This Current Maintainers of this work are P.~Heslin and W.~Schmidt % % This work consists of the files % ibycus-babel.dtx, ibycus-babel.ins, ibyhyph.pl, % and the derived files % ibycus.ldf, lgienc.def and lgifib.fd. % %<*driver> \ProvidesFile{ibycus-babel.dtx} % % %\ProvidesLanguage{ibycus} %\ProvidesFile{lgifib.fd}% %\ProvidesFile{lgienc.def}% [2005/11/23 v3.0 (PH/WaS)] % %<*driver> \documentclass{ltxdoc} \usepackage{hyperref} \usepackage{url} \OnlyDescription \begin{document} \DocInput{ibycus-babel.dtx} \end{document} % % % \fi % % \GetFileInfo{ibycus-babel.dtx} % \title{Typesetting ancient Greek\\ using Ibycus-encoded fonts with the Babel system} % \author{Peter Heslin\thanks{\texttt{p.j.heslin@dur.ac.uk}} \and Walter Schmidt\thanks{\texttt{w-a-schmidt@gmx.net}}} % \date{\fileversion{} -- \filedate} % \makeatletter % \def\eTeX{$\m@th\varepsilon$-\TeX} % \makeatother % % \maketitle % % \sloppy % % \section{Overview} % The present document describes a new interface for Greek fonts with % the so-called `Ibycus' encoding, % to use them in conjunction with the Babel system for multilanguage typesetting. % It constitutes an alternative to the well-known macro packages % |ibycus4.sty| and |psibycus.sty|, which are distributed together with % Pierre A. MacKay's original Ibycus fonts. % The main advantage over these packages is that automatic % hyphenation is provided for the Greek language. Notice, however, that % a \TeX\ program with the so-called \eTeX\ extensions is required. % The implementation is available for \LaTeXe\ only; there are no % corresponding macro files for plain~\TeX\ or \LaTeX~2.09. % % % \section{\texorpdfstring{{\boldmath Why \eTeX?}}{Why \eTeX?}} % With `ordinary' \TeX, % hyphenation of Greek words will not work properly, if the end of a mixed Greek % and Latin-alphabet paragraph does not coincide with the end of the % Greek. This is due to a misfeature in \TeX: Only one set of % so-called lccodes is used throughout the length of a paragraph -- only % those which are valid at its end. These codes must be adjusted for % the Ibycus notation in order to tell \TeX\ that accents and breathings % a part of the words, rather than punctuation. So if you have reverted back % to a Latin-written language at the end of the paragraph, the wrong % codes for Greek hyphenation are in effect, and the diacritics in Greek words % are wrongly considered as punctuation. % The problem does, however, \emph{not} occur with an \eTeX\ program; i.e., a % \TeX\ program with certain extended capabilites. In fact, you are % probably already using \eTeX, even if you did not realize it. % All up-to-date \LaTeX\ systems are now built upon an \eTeX\ typesetting % engine, rather than on the classical \TeX\ program. % % \section{Basic usage} % The Greek fonts are assigned a (pseudo-)language named |ibycus|, % which can be used (almost) like any other language supported by % Babel. To enable the use of this language in your document, specify % it as an option to the Babel package just as you would do for any % other language. For instance, to write a document in German with % some Greek passages: % \begin{verse} % |\usepackage[ibycus,ngerman]{babel}| % \end{verse} % % A few caveats: Do not declare |ibycus| as the default % language of the document; it is not suitable for this purpose! % In other words, |ibycus| must never be the last option for Babel. % And, of course, do not use it together with the packages |ibycus4| % or |psibycus|. % % The language |ibycus| should be selected only \emph{locally}. % Either use the |ibycus| environment to typeset larger passages of Greek text: % \begin{verse} % |\begin{ibycus} | \\ % | (Hrodo'tou Qouri'ou i(stori'hs a)po'decis h('de, | \\ % | ... | \\ % | h(`n ai)ti'hn e)pole'mhsan a)llh'loisi. | \\ % |\end{ibycus} | % \end{verse} % or use the command |\ibygr|, which is more appropriate for % short pieces of Greek within Latin-written text: % \begin{verse} % |... Latin, \ibygr{a)rxai=a gra'mmata} and Latin again| % \end{verse} % In fact, the environment |ibycus| is nothing but an abbreviation for % Babel's |otherlanguage| environment with the option |ibycus|, and % |\ibygr{...}| is the same as |\foreignlanguage{ibycus}{...}|. % % Within the environment |ibycus| or the argument of |\ibygr|, % the Ibycus-specific input notation is to be used to enter Greek. This % notation is described in the documentation that comes with the Ibycus % fonts. % % Notice a particular difference between |ibycus| and other languages % of the Babel system: Switching to the language |ibycus| selects % both a particular font encoding (|LGI|) and a particular font family (by default |fib|), % regardless of the font family that was active before. % % Greek fonts and the related input notation can also be % selected without changing the hyphenation tables; to do so, use the % declaration |\ibycustext| or the text-generating command % |\textibycus{...}|. These macros exist more or less only as a % side-effect of the implementation; they should normally not be % needed. % % To switch temporarily back to the Latin alphabet within a piece of % Greek text (without, however, changing the hyphenation table), use % the declaration |\latintext| or the text-generating macro % |\textlatin{...}|. When Babel is loaded with the option |ibycus|, % these commands not only switch back to the default Latin font % encoding as usual; they also select the default font family of the % document. % % Ibycus-encoded fonts provide a few traditional text-editor symbols % for critical editions: % % \begin{center} % \begin{tabular}{ll} % \verb+\braceleft + & left curly brace \\ % \verb+\braceright + & right curly brace\\ % \verb+\bracketleftbt + & left half square bracket\\ % \verb+\bracketrightbt+ & right half square bracket\\ % \verb+\sdagger + & single dagger\\ % \verb+\dbldagger + & double dagger\\ % \end{tabular} % \end{center} % Use of these symbols is not restricted to Greek % passages. \textbf{Caution:} % In the Ibycus4 package the single dagger carries the name |\dagger|. % However, this macro belongs to the \LaTeX\ kernel and should not be redefined, % so the name |\sdagger| is now used for the Ibycus-specific symbol. % % % \section{Using alternative typefaces} % \label{sec:typefaces} % By default, Pierre A. MacKay's original Ibycus font family is used to typeset % the Greek passages. % From version 3.0 on the Ibucus-Babel interface supports also other font families % with the same encoding. % % To select the Greek font family manually, issue the command % \begin{verse} % |\renewcommand{\ibycusdefault}|\marg{family} % \end{verse} % after loading of Babel---provided, of course, that the indicated font family is % indeed available with the Ibycus encoding LGI. % Macro packages to support alternative font familes in general may already include % this action; see the related documentation. % % If you intend to write a class or package which is to change the font family % used by the Ibycus-Babel interface, or if you want to implement a font family % with Ibycus encoding, see the documentation of the source code, % particularly the last section. % % % \section{Scaling the Greek fonts} % It may sometimes be useful to typeset the Greek fonts a little bit larger % % or smaller (as compared with their `natural' size), to make them blend better % with the typeface used for Latin. % This can be accomplished through the macro |\setgreekfontscale|. For instance, % |\setgreekfontscale{1.05}| will enlarge the Greek fonts by 5\%. % The command can be issued in the preamble only. % % % \section{The hyphenation patterns} % The hyphenation patterns for the Ibycus encoding were % generated by running the Perl script \path{ibyhyph.pl} on % Dimitrios Filippou's \path{GRAhyph4.tex}, which can be found in the % CTAN directory \path{language/hyphenation/elhyphen}. This is an % improved set of hyphenation patterns for ancient Greek with LGR encoding; % Babel does not currently use it by default. With version~3 of the % Ibycus-Babel interface, additional manual patches were applied to the % patterns, in order to fix a bug regarding the use of `lunate sigmas'. % % Dimitrios Filippou's improved hyphenation patterns discover far more % hyphenation points than the default Babel patterns, and are more % accurate, especially for compound words. % You will notice that there are more hyphenation % points right after the first letter of words beginning % with a vowel + consonant + vowel. Some may find such hyphenations % surprising, but they are legal, according to the rules for hyphenation % of Greek, ancient and modern; see the account by Yannis Haralambous: % `From Unicode to Typography, a Case Study: the Greek Script' % \path{}, pp~18f. % If you find these hyphenation points ugly, issue the command % \begin{verse} % |\def\ibycushyphenmins{2 2}| % \end{verse} % after loading of Babel in order to suppress them. % % Filippou's patterns also include legal hyphenation points % immediately before the last letter of a word. However, the % Ibycus-Babel interface suppresses them, since they are not only ugly % but also of little practical use. % % Please contact Peter Heslin if you come across any words that % Ibycus hyphenates differently from the corresponding LGR-encoded % patterns (except for the suppressed hyphenation before the last % letter of a word). % % % \section{Problems and deficiencies} % \begin{itemize} % \item Globally changing the language to |ibycus|, i.e., a sequence such as % \begin{verse} % |\selectlanguage{ibycus}| \\ % \textit{Greek text\dots} \\ % |\selectlanguage{|\textit{anything}|}| \\ % \end{verse} % may have unwanted effects, for instance on the font selection. % This can be avoided by selecting % the language |ibycus| only within a group or environment, % or by using the commands |\ibygr| or |\foreignlanguage|. % \item The behavior of the existing commands \cmd{\textlatin} % and \cmd{\latintext} is altered: % They will switch to the the default font family of the document, % rather than leaving the current font family untouched. % \item The command \cmd{\setgreekfontscale} has no effect % when the Ibycus fonts are already in use; % this situation is, however, rather unlikely in the preamble. % \end{itemize} % % % \section{Incompatible changes over version 1.5} % The names of several commands and environments have changed: % \begin{center} % \begin{tabular}{ll} % Version 1.5: & Version 2.4 and later \\ \hline % \cmd{\gk} & \cmd{\ibygr} \\ % \texttt{greek} (environment) & \texttt{ibycus} \\ % \cmd{\ibylatintext} & \cmd{\latintext} \\ % \cmd{\dagger} & \cmd{\sdagger} % \end{tabular} % \end{center} % Furthermore, hyphenation before the last letter of a word is now % suppressed by default. % % \StopEventually{} % % % \section{The Implementation} % \subsection{The \texttt{.ldf} file for use with babel} % % When the \TeX\ engine used is not an \eTeX, we issue an appropriate warning: % \begin{macrocode} %<*ibycus> \ifx\eTeXversion\@undefined \PackageError{ibycus-babel}{% The TeX engine used by LaTeX \MessageBreak does not provide the the eTeX extensions.\MessageBreak This may cause wrong hyphenation\MessageBreak in mixed Latin/Greek paragraphs} {Proceed, with fingers crossed...} \fi % \end{macrocode} % % The macro |\LdfInit| takes care of preventing that this file is % loaded more than once: % \begin{macrocode} \LdfInit{ibycus}{captionsibycus} % \end{macrocode} % When this file is read as an option, i.e., by the |\usepackage| % command, \texttt{ibycus} could be an `unknown' language in % which case we have to make it known. So we check for the % existence of |\l@ibycus| to see whether we have to do % something here: % \begin{macrocode} \ifx\undefined\l@ibycus \@nopatterns{Ibycus} \adddialect\l@ibycus0\fi % \end{macrocode} % % We are going to load the file providing the definition of the LGI encoding, % see section \ref{sec:lgienc}. % The error handling has been adopted from Babel's (LGR) Greek module, % in order to ensure consistent behavior: % \begin{macrocode} \InputIfFileExists{lgienc.def}{% \message{Loading the definitions for the Greek font encoding LGI}}{% \errhelp{I can't find the lgienc.def file for the Greek fonts}% \errmessage{Since I do not know what the LGI encoding means^^J I can't typeset Greek.^^J I stop here, while you get a suitable lgienc.def file}\@@end } % \end{macrocode} % % The font family to be used for Greek passages is initialized to |fib|, % unless it has been defined already by a preceding package: % \begin{macrocode} \providecommand{\ibycusdefault}{fib} % \end{macrocode} % % We declare a command |\ibygr| and an environment |ibycus| to make % entering of Greek text easier, as compared with Babel's macros: % \begin{macrocode} \DeclareRobustCommand{\ibygr}[1]{\foreignlanguage{ibycus}{#1}} \newenvironment{ibycus}% {\begin{otherlanguage}{ibycus}}{\end{otherlanguage}}% % \end{macrocode} % % A command is provided to set a scaling factor for the Ibycus fonts. % When the fonts are already in use, the command has no effect. % We make sure that it can be used only in the preamble, even though this % does not really make sure that the fonts have not yet been loaded. % \begin{macrocode} \newcommand*{\setgreekfontscale}[1]{% \def\ibycus@scale{#1}} \@onlypreamble\setgreekfontscale % \end{macrocode} % The macro |\ibycus@scale|, which is defined here, will be evaluated % in the font definition files of LGI-encoded fonts; see \path{lgifib.fd} below. % % All text-editor symbols of the old package |ibycus4| are provided. % However, |\dagger| is named |\sdagger| now. % \begin{macrocode} \newcommand{\braceleft}{% {\fontencoding{LGI}\fontfamily{\ibycusdefault}\selectfont\char'333}} \newcommand{\braceright}{% {\fontencoding{LGI}\fontfamily{\ibycusdefault}\selectfont\char'337}} \newcommand{\bracketleftbt}{% {\fontencoding{LGI}\fontfamily{\ibycusdefault}\selectfont\char'363}} \newcommand{\bracketrightbt}{% {\fontencoding{LGI}\fontfamily{\ibycusdefault}\selectfont\char'367}} \newcommand{\sdagger}{% {\fontencoding{LGI}\fontfamily{\ibycusdefault}\selectfont\char'375}} \newcommand{\dbldagger}{% {\fontencoding{LGI}\fontfamily{\ibycusdefault}\selectfont\char'376}} % \end{macrocode} % % Finally, the code to integrate the pseudo-language Ibycus into Babel. % We start with the default values of |\lefthyphenmin| and |\righthyphenmin|. % \begin{macrocode} \providehyphenmins{ibycus}{\@ne\tw@} \def\captionsibycus{} \def\dateibycus{} % \end{macrocode} % % \cmd{\latintext} needs to be extended, as compared with the default definition % provided by the Babel kernel. The macro must not only switch to the default % Latin font \emph{encoding}; in addition to that, it must also switch to an appropriate % font \emph{family}, because the family is always changed to |\ibycusdefault| % within the Greek passages. While v2.0 would select |\rmdefault|, % this has been changed to |\familydefault| now. % Since |\latintext| is a protected command, we extend actually the % `unprotected' command \verb*|\latintext |: % \begin{macrocode} \expandafter\let\expandafter\iby@latintext\csname latintext \endcsname \@namedef{latintext }{\fontfamily{\familydefault}\iby@latintext} % \end{macrocode} % % \cmd{\ibycustext} is modelled after Babel's original \cmd{\greektext}. % However, we do not alter \cmd{\encodingdefault} any longer, since % doing so has turned out to be wrong. (See the \LaTeX\ bug babel/3796.) % As long as |ibycus| is never used as the default language % of a document, there is no need to touch \cmd{\encodingdefault} at all. % \begin{macrocode} \DeclareRobustCommand{\ibycustext}{% \fontencoding{LGI}\fontfamily{\ibycusdefault}\selectfont} \DeclareRobustCommand{\textibycus}[1]{\leavevmode{\ibycustext #1}} \addto\extrasibycus{\ibycustext} \addto\extrasibycus{% \babel@savevariable{\lccode`\(}\lccode`\(=`\(% \babel@savevariable{\lccode`\)}\lccode`\)=`\)% \babel@savevariable{\lccode`\=}\lccode`\==`\=% \babel@savevariable{\lccode`\|}\lccode`\|=`\|% \babel@savevariable{\lccode`\`}\lccode`\`=`\`% \babel@savevariable{\lccode`\'}\lccode`\'=`\'% \babel@savevariable{\lccode`\+}\lccode`\+=`\+} % \end{macrocode} % At the end of a Greek passage, we are going to issue the new command \cmd{\noibycustext}. % In contrast to \cmd{\latintext}, it does not alter |\encodingdefault|. % \begin{macrocode} \DeclareRobustCommand{\noibycustext}{% \fontencoding{\latinencoding}\fontfamily{\familydefault}\selectfont} \addto\noextrasibycus{\noibycustext} \ldf@finish{ibycus} % % \end{macrocode} % Should we save and restore the actual family name, % instead of simply forcing |\familydefault|? % % \subsection{The encoding definition file \texttt{lgienc.def}} % \label{sec:lgienc} % From v3.0 on, the Ibycus-encoded fonts are assigned the encoding LGI, even though % there are currently no encoding-specific commands declared. Rationale: % Future alternative font families with Ibycus encoding are using U already for other % purposes such as non-alphabetic symbols. As usual, the encoding is declared in an % external file. % \begin{macrocode} %<*lgienc> \DeclareFontEncoding{LGI}{}{} \DeclareFontSubstitution{LGI}{fib}{m}{n} \DeclareErrorFont{LGI}{fib}{m}{n}{10} % % \end{macrocode} % % % \subsection{The font definition file \texttt{lgifib.fd}} % We provide a correct \texttt{fd} file of our own for the Ibycus font family, % instead of relying on the weird file from the Ibycus4 collection, % and we use only those fonts, that exist also in Postscript format. % \begin{macrocode} %<*lgifib> \ifx\aliasfont\@undefined\else\ifx\aliasfont\relax\else % \end{macrocode} % This piece of code is executed with V\TeX\ only. % It enables the use of the artificially slanted font. % \begin{macrocode} \begingroup \catcode32=10 % \aliasfont fibo84 = fibr84 slant 167 % \endgroup \fi\fi % \end{macrocode} % Now let's evaluate \cmd{\ibycus@scale} to determine the optional % scaling parameter \cmd{\ibycus@@scale}, which will be applied in the % font shape declarations: % \begin{macrocode} \expandafter\ifx\csname ibycus@scale\endcsname\relax \let\ibycus@@scale\@empty \else \edef\ibycus@@scale{s*[\csname ibycus@scale\endcsname]}% \fi \DeclareFontFamily{LGI}{fib}{} \DeclareFontShape{LGI}{fib}{m}{n}{<-> \ibycus@@scale fibr84}{} \DeclareFontShape{LGI}{fib}{m}{sl}{<-> \ibycus@@scale fibo84}{} \DeclareFontShape{LGI}{fib}{b}{n}{<-> \ibycus@@scale fibb84}{} \DeclareFontShape{LGI}{fib}{m}{it}{<-> ssub * fib/m/sl}{} \DeclareFontShape{LGI}{fib}{bx}{n}{<-> ssub * fib/b/n}{} % % \end{macrocode} % % % % \subsection{Notes for class and package writers} % To change the font family used for Greek passages, redefine the % macro \cmd{\ibycusdefault} accordingly. Macro packages should use |\def| rather % than |\renewcommand|; thus, they can be loaded before as well as after % \path{ibycus.ldf}. % % To make the command \cmd{\setgreekfontscale} work, font definition files for % LGI-encoded font families must evaluate the macro \cmd{\ibycus@scale} % in the same way as the above \path{lgifib.fd}. % % \Finale % % \iffalse % % The next line of code prevents DocStrip from adding the % character table to the generated files(s). \endinput % % \fi % %% \CharacterTable %% {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 %% 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 %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} %%