summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/nameauth/examples.tex
blob: 5719834e614703257beced67f8b2813db0b445ac (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
% This is an example file used with the nameauth package.
%
%
% Below we print the argument both in the text and in a margin paragraph
% unless we are in internal vertical mode.
%
% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
%
\renewcommand*\NamesFormat[1]%
{%
  #1%
  \ifinner
  \else
    \marginpar{\raggedleft\scriptsize #1}%
  \fi
}
%
% Below we print the argument in the text and then we query the text tag
% database to see if we can print a text tag after the argument.
%
% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
%
\newif\ifNoTextTag
\makeatletter
\renewcommand*\NamesFormat[1]%
{%
  \let\ex\expandafter%
  #1%
  \if@nameauth@InName
    \ifNoTextTag
    \else
      \ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
        \ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
        \ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}\ex[\the\@nameauth@toksc]%
    \fi
  \fi
  \if@nameauth@InAKA
    \ifNoTextTag
    \else
      \ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
        \ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
        \ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}\ex[\the\@nameauth@toksc]%
    \fi
  \fi
  \global\NoTextTagfalse%
}
\makeatother
%
% Below we create a Boolean value \ifSC and set it true.
%
% We then create a macro \DoFormat that prints its argument in 
% small caps if a Boolean value is true, or makes no font change
% and prints the the argument of the value is false.
%
% The next macro ignores its argument, sets \SCfalse, then
% uses some control sequences internal to the naming macros to
% parse and print the current name values without any formatting.
%
% The final macro is suitable to replace \MainNameHook and \FrontNameHook.
%
\makeatletter
\newif\ifSC
\SCtrue
\def\DoFormat#1{%
  \ifSC
    \textsc{#1}%
  \else
    #1%
  \fi
}
\newcommand*\MainNameHook[1]{%
  \let\ex\expandafter%
  \SCfalse\ignorespaces%
  \protected@edef\arga{\ex\trim@spaces\ex{\the\@nameauth@toksa}}%
  \protected@edef\argb{\ex\trim@spaces\ex{\the\@nameauth@toksb}}%
  \protected@edef\testb{\ex\@nameauth@Root\ex{\the\@nameauth@toksb}}%
  \protected@edef\argc{\ex\trim@spaces\ex{\the\@nameauth@toksc}}%
  \ifx\argb\testb
    \protected@edef\Suff{\@empty}%
    \let\Reversed\argb%
    \let\SNN\argb%
    \let\Short\argb%
  \else
    \protected@edef\Suff{\ex\@nameauth@Suffix\ex{\the\@nameauth@toksb}}%
    \protected@edef\Reversed{\Suff\Space\testb}%
    \protected@edef\SNN{\testb\Space\Suff}%
     \if@nameauth@RevThis
       \let\Short\Suff%
     \else
       \let\Short\testb%
     \fi
  \fi
  \if@nameauth@InAKA
    \ifx\arga\@empty
      \ifx\argc\@empty
        \if@nameauth@RevThis
          \Reversed%
        \else
          \SNN%
        \fi
      \else
         \if@nameauth@AltAKA
           \argc%
         \else
           \if@nameauth@RevThis
             \ex\argc\ex\Space\SNN%
           \else
             \ex\SNN\ex\space\argc%
           \fi
         \fi
       \fi
     \else
       \ifx\argc\@empty
         \let\FNN\arga%
       \else
         \let\FNN\argc%
       \fi
       \if@nameauth@AltAKA
         \FNN%
       \else
         \if@nameauth@RevThis
           \ex\SNN\ex\Space\FNN%
         \else
           \ex\FNN\ex\space\SNN%
         \fi
       \fi
     \fi
  \else
    \ifx\arga\@empty
      \ifx\argc\@empty
        \if@nameauth@FullName
          \if@nameauth@RevThis
            \Reversed%
          \else
            \SNN%
          \fi
        \else
          \Short%
        \fi
      \else
        \if@nameauth@FullName
          \if@nameauth@RevThis
            \ex\argc\ex\space\SNN%
          \else
            \ex\SNN\ex\space\argc%
          \fi
        \else
          \if@nameauth@RevThis
            \argc%
          \else
            \Short%
          \fi
        \fi
      \fi
    \else
      \ifx\argc\@empty
        \let\FNN\arga%
      \else
        \let\FNN\argc%
      \fi
      \let\Short\FNN%
      \if@nameauth@FullName
        \if@nameauth@RevThis
          \ex\SNN\ex\Space\FNN%
        \else
          \ex\FNN\ex\space\SNN%
        \fi
      \else
        \if@nameauth@FirstName
          \Short%
        \else
          \testb%
        \fi
      \fi
    \fi
  \fi
}
\makeatother