eletrotupi / tcc/ commit / 94993c0

thesis: listing code sections

Pedro Lucas Porcellis porcellis@eletrotupi.com 14 days ago 94993c09d79a0152a0ffe98c99685cfc8d915594
Parents: e953693
1 file(s) changed
  • monografia/textsi.cls +114 -27
monografia/textsi.cls
1 1
%==============================================================================
2 2
% Identificação
3 3
%==============================================================================
4 4
\def\currversion{3/5/2014}
5 5

▸ 85 unchanged lines
91 91
\RequirePackage{lastpage}
92 92
\RequirePackage{indentfirst}
93 93
\RequirePackage{natbib}
94 94
\RequirePackage{chngcntr}
95 95
\RequirePackage{eso-pic}
96 -
\RequirePackage{color}
96 +
\RequirePackage{xcolor}
97 97
\RequirePackage{setspace}
98 98
\RequirePackage{geometry}
99 +
\RequirePackage{listings}
99 100

100 101
\geometry{top=3cm,right=2cm,left=3cm,bottom=2cm}
101 102

102 103
\definecolor{laranjaufpel}{rgb}{1,0.6,0}
103 104
\definecolor{verdeufpel}{rgb}{0.09,0.7,0.44}
104 105
\definecolor{azulufpel}{rgb}{0.07,0.49,0.72}
105 106
\definecolor{cinzaufpel}{rgb}{0.85,0.85,0.85}
106 107

