summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/foreign/foreign.sty
blob: d327d156e8ccdea91892b2fe9991f29034db8919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
%%
%% 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'.