<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%%==============================================================================
%% Copyright 2025-present by Alceu Frigeri
%%
%% This work may be distributed and/or modified under the conditions of
%%
%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
%%   version 1.3c (or later), and/or
%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
%%   version 3 (or later)
%%
%% This work has the LPPL maintenance status *maintained*.
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
%% This is version {1.0a} {2025/04/29}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/afperpack
%%
%%%==============================================================================
\NeedsTeXFormat{LaTeX2e}[2022/06/01]

\ProvidesExplPackage
    {afperpack}
    {2025/04/29}
    {1.0a}
    {afperpack personal package/preferences.}

%%%%%%%
%%%
%%% Just an attempt of having my packages info in a regular way
%%% Idea being: { &lt;pck-name&gt; / pkg info } for each and all.
%%%
%%%%%%%
\keys_define:nn { afperpack / pkg info}
  {
     name        .code:n = {afperpack} ,
     prefix      .code:n = {afperpack} ,
     date        .code:n = {2025/04/29},
     version     .code:n = {1.0a} ,
     description .code:n = {afperpack personal package/preferences.}
  }
\cs_if_exist:NF \PkgInfo 
  {
    \NewDocumentCommand \PkgInfo {mm} { \keys_set:nn {#1 / pkg info}{#2} } 
    \NewDocumentCommand \PkgDescription {m} 
      { \noindent Package~ \textbf{\PkgInfo{#1}{name}}~Version:~\PkgInfo{#1}{version}~ -~ \PkgInfo{#1}{date}\par \emph{\PkgInfo{#1}{description}}~\par } 
  }  
%%%%%%%
%%% End of cut-n-paste
%%%%%%%

\RequirePackage{etoolbox}
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}


\keys_define:nn {afperpack }
  {
    showframe .usage:n = load ,
    showframe .bool_set:N = \l__afperpack_showframe_bool ,

    showlabels .usage:n = load ,
    showlabels .bool_set:N = \l__afperpack_showlabels_bool ,

    english .usage:n = load ,
    english .bool_set:N = \l__afperpack_english_bool ,

    beamer .usage:n = load ,
    beamer  .bool_set:N = \l__afperpack_beamer_bool ,
    
    xpacks .usage:n = load ,
    xpacks  .bool_set:N = \l__afperpack_xpacks_bool ,
    
    times .usage:n = load ,
    times  .bool_set:N = \l__afperpack_times_bool ,
    
    noquests .usage:n = load ,
    noquests .bool_set:N = \l__afperpack_noquests_bool ,
    
    tikz .usage:n = load ,
    tikz  .bool_set:N = \l__afperpack_tikz_bool ,
    
    graphicx .usage:n = load ,
    graphicx  .bool_set:N = \l__afperpack_graphicx_bool ,
    
    math .usage:n = load ,
    math  .bool_set:N = \l__afperpack_math_bool ,
    
    listings .usage:n = load ,
    listings  .bool_set:N = \l__afperpack_listings_bool ,
  }
\ProcessKeyOptions [ afperpack ]

%
% to be used "outside" expl3
%
\newif\ifafperpack@@tikz
\afperpack@@tikzfalse
\bool_if:nT {\l__afperpack_tikz_bool}
  { \afperpack@@tikztrue }
  
\RequirePackage{xcolor}

\bool_if:nTF {\l__afperpack_beamer_bool}
  {}
  { 
    %beamer doesn't work with these
    \@ifpackageloaded{geometry}{}{\RequirePackage[a4paper,margin=15mm,right=15mm,marginparwidth=0cm,asymmetric,top=2.5cm,bottom=1.5cm]{geometry}}
     
    \RequirePackage[calcwidth]{titlesec}
    \bool_if:nT {\l__afperpack_listings_bool}
      {
        \RequirePackage{listings}
        \definecolor{lstgray}{rgb}{0.965,0.965,0.965}%
        \lstset{
          basicstyle=\ttfamily\small,
          columns=fullflexible,
          keepspaces=true,
          frame=tb,
          inputencoding=latin1,
          %  inputencoding=utf8,
          extendedchars=true,
          backgroundcolor=\color{lstgray},
        	breaklines=true,
          %	xleftmargin=7pt,
          %	xrightmargin=7pt
        }%
        %%%
        %%% from https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings#Encoding_issue
        \lstset{
          literate=
          {Ã¡}{{\'a}}1 {Ã©}{{\'e}}1 {Ã­}{{\'i}}1 {Ã³}{{\'o}}1 {Ãº}{{\'u}}1
          {Ã}{{\'A}}1 {Ã‰}{{\'E}}1 {Ã}{{\'I}}1 {Ã“}{{\'O}}1 {Ãš}{{\'U}}1
          {Ã&nbsp;}{{\`a}}1 {Ã¨}{{\`e}}1 {Ã¬}{{\`i}}1 {Ã²}{{\`o}}1 {Ã¹}{{\`u}}1
          {Ã€}{{\`A}}1 {Ãˆ}{{\'E}}1 {ÃŒ}{{\`I}}1 {Ã’}{{\`O}}1 {Ã™}{{\`U}}1
          {Ã¤}{{\"a}}1 {Ã«}{{\"e}}1 {Ã¯}{{\"i}}1 {Ã¶}{{\"o}}1 {Ã¼}{{\"u}}1
          {Ã„}{{\"A}}1 {Ã‹}{{\"E}}1 {Ã}{{\"I}}1 {Ã–}{{\"O}}1 {Ãœ}{{\"U}}1
          {Ã¢}{{\^a}}1 {Ãª}{{\^e}}1 {Ã®}{{\^i}}1 {Ã´}{{\^o}}1 {Ã»}{{\^u}}1
          {Ã‚}{{\^A}}1 {ÃŠ}{{\^E}}1 {ÃŽ}{{\^I}}1 {Ã”}{{\^O}}1 {Ã›}{{\^U}}1
        	{Ã£}{{\~{a}}}1 {Ãµ}{{\~{o}}}1
        	{Ãƒ}{{\~{A}}}1 {Ã•}{{\~{O}}}1
          {Å“}{{\oe}}1 {Å’}{{\OE}}1 {Ã¦}{{\ae}}1 {Ã†}{{\AE}}1 {ÃŸ}{{\ss}}1
          {Ã§}{{\c c}}1 {Ã‡}{{\c C}}1 {Ã¸}{{\o}}1 {Ã¥}{{\r a}}1 {Ã…}{{\r A}}1
          {â‚¬}{{\EUR}}1 {Â£}{{\pounds}}1
        }
      }
  }


\bool_if:nT {\l__afperpack_showframe_bool}
  { \RequirePackage{showframe} }

\bool_if:nT {\l__afperpack_showlabels_bool}
  { \RequirePackage{showlabels} }

\bool_if:nTF \l__afperpack_english_bool
  { \RequirePackage[english]{babel} }
  { \RequirePackage[brazilian]{babel} }


\bool_if:nT {\l__afperpack_xpacks_bool}
  {
    \RequirePackage{longtable}%
    \RequirePackage{fancyhdr}
    \RequirePackage{csquotes}
    \RequirePackage[position=above,font=small,labelfont=bf,textfont=md,textfont+=sl,width=.80\textwidth]{caption}
    \RequirePackage{subcaption}
    \RequirePackage{url}
    \RequirePackage{multirow,bigdelim}
  }
  
\bool_if:nTF {\l__afperpack_times_bool}
  { \RequirePackage{mathptmx} } %for those times...
  { \RequirePackage{lmodern} }  %default font

\RequirePackage{enumerate}

%
% Sometimes needed
%
\bool_if:nT {\l__afperpack_graphicx_bool}
  { \RequirePackage{ graphicx } }

%
% Most of the time, if not always needed
%
\bool_if:nT {\l__afperpack_math_bool}
  {
    \RequirePackage{ amsmath , amsfonts , amssymb }
    \RequirePackage{ amsthm }
    \RequirePackage{ mathrsfs }  %for \mathscr letters
    \RequirePackage{ mathtools,empheq }
    \RequirePackage{ extarrows, steinmetz, mathfixs }
    \RequirePackage{ siunitx }
    \RequirePackage{ cases }
  }
%
% pgf/tikz packages can't be loaded in an Expl3 code regim 
%
\ExplSyntaxOff

%
% My standard circuitikz setup
%
\ifafperpack@@tikz
  \RequirePackage[american,siunitx,cuteinductors,smartlabels,arrowmos,EFvoltages,betterproportions]{circuitikz}
  \usetikzlibrary{fit,math,calc}
  \usetikzlibrary{fpu}
  \usetikzlibrary{arrows,shapes}
  \usetikzlibrary{shapes.geometric} %needed for the triangle
  \usetikzlibrary{shapes.misc} %needed for the triangle
	\usetikzlibrary{shapes.multipart}  
  \usetikzlibrary{graphs,3d}
  \usetikzlibrary{datavisualization,datavisualization.formats.functions}
  \usetikzlibrary[commutative-diagrams]  %% oriented graphs.
  \usetikzlibrary{positioning}%
  \usetikzlibrary{shadows}%

  %
  % For the brave and unaware...
  %
  \NewDocumentCommand{\pgfmathparseFPU}{+m}
    {
      \begingroup
        \pgfkeys{
          /pgf/fpu,
          /pgf/fpu/output format=fixed
        }
        \pgfmathparse{#1}
        \pgfmathsmuggle\pgfmathresult
      \endgroup
    }
  
  %
  % To draw graphs... together with tikzfxgraph (below)
  %
  \RequirePackage{pgfplots}
  \pgfplotsset{compat=1.18}
  \usetikzlibrary{pgfplots.units}
\fi

\ExplSyntaxOn

\bool_if:nT {\l__afperpack_tikz_bool}
  {
    %
    % My standard circuitikz setup
    %
    \RequirePackage{tikzdotncross}
    \bool_if:nF {\l__afperpack_noquests_bool}
      {
        \@ifpackageloaded{tikzquests}{}{\RequirePackage[xtrakeys={D}]{tikzquests}}
      }
    \RequirePackage{tikzquads}
    
    %
    % To draw graphs...
    %
    \RequirePackage{tikzfxgraph}
  }


\keys_define:nn {afperpack / cab}
  {
    uni .usage:n = general ,
    uni .tl_set:N = \l__afperpack_uni_tl ,
    uni .default:n         = {Universidade ~\ Federal\ ~ do\ ~ Rio\ ~ Grande\ ~ do\ ~ Sul} ,

    dept .usage:n = general ,
    dept .tl_set:N = \l__afperpack_dept_tl ,
    dept .default:n         = {Escola\ ~ de\ ~ Engenharia\ ~ /\ ~ DELAE} ,
  
    class .usage:n = general ,
    class .tl_set:N = \l__afperpack_class_tl ,
    class .default:n         = {disciplina} ,

    classcode .usage:n = general ,
    classcode .tl_set:N = \l__afperpack_code_tl ,
    classcode .default:n         = {ENGcode} ,
    
    exam .usage:n = general ,
    exam .tl_set:N = \l__afperpack_exam_tl ,
    exam .default:n         = {VerificaÃ§Ã£o de Aproveitamento} ,
    
    sem .usage:n = general ,
    sem .tl_set:N = \l__afperpack_sem_tl ,
    sem .default:n         = {202x / y} ,
    
    semester .usage:n = general ,
    semester .tl_set:N = \l__afperpack_sem_tl ,
    semester .default:n         = {202x / y} ,

    name~ label .usage:n = general ,
    name~ label .tl_set:N = \l__afperpack_name_label_tl ,
    name~ label .default:n         = {Nome} ,

    id~ label .usage:n = general ,
    id~ label .tl_set:N = \l__afperpack_id_label_tl ,
    id~ label .default:n         = {CartÃ£o} ,

    duo~ label .usage:n = general ,
    duo~ label .tl_set:N = \l__afperpack_duo_label_tl ,
    duo~ label .default:n         = {Dupla} ,

    simplegrad .usage:n = general ,
    simplegrad .bool_set:N = \l__afperpack_simplegrad_bool ,
    
    simplegrad~ text .usage:n = general ,
    simplegrad~ text .tl_set:N = \l__afperpack_simplegrad_tl ,
    simplegrad~ text .default:n = 
      {
        Assinalar~ um~ â€œ\textbf{X}â€,~ no~ tipo~ de~ correÃ§Ã£o~ a~ ser~ realizada.
  			  \begin{description}
   	        \item[(~\ )~ Simplificada]~	SerÃ¡~ atribuÃ­da~ uma~ nota~ igual~ a~ $3$~ â€“--~ independente~ do~ que~ estiver~ escrito~ na~ prova.
   	        \item[(~\ )~ Completa]~	Todas~ as~ questÃµes~ serÃ£o~ corrigidas~ e~ a~ nota~ serÃ¡~ dada~ pela~ soma~ dos~ pontos~ obtidos~ em~ cada~ questÃ£o.~ Neste~ caso,~ a~ nota~ estarÃ¡~ no~ intervalo~ $[0;10]$.
          \end{description}
      } ,

    duo .usage:n = general ,
    duo .bool_set:N = \l__afperpack_duo_bool ,

    nonames .usage:n = general ,
    nonames .bool_set:N = \l__afperpack_nonames_bool ,
    
    default .usage:n = general ,
    default .meta:n = 
      {
        uni , dept , class , classcode , exam , sem , 
        duo~ label, id~ label , name~ label , 
        simplegrad~ text ,
        simplegrad = false , duo = false , nonames = false ,
      } ,
    default .value_forbidden:n = true ,
  }


\cs_new_protected:Npn \__afperpack_fbox:n #1
  {
    \fbox{
      \footnotesize
  	  \begin{minipage}{.6\textwidth}
        #1
      \end{minipage}
  	}\\[3ex]
  }


\cs_new_protected:Npn \__afperpack_simplecab:
  {
    \__afperpack_fbox:n
      { \l__afperpack_simplegrad_tl }
  }


\NewDocumentCommand{\cab}{mO{}}
  {
    \keys_set:nn{afperpack / cab}{default , #1}
    \bool_lazy_or:nnTF {\tl_if_blank_p:V \l__afperpack_code_tl}{\tl_if_empty_p:V \l__afperpack_class_tl}
      { \tl_set:Nn \l_tmpa_tl {} }
      { \tl_set:Nn \l_tmpa_tl {\ ~-\ ~} }
    \bool_lazy_or:nnTF {\tl_if_blank_p:V \l__afperpack_exam_tl}{\tl_if_blank_p:V \l__afperpack_sem_tl}
      { \tl_set:Nn \l_tmpb_tl {} }
      { \tl_set:Nn \l_tmpb_tl {\ ~-\ ~} }

%    \newpage
    \begin{center}
      { 
        \sc\large  \l__afperpack_uni_tl\\
        \l__afperpack_dept_tl\\        
        \l__afperpack_code_tl \l_tmpa_tl \l__afperpack_class_tl\\ 
        \l__afperpack_exam_tl \l_tmpb_tl \l__afperpack_sem_tl\\[2ex]
      }
      
    \bool_if:nT {\l__afperpack_simplegrad_bool}
      {
        \__afperpack_simplecab:
      }
    
    \bool_if:nF {\l__afperpack_nonames_bool}
      {
        \l__afperpack_name_label_tl :\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\vspace{10mm}
        \l__afperpack_id_label_tl :\ldots\ldots\ldots\ldots\ldots\ldots
      }
    
    \bool_if:nT {\l__afperpack_duo_bool}
      {
        \\[-3ex]
        \l__afperpack_duo_label_tl :\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\vspace{10mm}
        \l__afperpack_id_label_tl :\ldots\ldots\ldots\ldots\ldots\ldots
      }
    \tl_if_blank:nF {#2}
      {
        \\[-3ex]
        \__afperpack_fbox:n {#2}
      } 
    \end{center}
  }
  
</pre></body></html>