108 +
%==============================================================================
109 +
% Configuração de listagens de código (pacote listings)
110 +
%==============================================================================
111 +
\lstdefinelanguage{yaml}{
112 +
  keywords={image,build,context,file,ports,environment,volumes,depends_on,
113 +
            condition,healthcheck,test,interval,timeout,retries,start_period,
114 +
            restart,command,shm_size,user,push,tags,labels,services,options},
115 +
  sensitive=false,
116 +
  comment=[l]{\#},
117 +
  morestring=[b]",
118 +
  morestring=[b]',
119 +
}
120 +

121 +
\lstset{
122 +
  language=yaml,
123 +
  basicstyle=\ttfamily\small,
124 +
  keywordstyle=\color{azulufpel}\bfseries,
125 +
  commentstyle=\color{verdeufpel}\itshape,
126 +
  stringstyle=\color{laranjaufpel},
127 +
  backgroundcolor=\color{cinzaufpel!35},
128 +
  rulecolor=\color{azulufpel},
129 +
  frame=single,
130 +
  framerule=0.6pt,
131 +
  numbers=left,
132 +
  numberstyle=\tiny\color{black!60},
133 +
  numbersep=8pt,
134 +
  showstringspaces=false,
135 +
  breaklines=true,
136 +
  columns=fullflexible,
137 +
  captionpos=b,
138 +
  tabsize=2,
139 +
}
140 +

141 +
\renewcommand*{\l@lstlisting}{\@dottedtocline{1}{0em}{5.5em}}
142 +

107 143
%
108 144
% definições para textos em português
109 145
%
110 146
\@namedef{captionsbrazilian}{%
111 147
  \def\bibname{Refer{\^e}ncias}%
▸ 9 unchanged lines
121 157
  \def\collaboratorname{Colaborador}%
122 158
  \def\listabbrvname{Lista de Abreviaturas e Siglas}%
123 159
  \def\listsymbolname{Lista de S{\'\i}mbolos}%
124 160
  \def\annexname{Anexo}%
125 161
  \def\keywordsname{Palavras-chave}%
162 +
  \def\lstlistingname{C{\'o}digo}%
163 +
  \def\lstlistlistingname{Lista de C{\'o}digos}%
126 164
}
127 165

128 166
\@namedef{datebrazilian}{%
129 167
  \def\monthname{%
130 168
    \ifcase\month\or%
▸ 22 unchanged lines
153 191
  \def\collaboratorname{Collaborator}%
154 192
  \def\listabbrvname{List of Abbreviations and Acronyms}%
155 193
  \def\listsymbolname{List of Symbols}%
156 194
  \def\annexname{Annex}%
157 195
  \def\keywordsname{Keywords}%
196 +
  \def\lstlistingname{Listing}%
197 +
  \def\lstlistlistingname{List of Listings}%
158 198
}
159 199

160 200
\@namedef{dateenglish}{%
161 201
  \def\monthname{%
162 202
    \ifcase\month\or%
▸ 35 unchanged lines
198 238
\def\ps@texufpel{%
199 239
  \let\@oddfoot\@empty%
200 240
  \let\@evenfoot\@empty%
201 241
  \def\@oddhead{\hspace*{\fill}{\small\thepage}}%
202 242
  \def\@evenhead{\hspace*{\fill}{\small\thepage}}%
203 -
} 
243 +
}
204 244

205 245
\pagestyle{empty}%
206 246
\let\ps@plain\ps@empty
207 247

208 248
%==============================================================================
▸ 117 unchanged lines
326 366
  \parbox[b]{0.1\textwidth}{%
327 367
    \hspace{-2cm}%
328 368
    \includegraphics[width=3cm]{if}%
329 369
  }%
330 370
  \noindent%
331 -
    \parbox[b]{0.8\textwidth}{%    
371 +
    \parbox[b]{0.8\textwidth}{%
332 372
      \centering%
333 373
      \vskip 1cm%
334 374
      \MakeUppercase{\textbf{\@ministerio}}\\%
335 375
      \MakeUppercase{\textbf{\@secretaria}}\\%
336 376
      \MakeUppercase{\textbf{\@instituto}}\\%
▸ 5 unchanged lines
342 382
      %\@documento\\%
343 383
      %\vskip 1cm%
344 384
    }%
345 385
  \parbox[b][][t]{0.1\textwidth}{%
346 386
    \includegraphics[scale=0.175]{tsi.png}%
347 -
  }%      
387 +
  }%
348 388
  \noindent%
349 389
  \vskip 1cm%
350 390
  \noindent%
351 391
    \parbox[b]{\textwidth}{%
352 392
      \centering%
353 393
      \vskip .5cm%
354 394
      \textbf{{\@authora}\\
355 395
      \@ifundefined{@authorb}{}{\@authorb\\}%
356 396
      \@ifundefined{@authorc}{}{\@authorc\\}%
357 -
      \@ifundefined{@authord}{}{\@authord\\}}%      
397 +
      \@ifundefined{@authord}{}{\@authord\\}}%
358 398
      \vskip .5cm%
359 399
    }%
360 400
  \vskip 3cm%
361 401
  \noindent%
362 402
    \parbox[b]{\textwidth}{%
▸ 5 unchanged lines
368 408
  \vskip 3cm%
369 409
  \noindent%
370 410
    \parbox[b]{\textwidth}{%
371 411
      \centering%
372 412
      \vskip .5cm%
373 -
      \textbf{\@documento}   
413 +
      \textbf{\@documento}
374 414
      \vskip .5cm%
375 -
    }%    
415 +
    }%
376 416
  \vfill%
377 417
  \noindent%
378 418
    \parbox[b]{\textwidth}{%
379 419
      \centering%
380 420
      \vskip .1cm%
▸ 49 unchanged lines
430 470
              \@ifundefined{@collaboratorc}{}{\ &}
431 471
              \@ifundefined{@collaboratorc}{}{\@collaboratorc\\}
432 472
              \@ifundefined{@collaboratord}{}{\ &}
433 473
              \@ifundefined{@collaboratord}{}{\@collaboratord\\}}
434 474
          \end{tabular}
435 -
        }                
475 +
        }
436 476
      }
437 477
    }%
438 478
    \vfill%
439 479
  %}%
440 480
  \vfill%
▸ 44 unchanged lines
485 525
            \@ifundefined{@collaboratorc}{}{\ &}
486 526
            \@ifundefined{@collaboratorc}{}{\@collaboratorc\\}
487 527
            \@ifundefined{@collaboratord}{}{\ &}
488 528
            \@ifundefined{@collaboratord}{}{\@collaboratord\\}}
489 529
        \end{tabular}
490 -
      }        
530 +
      }
491 531
    }
492 532
  }
493 533
  \vskip 1cm%
494 534
  \hspace{-0.75cm}
495 535
  \parbox[b]{\textwidth}{%
▸ 9 unchanged lines
505 545
    \@ifundefined{orientadora}{Prof.\textordmasculine}{Prof.\textordfeminine}~\advisorname%
506 546
    \@ifundefined{@membroi}{}{
507 547
      \vskip 0.5cm%
508 548
      ~\uline{\hspace{0.75\textwidth}}~\\%
509 549
      \@membroi~-~\@instituicaomembroi\\%
510 -
      Membro titular\\%    
550 +
      Membro titular\\%
511 551
    }
512 552
    \@ifundefined{@membroii}{}{
513 553
      \vskip 0.5cm%
514 554
      ~\uline{\hspace{0.75\textwidth}}~\\%
515 555
      \@membroii~-~\@instituicaomembroii\\%
516 -
      Membro titular\\%    
556 +
      Membro titular\\%
517 557
    }
518 558
    \@ifundefined{@membroiii}{}{
519 559
      \vskip 0.5cm%
520 560
      ~\uline{\hspace{0.75\textwidth}}~\\%
521 561
      \@membroiii~-~\@instituicaomembroiii\\%
522 -
      Membro titular\\%    
523 -
    }    
562 +
      Membro titular\\%
563 +
    }
