%%
%% This is file `foreign.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% foreign.dtx  (with options: `package')
%% 
%% Copyright (C) 2012 by
%%    Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c 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.3c 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 Philip G. Ratcliffe.
%% 
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{foreign}
   [2012/09/25 v2.7 type-setting package for foreign words (PGR)]

\RequirePackage{xpunctuate,xspace}
\DeclareRobustCommand\foreign[1]{{\foreignfullfont{#1}}\xspace}
\DeclareRobustCommand\notforeign[1]{#1\xspace}
\newcommand\foreignfullfont{\emph}
\newcommand\foreignabbrfont{\em}
\newcommand\defasforeign[2][]{%
  \define@foreign{#1}{#2}{\newcommand}{\foreign}
}
\newcommand\defnotforeign[2][]{%
  \define@foreign{#1}{#2}{\newcommand}{\notforeign}
}
\newcommand\redefasforeign[2][]{%
  \define@foreign{#1}{#2}{\renewcommand}{\foreign}
}
\newcommand\redefnotforeign[2][]{%
  \define@foreign{#1}{#2}{\renewcommand}{\notforeign}
}
\newcommand\define@foreign[4]{%
  \def\foreign@csname{#1}%
  \ifx\foreign@csname\@empty
    \def\foreign@csname{#2}%
  \fi
  \expandafter#3\csname\foreign@csname\endcsname{#4{#2}}%
}
\DeclareOption{xlatin}{%
  \defasforeign{addendum}
  \defasforeign{Addendum}
  \defasforeign[adhoc]{ad hoc}
  \defasforeign[Adhoc]{Ad hoc}
  \defasforeign[aposteriori]{a posteriori}
  \defasforeign[Aposteriori]{A posteriori}
  \defasforeign[apriori]{a priori}
  \defasforeign[Apriori]{A priori}
  \defasforeign{caveat}
  \defasforeign{Caveat}
  \defasforeign{circa}
  \defasforeign{Circa}
  \defasforeign{curriculum}
  \defasforeign{Curriculum}
  \defasforeign{erratum}
  \defasforeign{Erratum}
  \defasforeign{ibidem}
  \defasforeign{Ibidem}
  \defasforeign{idem}
  \defasforeign{Idem}
  \defasforeign{sic}
  \defasforeign{Sic}
  \defasforeign[viceversa]{vice versa}
  \defasforeign[Viceversa]{Vice versa}
  \defasforeign[vitae]{vit{\ae}}
  \defasforeign[Vitae]{Vit{\ae}}
}
\DeclareOption{xfrench}{%
  \defasforeign[ala]{\`{a} la}
  \defasforeign[Ala]{\`{A} la}
  \defasforeign[visavis]{vis \`{a} vis}
  \defasforeign[Visavis]{Vis \`{a} vis}
}
\DeclareOption{xgerman}{%
  \defasforeign{ansatz}
  \defasforeign{Ansatz}
  \defasforeign{gedanken}
  \defasforeign{Gedanken}
}
\DeclareOption{abbreviations}{%
  \DeclareRobustCommand\cf{\UKUS@comma{{\foreignabbrfont{cf}}}}
  \DeclareRobustCommand\eg{%
    \UKUS@comma{{\foreignabbrfont{e}}.{\foreignabbrfont{g}}}}
  \DeclareRobustCommand\etal{\xperiodafter{{\foreignabbrfont{et al}}}}
  \DeclareRobustCommand\etc{\xperiodafter{{\foreignabbrfont{etc}}}}
  \DeclareRobustCommand\etseq{\xperiodafter{{\foreignabbrfont{et seq}}}}
  \DeclareRobustCommand\ibid{\xperiodafter{{\foreignabbrfont{ibid}}}}
  \DeclareRobustCommand\ie{%
    \UKUS@comma{{\foreignabbrfont{i}}.{\foreignabbrfont{e}}}}
  \DeclareRobustCommand\loccit{%
    {\foreignabbrfont{loc}}.\ \xperiodafter{{\foreignabbrfont{cit}}}}
  \DeclareRobustCommand\opcit{%
    {\foreignabbrfont{op}}.\ \xperiodafter{{\foreignabbrfont{cit}}}}
  \DeclareRobustCommand\viz{\xperiodafter{{\foreignabbrfont{viz}}}}
  \DeclareRobustCommand\Cf{\UKUS@comma{{\foreignabbrfont{Cf}}}}
  \DeclareRobustCommand\Eg{%
    \UKUS@comma{{\foreignabbrfont{E}}.{\foreignabbrfont{g}}}}
  \DeclareRobustCommand\Etal{\xperiodafter{{\foreignabbrfont{Et al}}}}
  \DeclareRobustCommand\Etc{\xperiodafter{{\foreignabbrfont{Etc}}}}
  \DeclareRobustCommand\Etseq{\xperiodafter{{\foreignabbrfont{Et seq}}}}
  \DeclareRobustCommand\Ibid{\xperiodafter{{\foreignabbrfont{Ibid}}}}
  \DeclareRobustCommand\Ie{%
    \UKUS@comma{{\foreignabbrfont{I}}.{\foreignabbrfont{e}}}}
  \DeclareRobustCommand\Loccit{%
    {\foreignabbrfont{Loc}}.\ \xperiodafter{{\foreignabbrfont{cit}}}}
  \DeclareRobustCommand\Opcit{%
    {\foreignabbrfont{Op}}.\ \xperiodafter{{\foreignabbrfont{cit}}}}
  \DeclareRobustCommand\Viz{\xperiodafter{{\foreignabbrfont{Viz}}}}
}
\newcommand\UKUS@comma{\xperiodafter}
\DeclareOption{UKenglish}{\renewcommand\UKUS@comma{\xperiodafter}}
\DeclareOption{USenglish}{\renewcommand\UKUS@comma{\xperiodcommaafter}}
\ExecuteOptions{USenglish}
\DeclareOption{british}{\ExecuteOptions{UKenglish}}
\DeclareOption{phrases}{\ExecuteOptions{xfrench,xgerman}}
\DeclareOption{all}{\ExecuteOptions{xlatin,phrases,abbreviations}}
\ProcessOptions
\InputIfFileExists{foreign.cfg}{%
  \typeout{%
    ============================================^^J%
    Loading local configuration file foreign.cfg^^J%
    ============================================%
  }
}{}%
\endinput
%%
%% End of file `foreign.sty'.
