-
Notifications
You must be signed in to change notification settings - Fork 0
/
abnt.cls
2011 lines (1769 loc) · 64.4 KB
/
abnt.cls
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.cls,v 1.27.2.1 2004/11/02 15:04:29 gweber Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ABNT.CLS
%
%
% Licence: LPPL (LaTeX Project Public License)
% You can change this file in the terms of LPPL
% (http://www.latex-project.org/lppl.html)
%
% Licenca: LPPL (LaTeX Project Public License)
% Esta licenca diz basicamente que se voce editar o codigo desta
% classe, mesmo localmente (no seu micro), voce DEVE RENOMEAR o arquivo
% da classe!! Como sempre, nao eh dada nenhuma garantia.
% Para o texto completo da licenca, favor seguir o endereco
% http://www.latex-project.org/lppl.html
%
% Classe para confeccao de monografias, dissertacoes ou teses
% de acordo com as normas da Associacao Brasileira de Normas
% Tecnicas (ABNT). Esta classe, junto com o estilo bibTeX, foram
% desenvolvidos no grupo de trabalho abnTeX (ABsurd Norms for TeX :-)
% (http://abntex.codigolivre.org.br)
%
% Class to make theses or monographies following norms defined by
% Brazilian Association for Tecnical Norms. This class is developed
% by abnTeX group (http://abntex.codigolivre.org.br), together with two
% bibTeX styles.
%
% Author (class): Miguel Vinicius Santini Frasson
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Implementation of this class:
%
% preamble
% class identification
% including required packages
% option declarations
% pnumabnt (default), pnumplain, pnumromarab
% sumariocompleto (default), sumarioincompleto
% abnttocpagnum (default), tocpagnumnormal
% abntfigtabnum (default), normalfigtabnum
% noheader, header, plainheader (default), ruledheader,
% capchap, capsec
% anapmaiusc (default), anapnormal
% apapindentindic (default), anapindentcustom
% anapname (default), anapnoname
% espacosimples, espacoumemeio (default), espacoduplo
% sempaccomuns (default), paccomuns
% -> no longer supported (kept for compatibility)
% autobm (default), noautobm
% times, notimes (default)
% indentfirst (default), noindentfirst
% mechanism for saving other options names
% perform tests to set fontsize, openright and paper properly
% (in order to get 12pt, a4 and openright as default, but user can change)
% option procession
% work around for prevent report to add figure and table counter in the
% reset list of chapter counter (option disables it)
% class 'report' loaded
% undo work figure and table around if necessary.
%
% implementation
% setting default spacings
% (NOT) loading commom packages
% inputenc[latin1], amsmath, amssymb,
% amsbsy, dsfont, eucal[mathscr]
% loading 'setspace' package, but providing 'workaround' if user don't
% use it.
% setting margins with simple commands
% creating page styles 'plainheader', 'header' and 'ruledheader'
% Page numbering section
% setting switches and defining \ABNTBeginOfTextualPart according to
% the page numbering scheme in option
% line spacing commands and environments
% Chapter and section: titles, page numbering, etc
% This is a very delicated part. Let's give a flavour of what
% happened. See comments in implementation for details.
% redefining \chapter
% - tests for determine begin of textual part and make changes at this
% event.
% - \pretextualchapter: a stared chapter in the pre-textual part
% - ProximoForaDoSumario -> switches off \ABNTaddcontentsline.
% - Marks: care is they are inserted by default or not.
% - redefinig \@schapter: now \chapter* is almost equal to \chapter,
% appart from the title display. It also includes an entry in TOC.
% - \@part and \@spart redefined: font purposes.
% - defined \ABNTstartsection: stared section with centralized titles
% and inclusion in TOC.
% - new \@dottedtoline for compleance with NBR 6027-1989
% - \@makechapterhead and \@makeschapterheadredefined to fit
% norms. Paying attention to capchap and fonts.
% - redefined all \section like commands (apply last redefinitions
% and font purposes)
% - \anexo and \apendice -> apply old \appendix changes and
% replaces \@chapter by \@anapchapter.
% redefining important commands (those that set page marks, getting rid
% of explicit \MakeUppercase)
% \tableofcontents
% \listoffigures
% \listoftables
% thebibliography
% theindex (now balanced columns) or use \IndiceNaoBalanceado
% custumizable caption separator -> temporarely commented (not required)
% environment citado = citacao, for long quotations
% pre-textual elements
% Capa (cover) and Folha de rosto (face page): defining commands
% \instituicao
% \autor
% \orientador
% \coorientador
% \titulo
% \comentario
% \local
% \data
% and
% \capa, displaying what is required according to norms.
% \folhaderosto, that prints the face page, according to norms.
% Resumo and Abstract.
% Environment folhadeaprovacao and \assinatura(*){}
% prototype for list of symbols -> no future, I think.
% Loading fonts if required.
% Auto bold math
% Indentation of first paragraph
% commented announcements.
%
% That is it ;-D
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% List of Changes
% ---------------
% $Log: abnt.cls,v $
% Revision 1.27.2.1 2004/11/02 15:04:29 gweber
% resolvido problema com bookmarks e hyperrefs.
%
% Revision 1.27 2004/04/01 14:07:46 mvsfrasson
%
%
% Retirado um bug no \@chapter que causa o cabecalho ter o numero do capitulo errado
%
% Revision 1.26 2003/10/13 09:40:01 gweber
% Passa a usar cvs-id.def para gerar informações sobre data e versão.
%
% Revision 1.25 2003/09/16 16:49:29 gweber
% Troca de \bibname por \refname o que equivale a trocar "Referêncas Bibliográficas" por
% "Referências". Isto atende ao que entendemos esteja implícito na NBR14724-2002.
%
% Revision 1.24 2003/08/22 14:45:18 gweber
% Resolvido bug 178 que fazia o texto de \part aparecer duas vezes.
%
% Revision 1.23 2003/06/30 14:10:47 gweber
% Links criados com hyperref para apêndices e anexos não misturam mais com os links para capítulos comuns,
% resolvendo o bug #140.
%
% Revision 1.22 2003/05/30 10:39:19 gweber
% Alterações introduzidas em 0.7-beta.
%
% Revision 1.21.2.1 2003/05/30 10:16:07 gweber
% Correction of bug 137 which causes the class to fail when loading
% the package hyperref and using \tableofcontents.
% This also resolves partially bugs 82 and 51.
%
%
% Added in version 1.1 patch 1
%
% - fixed bug of undefined \ABNT<section name>mark, which shows twice the
% section name (only for subsection, subsubsection, and paragraph)
%
% Added in version 1.1
%
% - Fixed bug of missing paragraphy after \chapter
% - \ProximoForaDoSumario has optional parameter to et page marks
% - Fixed bug of abscense of package setspace.
% - Added options `abntfigtabnum' and `normalfigtabnum' to deal with
% figure and table counters.
% - Added abnt style for toc. Options `abnttoc' and
% `normaltoc' were added.
% - Fixed bug of defining pagestyles only if non-noheader.
%
% Added in version 1 (finally)
%
% - Fixed mispelling on command \espaco.
% - Fixed "capsec" (not working before).
% - Added full support for Annex and Appendix, with several class options
% and commands for customization.
% - Not using package "textcase" anymore, since there is a undesirable
% extra space included with \MakeUppercase.
% - Fixed default options. Now "openright" is really default.
% - Now using feature of "setspace" to avoid extra spacing on display
% math. No bugs if the version of setspace is not up to date.
% - Added \ProximoForaDoSumario, to avoid one to not include all \chapter*
% if one wants to set diferently the title and contents of such chapters.
% - Fixed bug on \part toc entries (buggy extra space)
% - Now font size for \capter(*) is given by \ABNTchaptersize, preventing a
% boring redefinition of \ABNTtocchapterfont.
% - Option paccomuns no longer default.
%
% Added in version 1 beta 3
%
% - Fixed bug in page marks for \section*{}.
% - "setspace" no longer require especific (new) version.
% - Added "no displayskip stretch" support offered by 'setspace' for better
% aesthetic.
% - Added compatibility with "hyperref" package (no more incompatible
% optional parameter on \chapter* -- hyperref redefines some commands)
% - Useless commands removed: \cabecalhoesq and \cabecalhodir.
%
% Added in version 1 beta 2
%
% - Correct figure and table counter.
% - Some support to "folha de apresentacao", including environment
% \begin{folhadeapresentacao} e \assinatura{} (signature).
% - Fixed bug in pnumplain and headers.
% - Fixed bug in page marks for \@schapter.
%
% Added in version 1 beta
%
% Total reformulation of the class! The main added feature are:
% - Good machanism for "Folha de Rosto" (face page) added.
% - Page numbering squemes according to the norms.
% - Right page headings.
% - Correct section titles.
% - Several options added.
% - Features removed, like margin care
% ...too many changes to list. Just like a "new" class.
%
% Added in version 0.4.3
%
% - Stupid but severe bug on \listoffigures and \listoftables
% left from previous version finally removed
% - Bug fixes in theindex and thebibliography
% - Redefinition of \cleardoublepage (empty page => page style empty)
% - This `list of changes' added
%
% Added in version 0.4.2
%
% - Added \StarChaptersInTOC, \StarChaptersNotInTOC to differenciate
% from "standard" (old) stared chapters like \tableofcontents,
% \listoffigures, \listoftables, thebibliography and theindex.
% - Huge bugs in commands or environments \tableofcontents, \listoffigures,
% \listoftables, thebibliography and theindex fixed.
% - Command \SpAcEs changed to \spABNT (more reliable than before)
%
% Added in version 0.4.1
%
% - Extract forgotten debug command
% - Fix conflict (\Sp command) in final messagem, creating \SpAcEs (and
% hoping nobody made it before)
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% PREAMBLE %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% IDENTIFICATION %%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}%
\input{cvs-id.def}
\CVSExtract$Id: abnt.cls,v 1.27.2.1 2004/11/02 15:04:29 gweber Exp $
\CVSClass{abnt}{\space Classe abnt (NBR6024, NBR6027, NBR6028, NBR14724)} %substitui \ProvidesPackage (replaces \ProvidesPackage)
% \NeedsTeXFormat{LaTeX2e}%
% \ProvidesClass{abnt}%
% [2002/05/20 version 1 da Classe LaTeX2e ABNT]
%%%%%% Required packages for the implementation of this class %%%%%%
% ifthen - conditions in LaTeX
\RequirePackage{ifthen}
% calc - standard package for length and number easy calculations
\RequirePackage{calc}
% multicol - better multicolunms
\RequirePackage{multicol}
%%%%%%%%%%%%% OPTION DECLARATION %%%%%%%%%%%%
%% Page numbering squeme
\providecommand{\ABNTpnum}{}
\DeclareOption{pnumabnt} {\renewcommand{\ABNTpnum}{ABNT}}
\DeclareOption{pnumplain} {\renewcommand{\ABNTpnum}{plain}}
\DeclareOption{pnumromarab} {\renewcommand{\ABNTpnum}{RomSumArab}}
\ExecuteOptions{pnumabnt}
%% Automatically include in TOC bibliography, index and stared chapters
\newboolean{ABNTincludeintoc}
\DeclareOption{sumariocompleto} {\setboolean{ABNTincludeintoc}{true}}
\DeclareOption{sumarioincompleto} {\setboolean{ABNTincludeintoc}{false}}
\ExecuteOptions{sumariocompleto}
%% Style of page numbers in TOC
\newboolean{ABNTpagenumstyle}
\DeclareOption{abnttoc} {\setboolean{ABNTpagenumstyle}{true}}
\DeclareOption{normaltoc} {\setboolean{ABNTpagenumstyle}{false}}
\ExecuteOptions{abnttoc}
%% Figures and tables independent of sections?
\newboolean{ABNTfigtabnumbers}
\DeclareOption{abntfigtabnum}{\setboolean{ABNTfigtabnumbers}{true}}
\DeclareOption{normalfigtabnum}{\setboolean{ABNTfigtabnumbers}{false}}
\ExecuteOptions{abntfigtabnum}
%% Option: page headers
\newboolean{ABNTheader}
\providecommand{\ABNTheadertype}{\relax}
\DeclareOption{noheader} {\setboolean{ABNTheader}{false}}
\DeclareOption{header} {\setboolean{ABNTheader}{true}
\renewcommand{\ABNTheadertype}{normal}}
\DeclareOption{plainheader} {\setboolean{ABNTheader}{true}
\renewcommand{\ABNTheadertype}{plain}}
\DeclareOption{ruledheader} {\setboolean{ABNTheader}{true}
\renewcommand{\ABNTheadertype}{ruled}}
\ExecuteOptions{plainheader}
%% Option `capchap', `capsec':
%% titles of chapters or sections in capital letters
\newboolean{ABNTcapchap}
\setboolean{ABNTcapchap}{false}
\newboolean{ABNTcapsec}
\setboolean{ABNTcapsec}{false}
\DeclareOption{capchap}{\setboolean{ABNTcapchap}{true}
\setboolean{ABNTCapAnnexAppendix}{true}}
\DeclareOption{capsec}{\setboolean{ABNTcapsec}{true}}
%% Option `anapmaiusc' and `anapnormal'
%% should \annexname and \appendixname be on capital letters?
\newboolean{ABNTCapAnnexAppendix}
\setboolean{ABNTCapAnnexAppendix}{true} % manual execution of option for
% cooperation between `capchap'
% and `anexapendnormal'
\DeclareOption{anapmaiusc}{\setboolean{ABNTCapAnnexAppendix}{true}}
\DeclareOption{anapnormal}{\setboolean{ABNTCapAnnexAppendix}{false}}
%% Option `anapindentindic' in order to \anexo or \apendice make ABNT
%% strict indentation on its titles.
\newboolean{ABNTAnApIndicativoIndent}
\DeclareOption{anapindicindent}{\setboolean{ABNTAnApIndicativoIndent}{true}}
\DeclareOption{anapcustomindent}{\setboolean{ABNTAnApIndicativoIndent}{false}}
\ExecuteOptions{anapindicindent}
%% Option `anapindentindic' in order to \anexo or \apendice make ABNT
%% strict indentation on its titles.
\newboolean{ABNTAnApName}
\DeclareOption{anapname}{\setboolean{ABNTAnApName}{true}}
\DeclareOption{anapnoname}{\setboolean{ABNTAnApName}{false}}
\ExecuteOptions{anapname}
%% Line Spacing options: change current setting.
\newcommand*{\ABNTespacodefault}{} %
\DeclareOption{espacoumemeio} {\renewcommand*{\ABNTespacodefault}%
{\taxaespacoumemeio}} % default
\DeclareOption{espacosimples} {\renewcommand*{\ABNTespacodefault}%
{\taxaespacosimples}}
\DeclareOption{espacoduplo} {\renewcommand*{\ABNTespacodefault}%
{\taxaespacoduplo}}
\ExecuteOptions{espacoumemeio}
%% Margin care --> Removed since version 1 beta
%% Options `spacednotes': removed since version 0.3
% Assuming notes single spaced always (no alternative if using setspace ;-D
%% Option: loading common packages NO LONGER SUPPORTED!!!
\newboolean{ABNTcommonpack}
\DeclareOption{paccomuns} {\setboolean{ABNTcommonpack}{true}}
\DeclareOption{sempaccomuns} {\setboolean{ABNTcommonpack}{false}}
\ExecuteOptions{sempaccomuns}
%% Auto bold math: bold math version ir text font is in bold face
\newboolean{ABNTautobm}
\DeclareOption{autobm} {\setboolean{ABNTautobm}{true}}
\DeclareOption{noautobm} {\setboolean{ABNTautobm}{false}}
\ExecuteOptions{autobm}
%% font option: times as default or not
\newboolean{ABNTtimesfont}
\DeclareOption{times} {\setboolean{ABNTtimesfont}{true}}
\DeclareOption{notimes} {\setboolean{ABNTtimesfont}{false}}
\ExecuteOptions{notimes}
%% Option to indent the first paragraph of each section or chapter
\newboolean{ABNTindentfirst}
\DeclareOption{indentfirst} {\setboolean{ABNTindentfirst}{true}}
\DeclareOption{noindentfirst} {\setboolean{ABNTindentfirst}{false}}
\ExecuteOptions{indentfirst}
\def\ABNTcurrentoptions{}
\newcommand{\AddCurrentOptionToList}{%
\ifx\ABNTcurrentoptions\@empty%
\edef\ABNTcurrentoptions{\CurrentOption}%
\else%
\edef\ABNTcurrentoptions{\ABNTcurrentoptions,\CurrentOption}%
\fi%
}
%% All options not defined are passed to `report'
\DeclareOption*{%
\AddCurrentOptionToList
% if some font or paper option is passed, a flag is set.
\ifthenelse{\equal{\CurrentOption}{10pt}\or\equal{\CurrentOption}{11pt}}%
{\setboolean{ABNTfontsize}{true}}{}%
\ifthenelse{\equal{\CurrentOption}{a5paper}\or%
\equal{\CurrentOption}{b5paper}\or%
\equal{\CurrentOption}{letterpaper}}%
{\setboolean{ABNTpaper}{true}}{}%
\ifthenelse{\equal{\CurrentOption}{openany}}%
{\setboolean{ABNTopen}{true}}{}%
\PassOptionsToClass{\CurrentOption}{report}}
% testing if user use other options for font size or paper
% than 12pt, a4paper and openright
\newboolean{ABNTfontsize}
\setboolean{ABNTfontsize}{false}
\newboolean{ABNTpaper}
\setboolean{ABNTpaper}{false}
\newboolean{ABNTopen}
\setboolean{ABNTopen}{false}
% Process options (without star -> in the order of definition!).
\ProcessOptions
% After process options, flags are properly set.
% Passing options to class, that will be loaded in \LoadClass
\ifthenelse{\boolean{ABNTfontsize}}%
{}{\PassOptionsToClass{12pt}{report}}
\ifthenelse{\boolean{ABNTpaper}}%
{}{\PassOptionsToClass{a4paper}{report}}
\ifthenelse{\boolean{ABNTopen}}%
{}{\PassOptionsToClass{openright}{report}}
%%%%%%%%% Lying to report :-) -> working
%%
%% Report says: \newcounter{figure}[chapter], \newcounter{table}[chapter]
%% But this is not ABNT (figure counter should not reset to 1 if chapter
%% increments). There is no straight forward way to "\renewcounter"
%% then. So I have to make an work around.
%%
%% Idea: redefine \newcounter s.t. id newcounter is figure or table, then do
%% what I want (do not include [chapter] in the command). Otherwise, do
%% normal \newcounter.
%%
%% Advantage of this: some package may suppose that the counters of figure
%% and table are actually figure and table, and not ABNTfigure, ABNTtable,
%% as in previous versions
\ifthenelse{\boolean{ABNTfigtabnumbers}}
{
% saving old \newcounter
\let\ABNToldnewcounter\newcounter\relax
\def\ABNTeatbrackets[#1]{\relax}
\renewcommand{\newcounter}[1]%
{\ifthenelse{\equal{#1}{figure}\or\equal{#1}{table}}%
{\ABNToldnewcounter{#1}\@ifnextchar[{\ABNTeatbrackets}{}}%
{\ABNToldnewcounter{#1}}%
}
}
{}
%%%%%%%%%%%% LOADIND REPORT CLASS %%%%%%%%%%%%
% Load base class using current setting for basic options.
\LoadClass{report}
\ifthenelse{\boolean{ABNTfigtabnumbers}}
{
%% undoing redefinition of \newcounter and fixing \the(counters)
\let\newcounter\ABNToldnewcounter\relax
\renewcommand{\thefigure}{\arabic{figure}}
\renewcommand{\thetable}{\arabic{table}}
}
{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% IMPLEMENTATION %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Stretch factor for default line spacing schemes
\newcommand*{\taxaespacosimples}{1.}
\newcommand*{\taxaespacoumemeio}{1.35}
\newcommand*{\taxaespacoduplo}{1.7}
%%%%%%%% Load interesting packages : OBSOLET!!! %%%%%%%%%%%%%%%%
\ifthenelse{\boolean{ABNTcommonpack}}%
{%
\typeout{ABNT: Opcao 'pacotescomuns' ativa!}
% fontenc[T1] --> removed for possible pdf compatibility
% inputenc[latin1]: more common input encoding
\typeout{ABNT -> incluindo inputenc[latin1]}%
\RequirePackage[latin1]{inputenc}%
% amsmath: AMS math environments for LaTeX
\typeout{ABNT -> incluindo amsmath}%
\RequirePackage{amsmath}%
% amssymb: AMS symbols
\typeout{ABNT -> incluindo amssymb}%
\RequirePackage{amssymb}%
% amsbsy: bold version of symbols in amssymb
\typeout{ABNT -> incluindo amsbsy}%
\RequirePackage{amsbsy}%
% dsfont: double stroke fonts (as IR, IN, etc)
\IfFileExists{dsfont.sty}{%
\typeout{ABNT -> incluindo dsfont}%
\RequirePackage{dsfont}}{}%
% eucal[mathscr]: new calligraphic letters
\typeout{ABNT -> incluindo eucal[mathscr]}%
\RequirePackage[mathscr]{eucal}%
% makeidx -> removed. Useless if the user don't care about.
}%
{}%
%%%%%% Package for proper line spacing commands and environments
\IfFileExists{setspace.sty}%
{\RequirePackage{setspace}}% then
% else
{%
% first a warning at the end of the document and than
% fake the \setstretch command, not provided by setspace.
\AtEndDocument{\ClassWarningNoLine{abnt}%
% warning text
% Package 'setspace' needed and was not found.
% Please install it or check for errors in loading it.
% It can be found at CTAN (www.ctan.org), for example.
% For more information, refer to the class manual.
{-----------------------------------------------\MessageBreak%
O pacote 'setspace' eh necessario e nao foi\MessageBreak%
encontrado. Favor instala-lo propriamente ou\MessageBreak%
checar por erros em sua leitura. Ele pode ser\MessageBreak%
encontrado na CTAN (www.ctan.org), por exemplo.\MessageBreak%
Para mais informacoes, leia o manual da classe.\MessageBreak%
-----------------------------------------------}%
}%
\ifthenelse{\isundefined{\@currsize}}
{\providecommand{\setstretch}[1]{\def\baselinestretch{#1}\normalsize}}
{\providecommand{\setstretch}[1]{\def\baselinestretch{#1}\@currsize}}
}
% This command is defined by 'setspace' package, to ajust extra spacing
% before and after display math. It depends on if your setspace.sty is of
% 21 march 1998 or ouder.
\providecommand{\setdisplayskipstretch}[1]{\relax}
% equivalent to the option 'nodisplayskipstretch' of setspace.
\setdisplayskipstretch{1.0}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Setting margins
%% (old Margin care mechanism removed since version 1 beta.)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifthenelse{\boolean{ABNTheader}}%
{%
%%%% VERTICAL LENGHTS %%%%
% The distance beetwen the top of the header and the top of the text is
% of 1cm, this is, 1cm=\headheight+\headsep
% ...but, we have to consider the depth of the header, addin 2mm.
\setlength{\headsep}{1.2cm-\headheight}
% The distance beetwen the paper border and the number must be 2cm
% 2cm=\topmargin+\voffset+1in
\setlength{\topmargin}{2cm-1in-\voffset}
% The inferior border must be 2cm
% \paperheight=\topmargin+\voffset+1in+\headheight+\headsep+\textheight+2cm
\setlength{\textheight}%
{\paperheight-\topmargin-\voffset-1in-\headheight-\headsep-2cm}
}%
{% no header is not ABNT!!!
% Let's fake it: 2cm each vertical margin and de same horizontal margin.
\setlength{\topmargin}{2cm-\headheight-\headsep-\voffset-1in}
\setlength{\textheight}%
{\paperheight-2cm-\footskip-2cm}
}%
%%%% HORIZONTAL LENGHTS %%%%
% The left margin is 3cm, and the right margin equals to 2cm.
\setlength{\oddsidemargin}{3cm-\hoffset-1in}
% for compatibility with twoside print, the length of the margins must
% be exchanged.
\setlength{\evensidemargin}{2cm-\hoffset-1in}
% \paperwidth=\textwidth+\oddsidemargin+\hoffset+1in+2cm
\setlength{\textwidth}{\paperwidth-\oddsidemargin-\hoffset-1in-2cm}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page styles available:
% plainheader, header, ruledheader
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% fontstyle for header elements
\newcommand{\rightmarkformat}{\small\itshape}
\newcommand{\leftmarkformat}{\itshape}
\newcommand{\thepageformat}{\small}
%
\newcommand{\ABNTmarkboth}[2]{%
\ifthenelse{\boolean{ABNTNextOutOfTOC}}
{\markboth{\ABNTnextmark}{\ABNTnextmark}}
{\markboth{#1}{#2}}%
}
\newcommand{\ABNTmarkright}[1]{%
\ifthenelse{\boolean{ABNTNextOutOfTOC}}
{\markright{\ABNTnextmark}}
{\markright{#1}}%
}
%%%%%%% Defining pagestyle "header"
%
\newcommand{\ps@header}{%
\renewcommand{\@oddfoot}{}%
\renewcommand{\@evenfoot}{}%
\renewcommand{\@oddhead}%
{{\rightmarkformat\rightmark}\hfill{\thepageformat\thepage}}%
\renewcommand{\@evenhead}%
{{\thepageformat\thepage}\hfill{\leftmarkformat\leftmark}}%
% Para \chapter* mostrar o cabecalho
\let\@mkboth\ABNTmarkboth%
% Definindo a maneira como o comando o \chapter marca o cabecalho
\renewcommand{\chaptermark}[1]{%
\markboth%
{\ifnum \c@secnumdepth >\m@ne%
\thechapter{} %
\fi%
##1}%
{\ifnum \c@secnumdepth >\m@ne%
\thechapter{} %
\fi%
##1}%
}%
\renewcommand{\sectionmark}[1]{%
\markright{%
\ifnum \c@secnumdepth >\z@%
\thesection\ \ %
\fi%
##1}%
}%
}%
%% Defining pagestyle plainheader
%
\newcommand{\ps@plainheader}{%
\renewcommand{\@oddfoot}{}%
\renewcommand{\@evenfoot}{}%
\renewcommand{\@oddhead}{\hfill{\thepageformat\thepage}}%
\renewcommand{\@evenhead}{{\thepageformat\thepage}\hfill}%
% Para \chapter* mostrar o cabecalho
\let\@mkboth\ABNTmarkboth%
% Definindo a maneira como o comando o \chapter marca o cabecalho
\renewcommand{\chaptermark}[1]{%
\markboth%
{\ifnum \c@secnumdepth >\m@ne%
\thechapter\ \ %
\fi%
##1}%
{\ifnum \c@secnumdepth >\m@ne%
\thechapter\ \ %
\fi%
##1}%
}%
\renewcommand{\sectionmark}[1]{%
\markright{%
\ifnum \c@secnumdepth >\z@%
\thesection\ \ %
\fi%
##1}%
}%
}%
%% Defining pagestyle ruledheader
%
\newcommand{\ps@ruledheader}{%
\renewcommand{\@oddfoot}{}%
\renewcommand{\@evenfoot}{}%
\renewcommand{\@oddhead}%
{\underline{\makebox[\textwidth]{\raisebox{-.5ex}{}%
{\rightmarkformat\rightmark}\hfill{\thepageformat\thepage}}}}%
\renewcommand{\@evenhead}%
{\underline{\makebox[\textwidth]{\raisebox{-.5ex}{}%
{\thepageformat\thepage}\hfill{\leftmarkformat\leftmark}}}}%
% Para \chapter* mostrar o cabecalho
\let\@mkboth\ABNTmarkboth%
% Definindo a maneira como o comando o \chapter marca o cabecalho
\renewcommand{\chaptermark}[1]{%
\markboth%
{\ifnum \c@secnumdepth >\m@ne%
\thechapter\ \ %
\fi%
##1}%
{\ifnum \c@secnumdepth >\m@ne%
\thechapter\ \ %
\fi%
##1}%
}%
\renewcommand{\sectionmark}[1]{%
\markright{%
\ifnum \c@secnumdepth >\z@%
\thesection\ \ %
\fi%
##1}%
}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Page numbering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newboolean{ABNTinpretext}
\setboolean{ABNTinpretext}{true}
\newboolean{ABNTaftertoc}
\setboolean{ABNTaftertoc}{false}
% The command \ABNTBeginOfTextualPart is executed by \tableofcontents at
% its end. It's intented to page style and page number settings.
\providecommand{\ABNTBeginOfTextualPart}{}
\newcommand{\chaptertitlepagestyle}{plain}
%\newcommand{\chaptertitlepagestyle}{header}
\ifthenelse{\equal{\ABNTpnum}{plain}}
{%
\setboolean{ABNTinpretext}{false}
\setboolean{ABNTaftertoc}{true}
\ifthenelse{\boolean{ABNTheader}}
{%
\ifthenelse{\equal{\ABNTheadertype}{plain}}%
{\pagestyle{plainheader}}
{%
\ifthenelse{\equal{\ABNTheadertype}{normal}}%
{\pagestyle{header}}%
{\pagestyle{ruledheader}}%
}%
\renewcommand{\chaptertitlepagestyle}{plainheader}%
}%
{%
\pagestyle{plain}%
\renewcommand{\chaptertitlepagestyle}{plain}
}%
}%
{%
\ifthenelse{\equal{\ABNTpnum}{ABNT}}%
{% ABNT strict
% - pagestyle is empty until \tableofcontents, when it becames with
% numeration (depending on `header' or `plain' header style)
% - page counter starts AT `folha de rosto'.
%
% Makeing titlepage environment increase page counter
\let\ABNToldendtitlepage\endtitlepage\relax
\renewcommand{\endtitlepage}{\ABNToldendtitlepage\addtocounter{page}{1}}
\pagestyle{empty}
\renewcommand{\thepage}{}
\renewcommand{\chaptertitlepagestyle}{empty}
\renewcommand{\ABNTBeginOfTextualPart}%
{%
\renewcommand{\thepage}{\arabic{page}}
\ifthenelse{\boolean{ABNTheader}}
{%
\ifthenelse{\equal{\ABNTheadertype}{plain}}%
{\pagestyle{plainheader}}
{%
\ifthenelse{\equal{\ABNTheadertype}{normal}}%
{\pagestyle{header}}%
{\pagestyle{ruledheader}}%
}%
\renewcommand{\chaptertitlepagestyle}{plainheader}%
}%
{%
\pagestyle{plain}%
\renewcommand{\chaptertitlepagestyle}{plain}
}%
}%
}%
{% RomArab
% - page style with numeration
% - BEFORE \tableofcontents
% \thepage in roman
% page counter starts AFTER `folha de rosto'
% - AFTER \tableofcontents
% \thepage in arabic
% page counter starts again
%
\ifthenelse{\boolean{ABNTheader}}
{%
\ifthenelse{\equal{\ABNTheadertype}{plain}}%
{\pagestyle{plainheader}}
{%
\ifthenelse{\equal{\ABNTheadertype}{normal}}%
{\pagestyle{header}}%
{\pagestyle{ruledheader}}%
}%
\renewcommand{\chaptertitlepagestyle}{plainheader}%
}%
{%
\pagestyle{plain}%
\renewcommand{\chaptertitlepagestyle}{plain}
}%
%\renewcommand{\thepage}{\roman{page}}
\renewcommand{\thepage}{ \pagestyle{plain}}
\renewcommand{\ABNTBeginOfTextualPart}%
{%
\renewcommand{\thepage}{\arabic{page}}
%\setcounter{page}{1}
}%
}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Line spacing stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Since version 0.3 the `setspace' package is used.
% Space scheme in notes (footnotes and margin notes) removed since
% version 0.3 since setspace do not support it; footnotes are always
% single spaced!
% \espaco{} - ativa o espacamento para um numero dado (taxa de
% esticamento), mas aceita os parametros simples, umemeio, e duplo.
\newcommand{\espaco}[1]%
{\ifthenelse{\equal{#1}{simples}}% se espacamentos simples
{\setstretch{\taxaespacosimples}} % entao
{ %senao (espaco simples)
\ifthenelse{\equal{#1}{umemeio}}% se espaco 1 1/2
{\setstretch{\taxaespacoumemeio}} % entao
{%senao (espaco 1 1/2)
\ifthenelse{\equal{#1}{duplo}}% se espaco duplo
{\setstretch{\taxaespacoduplo}}% entao
{\setstretch{#1}} % senao espaco dado
} %fim se espaco 1 1/2
} %fim se espaco simples
}%fim newcommand
\newenvironment{espacosimples}
{\begin{spacing}{\taxaespacosimples}}{\end{spacing}}
\newenvironment{espacoumemeio}
{\begin{spacing}{\taxaespacoumemeio}}{\end{spacing}}
\newenvironment{espacoduplo}%
{\begin{spacing}{\taxaespacoduplo}}{\end{spacing}}
\newboolean{ABNThypertoc}
\AtBeginDocument{%
% default spacing (set by class options)
\espaco{\ABNTespacodefault}%
\@ifpackageloaded{hyperref}{\setboolean{ABNThypertoc}{true}}{\setboolean{ABNThypertoc}{false}}%
}
% Font track mechanism (like in utthesis.cls)
% - removed from implementation since version 0.3.
% - use instead package `relsize'.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Chapter title page style
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Redefining \chapter and \part. The changes are
% - \chapteritlepagestyle instead of explict plain page style
% - \ABNTchaptermark instead of \chaptermark (must be before
% \addcontentsline !!!)
% - several commands were replaced by abntversions due to nuances of the
% norms :-( it can create several uncompatibilities with packages that
% change explictily these important commands, although I have tried very
% hard to make as less damage on compatibility as possible. As a result
% of this, package hyperref is totally broken with abnt.cls.
%%%%%%%%%%%%%%%%%%%%%% Special definitions %%%%%%%%%%%%%%%%%%%%
% What is going on here?
%
% This class supports auto include in toc for both \chapter* and
% \section* (and similars). As we know, the command \chapter admits an
% optional argument, which goes to the toc and the marks, if it's present
% (otherwise the main parameter of \chapter is used in toc and marks also.)
%
% To allow exactly the same mechanism for \chapter and \chapter*, \section
% and \section*, \subsection and \subsection*, etc, I had to define
% similar commands to some important core commands in LaTeX, like \secdef
% (we make a new one to avoid conflicts with other packages) and
% \@startsection (I make a new one too).
%
% Now, \ABNTstartsection, appart from make the stared version of a
% section-like command to include the title in toc (if a boolean is set to
% true), the title is centered for stared form.
%
% Now, \chapter* and \part* are almost equal to \chapter and \part
%
% The origin of this material are the files
% $texmfDIR/tex/latex/base/latex.ltx (codigo fonte do LaTeX)
% $texmfDIR/tex/latex/base/report.cls (classe standard)
% From the definition of \secdef -> stared version now admits optional
% param (after bug with hyperref, it was no longer used.)
\def\ABNTsecdef#1#2{\@ifstar{\@dblarg{#2}}{\@dblarg{#1}}}
% Changed explicit \thispagestyle{empty}
\newcommand{\chaptertype}{}%
\renewcommand\chapter%
{%
\if@openright\cleardoublepage\else\clearpage\fi%
\thispagestyle{\chaptertitlepagestyle}
\ifthenelse{\boolean{ABNTinpretext}}%
{%
\ifthenelse{\boolean{ABNTaftertoc}}%
{% change to textual part
\setboolean{ABNTinpretext}{false}%
\ABNTBeginOfTextualPart%
}%
{}%
}%
{}%
\global\@topnum\z@%
\@afterindentfalse%
% \ABNTsecdef\@chapter\@schapter%
\secdef\@chapter\@schapter%
}%
% To make pre-textual chapters (that fits page numbering squeme...)
% this is equal to \chapter*{}, but ignores in witch part is it. It does
% not change any tags.
\newcommand\pretextualchapter%
{%
\if@openright\cleardoublepage\else\clearpage\fi%
\thispagestyle{\chaptertitlepagestyle}
\global\@topnum\z@%
\@afterindentfalse%
\@schapter%
}%
% Created useful \resetsubcounters from the code of \stepcounter.
\newcommand{\resetsubcounters}[1]{%
\begingroup
\let\@elt\@stpelt
\csname cl@#1\endcsname
\endgroup}
%% \ProximoForaDoSumario -> taking out some chapter or section from toc.
\newboolean{ABNTNextOutOfTOC}
\setboolean{ABNTNextOutOfTOC}{false}
%% \ProximoForaDoSumario[mark text]
% Now \ProximoForaDoSumario (re)sets the marks too. If one still want the
% marks, he/she must use it as the optional parameter of this command.
\newcommand{\ABNTnextmark}{}
\newcommand{\ProximoForaDoSumario}[1][]
{
\setboolean{ABNTNextOutOfTOC}{true}
\renewcommand{\ABNTnextmark}{#1}
}