524 564
  }
525 565
}
526 566

527 567
%==============================================================================
528 -
% Ajuste do sumário (nada indentado) 
568 +
% Ajuste do sumário (nada indentado)
529 569
%==============================================================================
530 570

531 571
% Nível do sumário
532 572
\setcounter{tocdepth}{4}
533 573

▸ 50 unchanged lines
584 624
        \@dottedtocline{0}{0em}{5.75em}{\MakeUppercase{#1}}{#2}
585 625
        \penalty\@highpenalty
586 626
        \endgroup
587 627
}
588 628

589 -
\newcommand\annexmark[1]{} % define header/footer                            
629 +
\newcommand\annexmark[1]{} % define header/footer
590 630
\newcommand\annex{
591 631
  \clearpage%
592 -
  \vspace*{90pt}%
632 +
  \vspace*{50pt}%
593 633
  \@startsection{annex}{0}{0pt}{0pt}{42pt}{\centering\reset@font\ei@chapterfont\sffamily\bfseries\MakeUppercase}%
594 634
}
595 635

596 636
% Seção apêndice
597 637
\newcounter{append}% add counter
▸ 12 unchanged lines
610 650
        \@dottedtocline{0}{0em}{7.25em}{\MakeUppercase{#1}}{#2}
611 651
        \penalty\@highpenalty
612 652
        \endgroup
613 653
}
614 654

615 -
\newcommand\appendmark[1]{} % define header/footer                            
655 +
\newcommand\appendmark[1]{} % define header/footer
616 656
\newcommand\append{
617 657
  \clearpage%
618 -
  \vspace*{90pt}%
658 +
  \vspace*{50pt}%
619 659
  \@startsection{append}{0}{0pt}{0pt}{42pt}{\centering\reset@font\ei@chapterfont\sffamily\bfseries\MakeUppercase}%
620 660
}
621 661

622 662
%==============================================================================
623 663
% Definição das listas de abreviaturas e siglas e de símbolos
▸ 10 unchanged lines
634 674
      \setlength{\itemsep}{.1\baselineskip}%
635 675
      \renewcommand{\makelabel}[1]{\makebox[\labelwidth][l]{##1}}%
636 676
    }
637 677
  }{
638 678
  \end{list}
639 -
} 
679 +
}
640 680

641 681
\newenvironment{listofsymbols}[1]{
642 682
  \chapter*{\listsymbolname}
643 683
  \begin{list}{\textbf{??}}{%
644 684
      \settowidth{\labelwidth}{#1}%
▸ 55 unchanged lines
700 740
  \pagestyle{texufpel}\let\ps@plain\ps@texufpel%
701 741
  \@makechapterhead{#2}\@afterheading%
702 742
}
703 743

704 744
\def\@makechapterhead#1{%
705 -
  \vspace*{90pt}%
745 +
  \vspace*{50pt}%
706 746
  \reset@font\noindent{\ei@chapterfont\sffamily\textbf{\@chapapp\thechapter\hspace{1em}\MakeUppercase{#1}}\par}%
707 747
  \addvspace{42pt}%
708 748
  \thispagestyle{empty}%
709 749
}
710 750

▸ 3 unchanged lines
714 754
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
715 755
  \@makeschapterhead{#1}\@afterheading%
716 756
}
717 757

718 758
\def\@makeschapterhead#1{%
719 -
  \vspace*{90pt}%
759 +
  \vspace*{50pt}%
720 760
  \reset@font\centerline{\ei@chapterfont\sffamily\textbf{\MakeUppercase{#1}}}%
721 761
  \addvspace{42pt}%
722 762
}
723 763

724 764
%==============================================================================
725 765
% Formatação das seções
726 766
%==============================================================================
727 -
\setcounter{secnumdepth}{4} 
767 +
\setcounter{secnumdepth}{4}
728 768

729 769
\renewcommand{\section}{%
730 770
  \@startsection{section}{1}{0pt}{18pt}{9pt}{\reset@font\large\MakeUppercase}
731 -
} 
771 +
}
732 772

733 773
\renewcommand{\subsection}{%
734 774
  \@startsection{subsection}{2}{0pt}{12pt}{6pt}{\reset@font\bfseries}
735 -
} 
775 +
}
736 776

737 777
\renewcommand{\subsubsection}{%
738 778
  \@startsection{subsubsection}{3}{0pt}{12pt}{6pt}{\reset@font\itshape}
739 -
} 
779 +
}
740 780

741 781
\renewcommand{\paragraph}{%
742 -
  \@startsection{paragraph}{4}{0pt}{12pt}{6pt}{\reset@font\uline} 
782 +
  \@startsection{paragraph}{4}{0pt}{12pt}{6pt}{\reset@font\uline}
743 783
}
744 784

745 785
\renewcommand{\subparagraph}{%
746 786
  \@startsection{subparagraph}{5}{0pt}{1ex}{-1em}{\reset@font\bfseries}
747 787
}
▸ 5 unchanged lines
753 793
\renewcommand{\thetable}{\@arabic\c@table}
754 794

755 795
\counterwithout{figure}{chapter}
756 796
\counterwithout{equation}{chapter}
757 797
\counterwithout{table}{chapter}
798 +
% O pacote listings  cria o contador "lstlisting" dentro de um
799 +
% \AtBeginDocument próprio (ele decide o formato de numeração nesse
800 +
% momento verificando se a classe tem capítulos). Por isso o
801 +
% \counterwithout também precisa ser adiado da mesma forma, e registrado
802 +
% depois de \RequirePackage{listings} para entrar na fila após o hook
803 +
% do próprio pacote.
804 +
\AtBeginDocument{\counterwithout{lstlisting}{chapter}}
758 805

759 806
%==============================================================================
760 807
% Redefinição do conteúdo das listas de figuras e tabelas
761 808
%==============================================================================
762 809
\newif\if@captionlisting\@captionlistingtrue
▸ 13 unchanged lines
776 823
  \endgroup%
777 824
}
778 825

779 826
\renewcommand*{\l@figure}{\@dottedtocline{1}{0em}{5.5em}}
780 827
\let\l@table\l@figure
828 +
\let\l@lstlisting\l@figure
829 +

830 +
%==============================================================================
831 +
% Compatibilização do "longtable" com a Lista de Tabelas
832 +
%------------------------------------------------------------------------------
833 +
% O pacote longtable define seu próprio mecanismo de legenda (\LT@c@ption),
834 +
% que grava a entrada na Lista de Tabelas usando \thetable ( o número),
835 +
% em vez de \fnum@table ("Tabela"~+~número), diferentemente do \@caption
836 +
% padrão usado pelo ambiente "table" (redefinido acima). É por isso que uma
837 +
% "tabela normal" mostra o prefixo "Tabela" na lista, mas uma "longtable"
838 +
% mostra  o número, criando alinhamento/espaçamento diferente entre as
839 +
% entradas. O trecho abaixo corrige isso, trocando \thetable por
840 +
% \fnum@table para igualar ao comportamento das tabelas normais.
841 +
%==============================================================================
842 +
\RequirePackage{longtable}
843 +
\def\LT@c@ption#1[#2]#3{%
844 +
  \LT@makecaption#1\fnum@table{#3}%
845 +
  \def\@tempa{#2}%
846 +
  \ifx\@tempa\@empty\else
847 +
     {\let\\\space
848 +
     \addcontentsline{\ext@table}{table}{\protect\numberline{\fnum@table}{\ignorespaces #2}}}%
849 +
  \fi}
850 +

851 +
%==============================================================================
852 +
% Compatibilização do "listings" com a Lista de Códigos
853 +
%------------------------------------------------------------------------------
854 +
% Pelo mesmo motivo acima: o pacote listings grava sua própria entrada na
855 +
% Lista de Códigos usando apenas \thelstlisting (o número puro), sem passar
856 +
% pelo \@caption customizado da classe, então o prefixo "Código" definido em
857 +
% \lstlistingname nunca aparece nessa lista ( no corpo do texto). Aqui
858 +
% forçamos o prefixo também na lista, análogo ao que  ocorre com Figura/
859 +
% Tabela.
860 +
%==============================================================================
861 +
\let\oldlstlistoflistings\lstlistoflistings
862 +
\renewcommand{\lstlistoflistings}{%
863 +
  \begingroup
864 +
    \let\oldnumberline\numberline
865 +
    \renewcommand{\numberline}[1]{\lstlistingname\space\oldnumberline{##1}}%
866 +
    \oldlstlistoflistings
867 +
  \endgroup
868 +
}
781 869

782 870
%==============================================================================
783 871
% Redefinição do formato de citações longas
784 872
%==============================================================================
785 873
\renewenvironment{quote}{%
▸ 47 unchanged lines
833 921
  \clearpage%
834 922
  \mbox{}\vfill\begin{flushright}%
835 923
  }{%
836 924
  \end{flushright}%
837 925
}
838 -