This repository has been archived by the owner on Mar 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
abntcite.sty
1215 lines (1040 loc) · 36.2 KB
/
abntcite.sty
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%% $Id: abntcite.sty,v 1.30 2006/04/25 15:57:42 gweber Exp $
%% name of this file abntcite.sty
%% Copyright 2001-2006 by the abnTeX group at http://abntex.codigolivre.org.br
%%
%% This file is distributed under the LaTeX-Project Public License (LPPL)
%% http://www.latex-project.org/lppl.html
%% You are free to modify this file under the LPPL.
%%
\NeedsTeXFormat{LaTeX2e}
\input{cvs-id.def}
\CVSExtract$Id: abntcite.sty,v 1.30 2006/04/25 15:57:42 gweber Exp $
\CVSPackage{abntcite}{\space Chamadas de referencias no texto (NBR10520, NBR10522)} %substitui \ProvidesPackage (replaces \ProvidesPackage)
%Packages from standard LaTeX
\RequirePackage{ifthen}
\RequirePackage{calc}
%Pages from the abnTeX project
\RequirePackage{abntex-abrev}
\RequirePackage{abntex-text}
\RequirePackage{abntex-default-design}
%%%%%% Options Declaration %%%%%%
%----------------------------------------------------------------
% Extracted from substr.sty (2000-06-15)
%----------------------------------------------------------------
% Copyright 2000 Harald Harders <[email protected]>
% Look at www.ctan.org for original package
%
% Commands:
%
% \IfSubStringInString{substring}{string}{true part}{false part}
% This command searches <substring> in <string> and executes the
% <true part> if it is and else the <else part>
% expands the first and second argument with
% \protected@edef and calls #3 with them:
\newcommand{\su@ExpandTwoArgs}[3]{%
\protected@edef\su@SubString{#1}%
\protected@edef\su@String{#2}%
\expandafter\expandafter\expandafter#3%
\expandafter\expandafter\expandafter{%
\expandafter\su@SubString\expandafter
}\expandafter{\su@String}%
}
%%
%% tests if #1 in #2. If yes execute #3, else #4
\newcommand*{\IfSubStringInString}[2]{%
\su@ExpandTwoArgs{#1}{#2}\su@IfSubStringInString
}
%%
\newcommand*{\su@IfSubStringInString}[2]{%
\def\su@compare##1#1##2\@nil{%
\def\su@param{##2}%
\ifx\su@param\@empty
\expandafter\@secondoftwo
\else
\expandafter\@firstoftwo
\fi
}%
\su@compare#2#1\@nil
}
% To grab 6 letters.
\newcommand{\grabsix}[6]{}
% To grab 7 letters.
\newcommand{\grabseven}[7]{}
%----------------------------------------------------------------
%Commands set by options
\newcommand{\citebrackets}[2]{\def\citeopen{#1}\def\citeclose{#2}}
\newcommand{\setcitebrackets}{\citebrackets()}
% A LaTeX list is a command containing a comma separated list of
% itens. The list is processed by command \@for, as in \citeoption.
\def\citeoptionlist{}
% This command adds a string to the list.
\newcommand{\addtociteoptionlist}[1]{
\ifthenelse{\equal{\citeoptionlist}{}}
{\edef\citeoptionlist{#1}}
{\edef\citeoptionlist{\citeoptionlist,#1}}
}
% Booleans set by options
\newboolean{ABCItextondemand}
\newboolean{ABCIfoot}
\newboolean{ABCIcompoldalf}
\newboolean{ABCIbibjustif}
\newboolean{ABCIbiblabelonmargin}
\newboolean{ABCIauto-abntoptions}
\newboolean{ABNTovercite}
\newboolean{ABNTstrictnumformat}
\provideboolean{ABNThyperref}
\@ifpackageloaded{hyperref}{\addtociteoptionlist{abnt-url-package=hyperref}
\setboolean{ABNThyperref}{true}}{\setboolean{ABNThyperref}{false}}
%Lengths set by options
\setlength{\bibindent}{0em}
% used for \@biblabel in num
\newlength{\minimumbiblabelwidth}
\newlength{\ABCIauxlen}
%Counters used in options
% auxiliar counters used in `sort and group' mechanism
\newcounter{ABCIaux}
\newcounter{ABCImax}
%main options
\DeclareOption{call=authordate}{\def\AbntCallType{authordate}\setboolean{ABCItextondemand}{true}}
\DeclareOption{call=numeric}{\def\AbntCallType{numeric}}
\DeclareOption{order=alphabetic}{\def\AbntOrderType{alphabetic}}
\DeclareOption{order=citation}{\def\AbntOrderType{citation}}
% references on page foot
\DeclareOption{foot}{\setboolean{ABCIfoot}{true}\setboolean{ABCItextondemand}{false}}
\DeclareOption{not-foot}{\setboolean{ABCIfoot}{false}\setboolean{ABCItextondemand}{true}}
% cite text on demand (defaults depends on foot or not-foot)
% (also recall that options are executed in order of definition at
% \ProcessOptions)
\DeclareOption{load-text-on-demand}{\setboolean{ABCItextondemand}{true}}
\DeclareOption{load-text}{\setboolean{ABCItextondemand}{false}}
% biblabel-on-margin
\DeclareOption{rightalign=yes}{\setboolean{ABCIbibjustif}{true}}
\DeclareOption{rightalign=no}{\setboolean{ABCIbibjustif}{false}}
% biblabel-on-margin
\DeclareOption{biblabel-on-margin}{\setboolean{ABCIbiblabelonmargin}{true}}
\DeclareOption{biblabel-not-on-margin}{\setboolean{ABCIbiblabelonmargin}{false}}
% \bibliography includes abnt-options automatically unless next option is used
\DeclareOption{optionfile=abnt-options.bib}{\setboolean{ABCIauto-abntoptions}{true}}
\DeclareOption{optionfile=none}{\setboolean{ABCIauto-abntoptions}{false}}
% recuo : compatibility with old norms
\DeclareOption{indent}{\setlength{\bibindent}{1.8em}}
% 10520:2002 now defines only two numerical styles
\DeclareOption{citepos=over}{\setboolean{ABNTovercite}{true}}
\DeclareOption{citepos=inline}{\setboolean{ABNTovercite}{false}}
%Options specific to the several versions of 10520
\DeclareOption{nbr10520=1988}{\input{nbr10520-1988.def}}
\DeclareOption{nbr10520=2001}{\input{nbr10520-2001.def}}
\DeclareOption{nbr10520=2002}{\input{nbr10520-2002.def}}
\DeclareOption{abnt-substyle=COPPE}
{\newcommand{\bibtextitlecommand}[2]{``#2''}%
\addtociteoptionlist{abnt-substyle=COPPE}}
% suporting options in a keyval style
% recuo=<length> gives indentation of \bibitem
% other options: passed thought \citeoption (stored now in \citeoptionlist
% and after (in \AtBeginDocument hook) \citeoption will act on it)
\DeclareOption*{
\IfSubStringInString{recuo=}{\CurrentOption}
{\setlength{\bibindent}{\expandafter\grabsix\CurrentOption}}
{\IfSubStringInString{indent=}{\CurrentOption}
{\setlength{\bibindent}{\expandafter\grabseven\CurrentOption}}
{\addtociteoptionlist{\CurrentOption}}}
}
%deprecated options, maintained for backward compatibility
\DeclareOption{alf}{\ExecuteOptions{call=authordate,order=alphabetic}}
\DeclareOption{num}{\ExecuteOptions{call=numeric,order=citation}}
\DeclareOption{bibjustif}{\ExecuteOptions{rightalign=yes}}
\DeclareOption{bibleftalign}{\ExecuteOptions{rightalign=yes}} %left/right mixed
\DeclareOption{abnt-option-file}{\ExecuteOptions{optionfile=abnt-options.bib}}
\DeclareOption{no-abnt-option-file}{\ExecuteOptions{optionfile=none}}
\DeclareOption{overcite}{\ExecuteOptions{citepos=over}}
\DeclareOption{inlinecite}{\ExecuteOptions{citepos=inline}}
\DeclareOption{nbr10520-2001}{\ExecuteOptions{nbr10520=2001}}
\DeclareOption{nbr10520-2002}{\ExecuteOptions{nbr10520=2002}}
\DeclareOption{recuo}{ExecuteOptions{indent}}
% compatibility with old abnt-alf.bst
\DeclareOption{alfantigo}{\setboolean{ABCIcompoldalf}{true}}
\DeclareOption{experimental}{\setboolean{ABCIcompoldalf}{false}}
%end of depecated options
%Options controlling version-dependent behavior
\DeclareOption{abntex=0.8}
{
%non-norm dependent default options
\ExecuteOptions{biblabel-not-on-margin}
\ExecuteOptions{call=authordate,order=alphabetic}
\ExecuteOptions{optionfile=abnt-options.bib}
\ExecuteOptions{experimental}
\ExecuteOptions{not-foot}
%norm-dependent default options
\ExecuteOptions{nbr10520=2002}
\renewcommand{\authorcapstyle}{\smaller}
}
\DeclareOption{abntex=0.9}
{
%non-norm dependent default options
\ExecuteOptions{biblabel-not-on-margin}
\ExecuteOptions{call=authordate,order=alphabetic}
\ExecuteOptions{optionfile=abnt-options.bib}
\ExecuteOptions{experimental}
\ExecuteOptions{not-foot}
%norm-dependent default options
\ExecuteOptions{nbr10520=2002}
}
%default for this version
\ExecuteOptions{abntex=0.9}
\ProcessOptions
% really foot?
\ifthenelse{\boolean{ABCIfoot}\and\equal{\AbntCallType}{numeric}}
{\setboolean{ABCIfoot}{true}}
{\setboolean{ABCIfoot}{false}}
% Now, after all options are processed, \citeoption process the list of
% options given as package options.
%
\ifthenelse{\equal{\citeoptionlist}{}}
{}
{\AtBeginDocument{\citeoption{\citeoptionlist}}}
% \citeoption - equal to \nocite (I copied source from \nocite)
% but not complains about this option be obviously undefined
\newboolean{ABCIciteoptionwasused}
\setboolean{ABCIciteoptionwasused}{false}
\def\citeoption#1{\@bsphack
\@for\@citekey:=#1\do{%
% next line eliminates white space before citation name
\edef\@citekey{\expandafter\@firstofone\@citekey}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi
}%
\@esphack%
\setboolean{ABCIciteoptionwasused}{true}%
}
%
% \bibliography{list of files .bib to be processed by bibTeX}
%
% I had to redefine this command such that abnt-options.bib is
% automatically used in case that some \citeoption was given as package
% option. An entry
% \bibliography{abnt-options,abnt-options,..}
% produces an error in bibTeX. So I had to check if user already
% includes abnt-options by (him/her)self.
%
% implementation:
%
% \citeoption was used?
% If YES, (abnt-options must be given to bibtex!)
% checks for abnt-options into parameter given to \bibliography
% if present
% user have included, so I don't add it once more
% not present
% I add necessary abnt-options
% If NO
% no changes to \bibliography
\def\bibliography#1{%
\ifthenelse{\boolean{ABCIciteoptionwasused}
\and\boolean{ABCIauto-abntoptions}}
{
% this system of checking is not good...
\IfSubStringInString{abnt-options}{#1}
{\if@filesw\immediate\write\@auxout{\string\bibdata{#1}}\fi}
{\if@filesw\immediate\write\@auxout{\string\bibdata{abnt-options,#1}}\fi}
}
{
\if@filesw
\immediate\write\@auxout{\string\bibdata{#1}}%
\fi
}
\@input@{\jobname.bbl}}
%
% The next piece of code looks if bibtexstyle is used or not, and if not,
% includes the respective style from the abntcite mode (alf or num)
\newboolean{ABCIbibtexstyleused}
\setboolean{ABCIbibtexstyleused}{false}
%
\def\bibliographystyle#1{%
\ifx\@begindocumenthook\@undefined\else
\expandafter\AtBeginDocument
\fi
{\if@filesw
\immediate\write\@auxout{\string\bibstyle{#1}}%
\fi}
\setboolean{ABCIbibtexstyleused}{true}
}
% \AtEndDocument is the last chace for include bibliography style..
\AtEndDocument{
\ifthenelse{\not\boolean{ABCIbibtexstyleused}}
{\ifthenelse{\equal{\AbntOrderType}{citation}}{\bibliographystyle{abnt-num}}{}
\ifthenelse{\equal{\AbntOrderType}{alphabetic}}{\bibliographystyle{abnt-alf}}{}}
{}
}
%%%%%%%%%%%%%% Style %%%%%%%%%%%%%%%%%
\newlength{\biblabelsep}
\setlength{\biblabelsep}{1ex}
%%%%%%%%%%%%%%%%%%%%% Implementation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% automatic care for commas inside references
\providecommand{\ABCIccomma}{}
\newcommand{\ABCIcitecommadefault}{,\penalty\@m\ }
\newcommand{\ABCIcitecomma}{\ABCIccomma\let\ABCIccomma\ABCIcitecommadefault}
\newcommand{\ABCIinitcitecomma}{\def\ABCIccomma{}}
\newcommand{\ABCIcitecolondefault}{; }%{;\penalty\@m\ }
% How \bibitem works?
% definition of \bibitem
% \def\bibitem{\@ifnextchar\@lbibitem\@bibitem}
\ifthenelse{\boolean{ABCIcompoldalf}\and\equal{\AbntCallType}{authordate}}
{
% In the old mplementation on abnt-alf, the command \bibitem should be
% \bibitem[{explicit}{implicit}{year}]{key}
% if \bibitem has optional parameter, uses it (three pieces of data
% stored into .aux file)
\def\@lbibitem[#1#2#3]#4{
\gdef\abntnextkey{#4}
\item[\@biblabel{#1}\hfill]%
\if@filesw
{
\let\protect\noexpand
\immediate\write\@auxout{\string\bibcite{#4++EXPL}{#1}}
\immediate\write\@auxout{\string\bibcite{#4++IMPL}{#2}}
\immediate\write\@auxout{\string\bibcite{#4++YEAR}{#3}}
}
\fi%
\ignorespaces
}
% if no optional is used, uses a list counter (stores its value into .aux)
\def\@bibitem#1{
\gdef\abntnextkey{#1}
\item%
\if@filesw
{\immediate\write\@auxout{\string\bibcite{#1}{\the\value{\@listctr}}}}
\fi%
\ignorespaces
}
}
{ %if normal mode (non-compatible with old alf)
\ifthenelse{\boolean{ABCIfoot}}
{
% foot-num mode
\def\@lbibitem[#1]#2{\gdef\abntnextkey{#2}}
\def\@bibitem#1{\gdef\abntnextkey{#1}}
}
{
\def\@lbibitem[#1]#2{
\gdef\abntnextkey{#2}
\item[\@biblabel{#1}\hfill]%
\ifthenelse{\boolean{ABNThyperref}}{%
\hyper@anchorstart{cite.#2}\relax\hyper@anchorend}{}%
\if@filesw
{
\let\protect\noexpand
\immediate\write\@auxout{\string\bibcite{#2}{#1}}
}
\fi%
\ignorespaces
}
\def\@bibitem#1{
\gdef\abntnextkey{#1}
% \ifthenelse{}{\item}{\item}
\item%
\ifthenelse{\boolean{ABNThyperref}}{%
\hyper@anchorstart{cite.#1}\relax\hyper@anchorend}{}%
\if@filesw
{\immediate\write\@auxout{\string\bibcite{#1}{\the\value{\@listctr}}}}
\fi%
\ignorespaces
}
}
}
\newcommand{\hiddenbibitem}[2][]{\gdef\abntnextkey{#2}}
\newcommand{\ABCIgetcitetext}[1]{
\if@filesw
{\let\protect\noexpand
\immediate\write\@auxout{\string\bibcite{\abntnextkey++TEXT}{#1}}}%
\fi}
\newcommand{\ABCIgetcitetextecho}[1]{\ABCIgetcitetext{#1}#1}
%we are repeating \bibcite command as defined in hyperref.sty
%so that we have it all together at one place.
\ifthenelse{\boolean{ABNThyperref}}{%
\renewcommand{\bibcite}[2]{%
\@newl@bel{b}{#1}{\hyper@@link[cite]{}{cite.#1}{#2}}}%
\newcommand{\bibciteEXPL}[2]{%
\@newl@bel{b}{#1++EXPL}{\hyper@@link[cite]{}{cite.#1}{#2}}}%
\newcommand{\bibciteIMPL}[2]{%
\@newl@bel{b}{#1++IMPL}{\hyper@@link[cite]{}{cite.#1}{#2}}}%
\newcommand{\bibciteYEAR}[2]{%
\@newl@bel{b}{#1++YEAR}{\hyper@@link[cite]{}{cite.#1}{#2}}}%
}{}
\newcommand{\abntrefinfo}[3]{%
\if@filesw
{%
\let\protect\noexpand
\ifthenelse{\boolean{ABNThyperref}}{%
\immediate\write\@auxout{\string\bibciteEXPL{\abntnextkey}{#1}}%
\immediate\write\@auxout{\string\bibciteIMPL{\abntnextkey}{#2}}%
\immediate\write\@auxout{\string\bibciteYEAR{\abntnextkey}{#3}}}{%
\immediate\write\@auxout{\string\bibcite{\abntnextkey++EXPL}{#1}}%
\immediate\write\@auxout{\string\bibcite{\abntnextkey++IMPL}{#2}}%
\immediate\write\@auxout{\string\bibcite{\abntnextkey++YEAR}{#3}}}%
}%
\fi
\ifthenelse{\boolean{ABCIfoot}}
{\ifthenelse{\boolean{ABCItextondemand}}
{\@ifundefined{ABCIdemand@\abntnextkey}
{\let\ABCIprocesscitetext\@gobble}
{\let\ABCIprocesscitetext\ABCIgetcitetext}}
{\let\ABCIprocesscitetext\ABCIgetcitetext}}
{\ifthenelse{\boolean{ABCItextondemand}}
{\@ifundefined{ABCIdemand@\abntnextkey}
{\let\ABCIprocesscitetext\relax}
{\let\ABCIprocesscitetext\ABCIgetcitetextecho}}
{\let\ABCIprocesscitetext\ABCIgetcitetextecho}}%
\ABCIprocesscitetext
}
\newcommand{\ABCIdemand}[1]{\expandafter\gdef\csname ABCIdemand@#1\endcsname{}}
\def\AbntCallTypeALF{authordate}
\let\ABCInewblock\newblock
\DeclareRobustCommand{\newblock}{\ABCInewblock}
%%%%%%%%%%%%%%%%%%%% abnt-alf %%%%%%%%%%%%%%%%%%%%%%%
% the next line was before \ifthenelse{\equal{\AbntCallType}{alf}}
\setcitebrackets
\ifx\AbntCallType\AbntCallTypeALF % if alf
\renewcommand{\@biblabel}[1]{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \cite[optional]{list of keys}
%
% Implicit citation - author in capital letters and year;
% mechanism to deal with repeated names;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\@cite}[2]%
{\citeopen{#1\ifthenelse{\equal{#2}{}}{}{,
{\optionaltextstyle#2}}}\citeclose}
\DeclareRobustCommand{\cite}[2][]{%
%
\leavevmode
\let\@citeprevious\@empty%
\@cite{%
\@for\@citekey:=#2\do% \@citekey contains the key
{%
\edef\@citekey{\expandafter\@firstofone\@citekey\@empty}%
%
% here, a tricky \let\@citename\"b@\@citekey++IMPL"
\expandafter\let\expandafter\@citename%
\csname b@\@citekey++IMPL\endcsname%
\expandafter\let\expandafter\@citeyear%
\csname b@\@citekey++YEAR\endcsname%
\ifx\@citeprevious\@empty%
\else%
\ifx\@citename\@citeprevious%
\ABCIcitecommadefault% echoing ", "
\else%
\ABCIcitecolondefault% echoing "; "
\fi%
\fi%
% writing on aux file
\if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi%
% if undefined bibitem
\@ifundefined{b@\@citekey++IMPL}%
{% if undefined
{\bfseries??}% echoing ?
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citekey' on page \thepage \space undefined}%
}%
{% if already defined
\ifx\@citename\@citeprevious%
{\yearstyle\@citeyear\@}\@%
\else%
{\authorcapstyle\@citename}, %
{\yearstyle\@citeyear\@}%
\fi%
\let\@citeprevious\@citename%
}%
}% end for
}{#1}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \citeonline[optional]{list of keys}
%
% Inline (explicit) citation - author in "inline style" and year;
% mechanism to deal with repeated names;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\@citeonline}[2]%
{{#1\ifthenelse{\equal{#2}{}}{}{, {\optionaltextstyle#2}}}\citeclose}
\DeclareRobustCommand{\citeonline}[2][]{%
%
\leavevmode
\let\@citeprevious\@empty%
\@citeonline{%
\@for\@citekey:=#2\do%\@citekey contains the key
{%
\edef\@citekey{\expandafter\@firstofone\@citekey\@empty}%
%
% here, a tricky \let\@citename\"b@\@citekey++UP" :-)
\expandafter\let\expandafter\@citename%
\csname b@\@citekey++EXPL\endcsname%
\expandafter\let\expandafter\@citeyear%
\csname b@\@citekey++YEAR\endcsname%
\ifx\@citeprevious\@empty%
\else%
\ifx\@citename\@citeprevious%
\ABCIcitecommadefault% echoing ", "
\else%
\citeclose, % echoing "), "
\fi%
\fi%
% writing in aux file
\if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi%
\@ifundefined{b@\@citekey++EXPL}%
{% if undefined
{\bfseries??}% echoing ?
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citekey' on page \thepage \space undefined}%
}%
{% if really defined
\ifx\@citename\@citeprevious%
\else%
{\authorstyle\@citename\@{}} \citeopen%
\fi%
{\yearstyle\@citeyear\@}%
\let\@citeprevious\@citename%
}%
}% end for
}{#1}%
}
% "overcite" compatibility
\let\citen\citeonline
\let\citenum\citeonline
% end alf
%
%
%%%%%%%%%%%%%%%%%%%%%%%%% abnt-num %%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
\else % if not alf,
\ifABCIfoot
\renewenvironment{thebibliography}[1]{}{}
\citebrackets{}{}
\let\ABCIscriptfont\scriptsize
\renewcommand{\newblock}{}
\def\ABCI@cite#1#2{\raisebox{.8ex}%
{\ABCIscriptfont\citeopen{#1\if@tempswa, #2\fi}\citeclose}}
\def\ABCI@citeonline#1#2{{#1\if@tempswa, #2\fi}}
\DeclareRobustCommand\cite{%
\let\@cite\ABCI@cite%
\@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
\DeclareRobustCommand\citeonline{%
\leavevmode\let\@cite\ABCI@citeonline%
\@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
\def\@citex[#1]#2{%
\def\@safe@activesfalse{}%
\ABCIinitcitecomma%
\def\ABCIcitelist{}%
\def\ABCIaftercitex{}% to put the footnotes
\@cite{%
\@for\@citeb:=#2\do%
{%
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi%
\@ifundefined{b@\@citeb++IMPL}%
{%
{\bfseries??}%
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citeb' on page \thepage \space undefined}%
}%
{%
\@ifundefined{b@\@citeb}
{%
\stepcounter{footnote}%
\expandafter\xdef\csname b@\@citeb\endcsname{\thefootnote}%
\ABCItoken=\expandafter{\ABCIaftercitex}%
\xdef\ABCIaftercitex%
{\the\ABCItoken\noexpand\footnotetext%
{\noexpand\citetext{\@citeb}}}%
}
{}%
\expandafter\let\expandafter\ABCIcitation%
\csname b@\@citeb\endcsname%
% test for positive number
\ifcat _\ifnum\z@<0\ABCIcitation _\else A\fi
\ABCIaddtocitelist{\ABCIcitation}%
\else% else \ifcat
\ABCIcitecomma\hbox{\ABCIcitation}%
\fi% end \ifcat
}%
}%
\ABCIoutputgroupedcitelist%
}{#1}%
\ABCIaftercitex%
}
\newcommand{\citeifnotcited}[1]{%
\def\ABCIcitelist{}%
\@for\@citeb:=#1\do%
{%
\@ifundefined{b@\@citeb}
{\ABCIaddtocitelist{\@citeb}}
{}%
}%
\expandafter\cite\expandafter{\ABCIcitelist}%
}
\newcommand{\citeonlineifnotcited}[1]{%
\def\ABCIcitelist{}%
\@for\@citeb:=#1\do%
{%
\@ifundefined{b@\@citeb}
{\ABCIaddtocitelist{\@citeb}}
{}%
}%
\expandafter\citeonline\expandafter{\ABCIcitelist}%
}
\newcommand{\ABCIaddtocitelist}[1]{%
\ifthenelse{\equal{\ABCIcitelist}{}}%
{\edef\ABCIcitelist{#1}}
{\edef\ABCIcitelist{\ABCIcitelist,#1}}%
}%
\newcommand{\ifcited}[3]{\@ifundefined{b@#1}{#3}{#2}}
\else % if num and NOT foot
% this only works with proper settings in \ABCIthebibliformat
\ifthenelse{\boolean{ABCIbiblabelonmargin}}
{
\renewcommand{\@biblabel}[1]%
{\ifthenelse{\equal{#1}{}}{}{{\citenumstyle #1\hspace{\biblabelsep}}}}
}
{
\renewcommand{\@biblabel}[1]%
{%
\ifthenelse{\equal{#1}{}}
{}
{%
\def\biblabeltext{{\citenumstyle #1\hspace{\biblabelsep}}}%
\settowidth{\ABCIauxlen}{\biblabeltext}%
\ifthenelse{\lengthtest{\ABCIauxlen<\minimumbiblabelwidth}}
{\setlength{\ABCIauxlen}{\minimumbiblabelwidth-\ABCIauxlen}}
{\setlength{\ABCIauxlen}{0cm}}%
{\biblabeltext\hspace{\ABCIauxlen}}%
}%
}%
}
\let\ABCIscriptfont\scriptsize
\ifthenelse{\boolean{ABNTovercite}}{%
\def\ABCI@cite#1#2{\raisebox{1ex}%
{\ABCIscriptfont\citeopen{#1\if@tempswa, #2\fi}\citeclose}}}{%
\def\ABCI@cite#1#2{\citeopen{#1\if@tempswa, #2\fi}\citeclose}}
\def\ABCI@citeonline#1#2{{#1\if@tempswa, #2\fi}}
\DeclareRobustCommand\cite{%
\let\@cite\ABCI@cite%
\@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
\DeclareRobustCommand\citeonline{%
\leavevmode\let\@cite\ABCI@citeonline%
\@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
% \renewcommand{\@openbib@code}%
% {\setlength{\leftmargin}{0pt}\addtolength{\itemindent}{\labelsep}}
\def\@citex[#1]#2{%
\def\@safe@activesfalse{}%
\ABCIinitcitecomma%
\def\ABCIcitelist{}%
\@cite{%
\@for\@citeb:=#2\do%
{%
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi%
\@ifundefined{b@\@citeb}%
{%
{\bfseries??}%
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citeb' on page \thepage \space undefined}%
}%
{%
\expandafter\let\expandafter\ABCIcitation%
\csname b@\@citeb\endcsname%
% test for positive number
\ifcat _\ifnum\z@<0\ABCIcitation _\else A\fi
\ABCIaddtocitelist{\ABCIcitation}%
\else% else \ifcat
\ABCIcitecomma\hbox{\ABCIcitation}%
\fi% end \ifcat
}%
}%
\ABCIoutputgroupedcitelist%
}{#1}%
}
\newcommand{\ABCIaddtocitelist}[1]{%
\ifthenelse{\equal{\ABCIcitelist}{}}%
{\edef\ABCIcitelist{#1}}
{\edef\ABCIcitelist{\ABCIcitelist,#1}}%
}%
\fi
\fi % end if alf
\providecommand{\citeifnotcited}[1]{}
\providecommand{\citeonlineifnotcited}[1]{}
\providecommand{\ifcited}[3]{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \citeyear{list of keys}
%
% Citation by year
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareRobustCommand{\citeyear}[1]{%
%
% \let\@safe@activesfalse\@empty%
\leavevmode
\let\@citeprevious\@empty%
\@for\@citekey:=#1\do %\@citekey contains the key
{%
% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}%
\expandafter\let\expandafter\@citename%
\csname b@\@citekey++YEAR\endcsname%
%compare previous name with current name and decide the punctuation marks
%if first use do nothing
\ifx\@citeprevious\@empty%
\else%
, % echoing ",
\fi%
% writing on aux file
\if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi%
% if undefined bibitem
\@ifundefined{b@\@citekey++YEAR}%
{% if undefined
{\bfseries??}% echoing ?
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citekey' on page \thepage \space undefined}%
}%
{% if already defined
\ifx\@citename\@citeprevious%
\else%
{\@citename\@}%
\fi%
\let\@citeprevious\@citename%
}%
}% end for
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \citeauthor{list of keys}
%
% Implicit citation (capital letters)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareRobustCommand{\citeauthor}[1]{%
%
% \let\@safe@activesfalse\@empty%
\leavevmode
\let\@citeprevious\@empty%
\@for\@citekey:=#1\do %\@citekey contains the key
{%
% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}%
\expandafter\let\expandafter\@citename\csname b@\@citekey++IMPL\endcsname%
% writing on aux file
\if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi%
% if undefined bibitem
\@ifundefined{b@\@citekey++IMPL}%
{% if undefined
{\bfseries??}%
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citekey' on page \thepage \space undefined}%
}%
{% if already defined
\ifx\@citename\@citeprevious%
\else%
\ifx\@citeprevious\@empty%
\else%
; % echoing "; "
\fi%
{\authorcapstyle\@citename\@}%
\fi%
\let\@citeprevious\@citename%
}%
}% end for
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \citeauthoronline{list of keys}
%
% Explicit citation (non capital letter)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareRobustCommand{\citeauthoronline}[1]{%
%
% \let\@safe@activesfalse\@empty%
\leavevmode
\let\@citeprevious\@empty%
\@for\@citekey:=#1\do %\@citekey contains the key
{%
% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}%
\expandafter\let\expandafter\@citename\csname b@\@citekey++EXPL\endcsname%
% writing on aux file
\if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi%
% if undefined bibitem
\@ifundefined{b@\@citekey++EXPL}%
{% if undefined
{\bfseries??}%
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citekey' on page \thepage \space undefined}%
}%
{% if already defined
\ifx\@citename\@citeprevious%
\else%
\ifx\@citeprevious\@empty%
\else%
; % echoing "; "
\fi%
{\authorstyle\@citename\@}%
\fi%
\let\@citeprevious\@citename%
}%
}% end for
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \citetext{list of keys}
%
% Text of the reference
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareRobustCommand{\citetext}[1]{%
%
% \let\@safe@activesfalse\@empty%
\leavevmode
\let\@citeprevious\@empty%
\@for\@citekey:=#1\do %\@citekey contains the key
{%
% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}%
\expandafter\let\expandafter\@citename\csname b@\@citekey++TEXT\endcsname%
% writing on aux file
\if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi%
\if@filesw\immediate\write\@auxout{\string\ABCIdemand{\@citekey}}\fi%
% if undefined bibitem
\@ifundefined{b@\@citekey++TEXT}%
{% if undefined
{\bfseries??}%
\G@refundefinedtrue%
\@latex@warning%
{Citation `\@citekey' on page \thepage \space undefined}%
}%
{% if already defined
\ifx\@citename\@citeprevious%
\else%
\relax
\ifx\@citeprevious\@empty%
\else%
; % echoing "; "
\fi%
{\@citename}%
\fi%
\let\@citeprevious\@citename%
}%
}% end for
}
%
% Setting up `recuo' (=indent in Portuguese)
%
% To ensure that the margin settings of this package works, \leftmargin
% (inside thebibliography) must be 0cm. \@openbib@code is a hook inside
% thebibliography.
\let\@openbib@codeBACKUP\@openbib@code
\def\@openbib@code{\@openbib@codeBACKUP\setlength{\leftmargin}{0cm}}
% adding things after \begin{thebibliography}{}
\let\thebibliographyBkUp\thebibliography
\def\thebibliography#1{\thebibliographyBkUp{#1}\ABCIthebibliformat}
%
% \AfterTheBibliography{} hook
%
\newtoks\ABCItoken
\newcommand{\ABCIthebiblihook}{}
\newcommand{\AfterTheBibliography}[1]{
\ABCItoken=\expandafter{\ABCIthebiblihook}
\expandafter\def\expandafter\ABCIthebiblihook\expandafter{\the\ABCItoken#1}
}
\ifthenelse{\boolean{ABCIbibjustif}}