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
/
abnt-num.bst
2195 lines (2047 loc) · 57.2 KB
/
abnt-num.bst
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: abnt-num.bst,v 1.49 2005/12/21 15:59:48 gweber Exp $
%% Copyright 2001-2005 by the abnTeX group at http://abntex.codigolivre.org.br
%%
%% Mantainer: Gerald Weber <[email protected]>
%%
%% This file is distributed under the LaTeXProject Public License (LPPL) http://www.latex-project.org/lppl.html
%% You are free to modify this file under the LPPL.
%%
%%
%%
ENTRY
{ %standard bibtex entries
address
author
booktitle
chapter
edition
editor
howpublished
institution
journal
key
month
note
number
organization
pages
publisher
school
series
title
type
volume
year
%abntex specific fields
booksubtitle
conference-number
conference-year
conference-location
editortype
dimensions
furtherresp
illustrated
isbn
issn
marginnote
org-short
pagename
reprinted-from
reprinted-text
subtitle
section
url
urlaccessdate
year-presented
%abntex option controls
abnt-and-type %selects the type of "and"
abnt-doi
abnt-dont-use-etal
abnt-etal-cite
abnt-etal-list
abnt-etal-text
abnt-emphasize
abnt-experimental
abnt-full-initials
abnt-last-names
abnt-ldots-type
abnt-missing-year
abnt-cite-style
abnt-no-etal-label
abnt-note
abnt-repeated-author-omit
abnt-repeated-title-omit
abnt-show-options
abnt-refinfo
abnt-thesis-year
abnt-url-package
abnt-title-command
abnt-verbatim-entry
abnt-year-extra-label
%ISO specific options
iso-abbreviation
iso-author-punctuation
iso-date-place
}{}{ label extra.label year.label}
%revision string
STRINGS { abnt.bst.revision }
%general purpose strings
STRINGS { r s t }
%variables needed to implement the various abnt options
%strings use up a lot of buffer space, we can use only a few
STRINGS {abnt.etal.text abnt.emphasize previous.author previous.title}
%most options are implemented with integers
INTEGERS {abnt.alf
abnt.cite.style
abnt.doi
abnt.experimental
abnt.etal.cite
abnt.etal.list
abnt.full.initials
abnt.last.names
abnt.ldots.type
abnt.missing.year
abnt.refinfo
abnt.repeated.author.omit
abnt.repeated.title.omit
abnt.show.options
abnt.and.type
abnt.title.command
abnt.thesis.year
abnt.url.package
abnt.verbatim.entry
abnt.year.extra.label
iso.abbreviation
iso.author.punctuation
iso.date.place
repeated.author}
%needed for title formatting
INTEGERS { title.lenght title.pos first.word no.bracket}
STRINGS { title.char}
%needed for controlling the sentence position
INTEGERS {output.state before.all mid.sentence after.sentence after.block }
%needed for url identification
INTEGERS {url.type}
%static values for options
%values for abnt.doi
FUNCTION {abnt.doi.expand.to.url} {#0} %expands a doi address to its url correspondent
FUNCTION {abnt.doi.link} {#1} %links doi to its url correspondent
FUNCTION {abnt.doi.leave.as.is} {#2} %shows doi as is, external viewer will have
%to know what to do with a "doi:" document
%values for url types
FUNCTION {unknown.url} {#0}
FUNCTION {http.url} {#1}
FUNCTION {file.url} {#2}
FUNCTION {ftp.url} {#3}
FUNCTION {doi.url} {#4}
FUNCTION {mailto.url} {#5}
FUNCTION {init.state.consts}
{ #0 'before.all :=
#1 'mid.sentence :=
#2 'after.sentence :=
#3 'after.block :=
}
%output.nonnull decides what is written before the argument s, if a comma, period etc.
FUNCTION {output.nonnull}
{ 's := %the argument is written into s
output.state mid.sentence =
{ ", " * write$ } %mid.sentence first write comma
{ output.state after.block =
{ add.period$ write$ newline$ }
{ output.state before.all = 'write$
{ add.period$ " " * write$ }
if$}
if$
mid.sentence 'output.state := }
if$
s %now comes s
}
FUNCTION {output.nonnull.dash}
{ 's := %the argument is written into s
output.state mid.sentence =
{ " --- " * write$ } %mid.sentence first write comma
{ output.state after.block =
{ add.period$ write$ newline$ write$}
{ output.state before.all = 'write$
{ add.period$ " " * write$ }
if$}
if$
mid.sentence 'output.state := }
if$
s %now comes s
}
FUNCTION {output} %does nothing or calls output.nonull
{ duplicate$ empty$
'pop$
'output.nonnull
if$
}
FUNCTION {output.dash} %does nothing or calls output.nonull
{ duplicate$ empty$
'pop$
'output.nonnull.dash
if$
}
FUNCTION {output.check} %like ouput, but complains if t empty
{ 't :=
duplicate$ empty$
{ pop$ "campo " t * " vazio em " * cite$ * warning$ }
'output.nonnull
if$
}
FUNCTION {new.block}
{ output.state before.all =
'skip$
{ after.block 'output.state := }
if$
}
FUNCTION {new.sentence}
{ output.state after.block =
'skip$
{ output.state before.all =
'skip$
{ after.sentence 'output.state := }
if$
}
if$
}
FUNCTION {add.blank} { " " * before.all 'output.state :=}
FUNCTION {date.block} {new.block}
FUNCTION {not}
{ { #0 }
{ #1 }
if$
}
FUNCTION {and}
{ 'skip$
{ pop$ #0 }
if$
}
FUNCTION {or}
{ { pop$ #1 }
'skip$
if$
}
FUNCTION {new.block.checka}
{ empty$
'skip$
'new.block
if$
}
FUNCTION {new.block.checkb}
{ empty$
swap$ empty$
and
'skip$
'new.block
if$
}
FUNCTION {new.sentence.checka}
{ empty$
'skip$
'new.sentence
if$
}
FUNCTION {new.sentence.checkb}
{ empty$
swap$ empty$
and
'skip$
'new.sentence
if$
}
FUNCTION {field.or.null}
{ duplicate$ empty$
{ pop$ "" }
'skip$
if$
}
FUNCTION {emphasize}
{ duplicate$ empty$
{ pop$ "" }
{ abnt.emphasize "{" * swap$ * "}" * }
if$
}
FUNCTION {tie.or.space.prefix} %if text length less than 3 chars. uses a tie
{ duplicate$ text.length$ #5 <
{ "~" }
{ " " }
if$
swap$
}
FUNCTION {no.space} { { "" } swap$ }
FUNCTION {space.word} { " " swap$ * " " * }
FUNCTION {bbl.and}
{ abnt.and.type #0 = {" e "} 'skip$ if$
abnt.and.type #1 = {" \& "} 'skip$ if$}
FUNCTION {bbl.chapter} { "cap." }
FUNCTION {bbl.colon} {": "}
FUNCTION {bbl.editors} { "Ed." }
FUNCTION {bbl.editor} { "Ed." }
FUNCTION {bbl.edby} { "editado por" }
FUNCTION {bbl.edition} { "ed." }
FUNCTION {bbl.empty} {""}
FUNCTION {bbl.etal}{abnt.etal.text "" = {""} {" " abnt.etal.text *} if$}
FUNCTION {bbl.doi.url} {"http://dx.doi.org/"}
FUNCTION {bbl.in}{ "In" iso.abbreviation 'skip$ { bbl.colon *} if$}
FUNCTION {bbl.ldots} %#0 use nothing, #1 use \ldots, #2 use $\ldots$, 3# use {...}
{abnt.ldots.type
{abnt.ldots.type #1 = {"\ldots"} 'skip$ if$
abnt.ldots.type #2 = {"$\ldots$"} 'skip$ if$
abnt.ldots.type #3 = {"{...}"} 'skip$ if$}
{""} %for #0 use nothing
if$}
FUNCTION {bbl.master} { "Mestrado" }
FUNCTION {bbl.missing.year}
{abnt.missing.year
{"[s.d.]"} %#1
{""} %#0
if$}
FUNCTION {bbl.monography} { "Monografia" }
FUNCTION {bbl.mthesis} { "Disserta\c{c}\~ao" }
FUNCTION {bbl.no.address} {"[S.l.]"}
FUNCTION {bbl.no.address.no.publisher} {"[S.l.: s.n.]"}
FUNCTION {bbl.no.publisher} {"[s.n.]"}
FUNCTION {bbl.number} { iso.abbreviation {"no."} {"n."} if$ }
FUNCTION {bbl.nr} { "n." }
FUNCTION {bbl.of} { "de" }
FUNCTION {bbl.phd} { "Doutorado" }
FUNCTION {bbl.phdthesis} { "Tese" }
FUNCTION {bbl.pages}
{pagename empty$
{ "p." }
{pagename}
if$
}
FUNCTION {bbl.page} { bbl.pages }
FUNCTION {bbl.reprint} {"Separata de"}
FUNCTION {bbl.semicolon} { "; "}
FUNCTION {bbl.same.field} {"\underline{\ \ \ \ \ \ \ \ }"}
FUNCTION {bbl.techrep} { "Rel. Tec." }
FUNCTION {bbl.url.accessdate}
{iso.abbreviation { "Cited "} {"Acesso em: "} if$}
FUNCTION {bbl.url.available}
{ iso.abbreviation {"Available from Internet: "} {"Dispon{\'\i}vel em: "} if$}
FUNCTION {bbl.void} {""}
FUNCTION {bbl.volume} { iso.abbreviation {"vol."} {"v."} if$ }
MACRO {jan} {"jan."}
MACRO {feb} {"fev."}
MACRO {mar} {"mar."}
MACRO {apr} {"abr."}
MACRO {may} {"maio"}
MACRO {jun} {"jun."}
MACRO {jul} {"jul."}
MACRO {aug} {"ago."}
MACRO {sep} {"set."}
MACRO {oct} {"out."}
MACRO {nov} {"nov."}
MACRO {dec} {"dez."}
FUNCTION {is.num}
{ chr.to.int$
duplicate$ "0" chr.to.int$ < not
swap$ "9" chr.to.int$ > not and
}
FUNCTION {str.to.int}
{ duplicate$ is.num
{chr.to.int$ #48 -}
'skip$
if$
}
FUNCTION {bibinfo.check} %usage: field "field" bibinfo.check
{ swap$ duplicate$ missing$
{pop$ pop$ ""}
{ duplicate$ empty$
{swap$ pop$}
{swap$ pop$}
if$
}
if$
}
FUNCTION {bibinfo.warn}
{ swap$
duplicate$ missing$
{swap$ "faltando " swap$ * " em " * cite$ * warning$ pop$ ""}
{ duplicate$ empty$
{swap$ "vazio " swap$ * " em " * cite$ * warning$}
{swap$ pop$}
if$
}
if$
}
FUNCTION {write.field.verbatim}
{
duplicate$ missing$
{pop$ pop$}
{
s text.length$ #0 >
{s "," * newline$ write$ "" 's :=}
'skip$
if$
swap$
"={" * swap$ * "}" *
s swap$ * 's :=
}
if$
}
FUNCTION {write.entry.verbatim1}
{
"address" address write.field.verbatim
"author" author write.field.verbatim
"booktitle" booktitle write.field.verbatim
"booksubtitle" booksubtitle write.field.verbatim
"chapter" chapter write.field.verbatim
"conference-number" conference-number write.field.verbatim
"conference-year" conference-year write.field.verbatim
"conference-location" conference-location write.field.verbatim
"edition" edition write.field.verbatim
"editor" editor write.field.verbatim
"editortype" editortype write.field.verbatim
"dimensions" dimensions write.field.verbatim
"furtherresp" furtherresp write.field.verbatim
"howpublished" howpublished write.field.verbatim
"illustrated" illustrated write.field.verbatim
"institution" institution write.field.verbatim
"isbn" isbn write.field.verbatim
"issn" issn write.field.verbatim
"journal" journal write.field.verbatim
}
FUNCTION {write.entry.verbatim2}
{
"key" key write.field.verbatim
"month" month write.field.verbatim
"note" note write.field.verbatim
"marginnote" marginnote write.field.verbatim
"number" number write.field.verbatim
"organization" organization write.field.verbatim
"org-short" org-short write.field.verbatim
"pages" pages write.field.verbatim
"pagename" pagename write.field.verbatim
"publisher" publisher write.field.verbatim
"reprinted-from" reprinted-from write.field.verbatim
"reprinted-text" reprinted-text write.field.verbatim
"school" school write.field.verbatim
"series" series write.field.verbatim
"subtitle" subtitle write.field.verbatim
"section" section write.field.verbatim
"title" title write.field.verbatim
"type" type write.field.verbatim
}
FUNCTION {write.entry.verbatim3}
{
"url" url write.field.verbatim
"urlaccessdate" urlaccessdate write.field.verbatim
"volume" volume write.field.verbatim
"year" year write.field.verbatim
"abnt-emphasize" abnt-emphasize write.field.verbatim
"abnt-experimental" abnt-experimental write.field.verbatim
"abnt-doi" abnt-doi write.field.verbatim
"abnt-dont-use-etal" abnt-dont-use-etal write.field.verbatim
"abnt-full-initials" abnt-full-initials write.field.verbatim
"abnt-ldots-type" abnt-ldots-type write.field.verbatim
"abnt-missing-year" abnt-missing-year write.field.verbatim
"abnt-cite-style" abnt-cite-style write.field.verbatim
"abnt-no-etal-label" abnt-no-etal-label write.field.verbatim
%abnt-note
"abnt-repeated-author-omit" abnt-repeated-author-omit write.field.verbatim
"abnt-repeated-title-omit" abnt-repeated-title-omit write.field.verbatim
"abnt-show-options" abnt-show-options write.field.verbatim
"abnt-refinfo" abnt-refinfo write.field.verbatim
"abnt-thesis-year" abnt-thesis-year write.field.verbatim
"abnt-title-command" abnt-title-command write.field.verbatim
"abnt-url-package" abnt-url-package write.field.verbatim
"abnt-verbatim-entry" abnt-verbatim-entry write.field.verbatim
}
FUNCTION {write.entry.verbatim}
{"" 's := "" 't :=
abnt.verbatim.entry
{"{\footnotesize\begin{verbatim}" newline$ write$
"@" type$ * "{" * cite$ * 's :=
write.entry.verbatim1
write.entry.verbatim2
write.entry.verbatim3
s "" = {"}"} {s "}" *} if$
newline$ write$
"\end{verbatim}}" newline$ write$}
{newline$}
if$}
STRINGS { bibinfo}
INTEGERS { nameptr namesleft numnames }
FUNCTION {get.person} {"{vv }{ll}{, jj}{, ff}" format.name$}
FUNCTION {get.last.name} {#1 "{ll}" format.name$}
FUNCTION {get.first.name} {#1 "{ff}" format.name$}
FUNCTION {get.von} {#1 "{vv}" format.name$}
FUNCTION {get.jr} {#1 "{jj}" format.name$}
FUNCTION {is.composed.von}
{get.person
get.von duplicate$ empty$ {pop$ #0}
{duplicate$
get.first.name empty$ not
swap$ get.last.name empty$ not and
} if$
}
FUNCTION {recompose.name}
{get.person duplicate$ duplicate$ duplicate$
get.von #1 "{ll }" format.name$ swap$
get.last.name *
swap$ #1 "{, ff}" format.name$ *
swap$ get.von #1 "{ ff}" format.name$ *
}
FUNCTION {format.single.name}
{
s nameptr get.person 'r :=
abnt.last.names
{r #1 "{ll}{ jj}" format.name$ "u" change.case$
abnt.full.initials
{r #1 "{, ff}{ vv}" format.name$ *}
{r #1 "{, f.}{ vv}" format.name$ *}
if$}
{%r #1 is.composed.von {r #1 recompose.name 'r :=} 'skip$ if$
r #1 "{ll}" format.name$
#1 "{ll}" format.name$
r #1 "{ jj}" format.name$ * "u" change.case$
abnt.full.initials
{r #1 "{, ff}{ vv}" format.name$ *
r #1 "{ll}" format.name$
#1 "{ ff}{ vv}" format.name$ *}
{iso.author.punctuation
{r #1 "{, f{}}{ vv}" format.name$ *}
{r #1 "{, f.}{ vv}" format.name$ *} if$
r #1 "{ll}" format.name$
#1 "{ f.}{ vv}" format.name$ *}
if$}
if$
}
FUNCTION {format.names}
{ 'bibinfo := duplicate$ empty$ 'skip$
{'s :=
"" 't :=
#1 'nameptr := s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ format.single.name
bibinfo bibinfo.check
't :=
nameptr #1 >
{nameptr #1 #1 + = numnames abnt.etal.list > and
{abnt.etal.list {"others" 't := #1 'namesleft :=} 'skip$ if$ }
'skip$
if$
namesleft #1 >
{ "; " * t * }
{ numnames #2 >
{ "" * }
'skip$
if$
s nameptr "{ll}" format.name$ duplicate$ "others" =
{ 't := }
{ pop$ }
if$
t "others" =
{ bbl.etal *}
{ "; " * t *}
if$ }
if$ }
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft := }
while$
} if$
}
%from plain.bst
FUNCTION {format.names.plain}
{ 's :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr "{ff }{vv }{ll}{ jj}" format.name$ 't :=
nameptr #1 >
{ namesleft #1 >
{ ", " * t * }
{ numnames #20 >
{ "," * }
'skip$
if$
t "others" =
{ bbl.etal * }
{ bbl.and * t * }
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
}
FUNCTION {format.names.ed} {format.names}
FUNCTION {format.authors}
{
author "author" format.names
}
FUNCTION {format.authors.plain}
{
author format.names.plain
}
FUNCTION {get.bbl.editor} { editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ }
FUNCTION {format.book.pages}
{ pages "pages" bibinfo.check duplicate$ empty$
'skip$
{ "~" * bbl.pages * }
if$
}
FUNCTION {format.dimensions}
{ dimensions empty$
'skip$
{ dimensions output}
if$
}
FUNCTION {format.furtherresp}
{ furtherresp empty$
'skip$
{ furtherresp output}
if$
}
FUNCTION {format.illustrated}
{ illustrated missing$
'skip$
{illustrated empty$
{"il." output}
{illustrated output}
if$}
if$
}
FUNCTION {format.isbn}
{ isbn "isbn" bibinfo.check duplicate$ empty$
'skip$
{new.block "ISBN " swap$ *}
if$
}
FUNCTION {format.issn}
{ issn "issn" bibinfo.check
duplicate$ empty$ 'skip$
{new.block "ISSN " swap$ *}
if$
}
FUNCTION {format.note}
{ note empty$
{ "" }
{ note #1 #1 substring$
duplicate$ "{" =
'skip$
{ output.state mid.sentence =
{ "l" }
{ "u" }
if$
change.case$ }
if$
note #2 global.max$ substring$ * "note" bibinfo.check }
if$
}
FUNCTION {format.howpublished}
{ howpublished empty$
{ "" }
{ howpublished #1 #1 substring$
duplicate$ "{" =
'skip$
{ output.state mid.sentence =
{ "l" }
{ "u" }
if$
change.case$ }
if$
howpublished #2 global.max$ substring$ * "howpublished" bibinfo.check }
if$
}
%ABNT styles require that the title acts as an author if
%typical author fields are absent. In this case the first
%word is uppercase. Our main problem is to establish what
%the first word actually is since portuguese uses accents.
%For example: Fun{\c c}\ao (Funcao) is a whole word but contains a
%space, but if we write Fun\c{c}\ao \c is converted to uppercase...
%You get the problem, don't you?
FUNCTION {format.title.as.author}
{ 's := %holds the title
#1 'title.pos := %our position in the title
#1 'first.word := %boolean, true if we already have the first word
#1 'no.bracket := %boolean, false if we are inside a {}
"" 't := %holds the first title.pos characters of the title
{first.word}
{s title.pos #1 substring$ 'title.char :=
%checks if the character is a {
title.char "{" = {#0 'no.bracket :=} 'skip$ if$
%if we are in a bracket
no.bracket 'skip$ {title.char "}" = {#1 'no.bracket :=} 'skip$ if$} if$
type$ "journalpart" =
{title.char "." = title.char ":" = or title.char "!" = or
title.char "," = or title.char ";" = or title.char "?" = or}
{title.char " " =}
if$ s t = or no.bracket and
{#0 'first.word :=
t title.char * "u" change.case$
title.pos #1 + 'title.pos :=
s title.pos global.max$ substring$ * 's :=}
{title.pos #1 + 'title.pos := t title.char * 't :=}
if$
}
while$
s
}
%compares current title with the title of the previous entry
FUNCTION {compare.title}
{abnt.repeated.title.omit
{duplicate$ "" = 'skip$
{duplicate$ previous.title = repeated.author and
{duplicate$ 'previous.title := pop$ bbl.same.field}
{duplicate$ 'previous.title :=}
if$}
if$}
'skip$
if$
}
FUNCTION {apply.title.command}
{abnt.title.command
{duplicate$ empty$ 'skip$
{"\bibtextitlecommand{" type$ * "}{" * swap$ * "}" *}
if$}
'skip$ if$
}
FUNCTION {format.title}
{author empty$ editor empty$ and organization empty$ and
{title format.title.as.author}
{title duplicate$ empty$ {pop$ ""} {"t" change.case$} if$}
if$
subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$
apply.title.command
compare.title
}
FUNCTION {n.dashify}
{
't :=
""
{ t empty$ not }
{ t #1 #1 substring$ "-" =
{ t #1 #2 substring$ "--" = not
{ "--" *
t #2 global.max$ substring$ 't :=
}
{ { t #1 #1 substring$ "-" = }
{ "-" *
t #2 global.max$ substring$ 't :=
}
while$
}
if$
}
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
}
if$
}
while$
}
FUNCTION {word.in} { bbl.in " " * }
FUNCTION {format.month}
{ month empty$ 'skip$
{month "month" bibinfo.check}
if$
}
FUNCTION {format.date}
{ year empty$
{ month empty$
{ bbl.missing.year }
{ "existe o campo month (mes) mas nao o campo year (ano) em " cite$ * warning$ month}
if$}
{ month empty$
{ year n.dashify}
{ month " " * year * }
if$}
if$
}
FUNCTION {format.btitle}
{author empty$ editor empty$ and organization empty$ and
{title format.title.as.author "title" bibinfo.check duplicate$ empty$ 'skip$ {} if$
subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$}
{title "title" bibinfo.check emphasize duplicate$ empty$ 'skip$ {} if$
subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$}
if$
apply.title.command
compare.title
}
FUNCTION {either.or.check}
{ empty$
'pop$
{ "nao posso usar ambos " swap$ * " os campos em " * cite$ * warning$ }
if$
}
FUNCTION {format.volume} %leaves formatted or empty volume on the stack
{volume duplicate$ empty$
'skip$
{volume #1 #1 substring$ is.num
{bbl.volume swap$ tie.or.space.prefix * *}
'skip$
if$}
if$
}
FUNCTION {format.number} %leaves formatted or empty number on the stack
{ number duplicate$ empty$
'skip$
{bbl.number swap$ tie.or.space.prefix * *}
if$
}
FUNCTION {format.patent.number}
{ number
}
FUNCTION {format.bvolume}
{ volume empty$
{ "" }
{ format.volume
number empty$ 'skip$ {output format.number} if$
series "series" bibinfo.check
duplicate$ empty$ 'pop$
{ swap$ bbl.of space.word * swap$
emphasize * }
if$
}
if$
}
FUNCTION {format.bvolume.if.no.series}
{ series empty$
{ format.bvolume }
{ "" }
if$
}
FUNCTION {format.number.or.volume}
{number empty$
{format.volume}
{number} %we use the pure number here without leading "n."
if$
}
FUNCTION {format.volume.and.number}
{format.volume output
format.number
}
FUNCTION {format.volume.number.series}
{ number empty$ volume empty$ and
{ series empty$
{ "" }
{" (" series "series" bibinfo.check * ")" *}
if$}
{ series empty$
{""} %{ format.number.or.volume }
{ " (" series "series" bibinfo.check * ", " *
format.number.or.volume * ")" * }
if$ }
if$
}
FUNCTION {extract.num}
{ duplicate$ 't :=
"" 's :=
{ t empty$ not }
{ t #1 #1 substring$
t #2 global.max$ substring$ 't :=
duplicate$ is.num
{ s swap$ * 's := }
{ pop$ "" 't := }
if$ }
while$
s empty$
'skip$
{ pop$ s }
if$
}
FUNCTION {format.edition}
{ edition duplicate$ empty$ 'skip$
{output.state mid.sentence = { "l" } { "t" } if$ change.case$
"edition" bibinfo.check
edition #1 #1 substring$ is.num {". " * bbl.edition * } 'skip$ if$}
if$
}
INTEGERS { multiresult }
FUNCTION {multi.page.check}
{ 't :=
#0 'multiresult :=
{ multiresult not
t empty$ not
and }
{ t #1 #1 substring$
duplicate$ "-" =
swap$ duplicate$ "," =
swap$ "+" =
or or
{ #1 'multiresult := }
{ t #2 global.max$ substring$ 't := }
if$ }
while$
multiresult
}
FUNCTION {format.pages}
{ pages duplicate$ empty$ 'skip$
{ duplicate$ multi.page.check
{ n.dashify bbl.pages swap$}
{ bbl.page swap$ }
if$
tie.or.space.prefix "pages" bibinfo.check * * }
if$
}
FUNCTION {format.journal.pages}
{ pages empty$ {""}
{ pages n.dashify bbl.pages
swap$ tie.or.space.prefix "pages" bibinfo.check * *}
if$
}
FUNCTION {get.url.type}
{s #1 #5 substring$ "http:" = {http.url}
{s #1 #5 substring$ "file:" = {file.url}
{s #1 #4 substring$ "ftp:" = {ftp.url}
{s #1 #4 substring$ "doi:" = {doi.url}
{s #1 #7 substring$ "mailto:" = {mailto.url} {unknown.url} if$}
if$}
if$}
if$}
if$
'url.type :=
}
FUNCTION {expand.doi}
{s
url.type doi.url =
{#5 global.max$ substring$ bbl.doi.url swap$ *}
'skip$ if$
}
INTEGERS {url.pos url.length}
FUNCTION {filter.url.tex}
{s text.length$ #1 + 'url.length :=
#1 'url.pos := "" 't :=
{url.pos url.length <}
{s url.pos #1 substring$
duplicate$ "_" = {pop$ "\underline{\ }" } 'skip$ if$
duplicate$ "%" = {pop$ "\%" } 'skip$ if$
duplicate$ "&" = {pop$ "\&" } 'skip$ if$
duplicate$ "~" = {pop$ "\~{}" } 'skip$ if$
duplicate$ "/" = {pop$ "\-/" } 'skip$ if$
duplicate$ "." = {pop$ "\-." } 'skip$ if$
duplicate$ "\" = {pop$ "{\textbackslash}" } 'skip$ if$
t swap$ * 't :=
url.pos #1 + 'url.pos :=
}
while$