%%%==============================================================================
%% Copyright 2022-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 {2.13a} {2026/07/04}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/ufrgscca
%%
%%%==============================================================================
%% UFRGS stands for "Federal University of Rio Grande do Sul" in south Brazil
%% EE    stands for "Engineering School"
%% CCA   stands for "Control and Automation Engineering Course" (Portuguese acronym)
%%%==============================================================================
\NeedsTeXFormat{LaTeX2e}[2026/06/01]

%%%%%%%
%%%
%%% Just an attempt at having my package's info in a regular way
%%%   \pkginfograb_set:nn { <pkg-name>} { props } sets package info
%%%
%%%   \pkginfograbProvidesExplPackage { <pkg-name>} { props } sets package info
%%%     and calls \ProvidesExplPackage
%%%
%%%%%%%
\RequirePackage{pkginfograb}
\pkginfograbProvidesExplPackage {ufrgscca-ppc}
  { 
     name        = {ufrgscca-ppc} ,
     prefix      = {ufrgscca} ,
     date        = {2026/07/04},
     version     = {2.13a} ,
     description = {UFRGS/CCA auxiliary PPC-related (indicators) commands}
 }
%%%%%%%
%%% End of cut-n-paste
%%%%%%%


%%%%%%%
%%%
%%% V-less nightmare TO BE DONE!
%%%        => convert all V referenced sequences into 'starray sub structures'
%%%           less efficient, but 'portable' and V-safe.
%%%
%%%        => Alternative approach: convert a _seq into a clist then store it into starray (argh! double damm)
%%%        => or just use ..._clist instead of _seq (replacing all _seq that are stored in starrays by a _clist)
%%%
%%%%%%%


\keys_define:nn { ufrgscca / ppc }
  { 
  	showind        .usage:n     = load,
    showind        .bool_set:N  = \l__ufrgscca_showind_bool,
  	indlong        .usage:n     = load,
    indlong        .bool_set:N  = \l__ufrgscca_indlong_bool,
  	nocomments     .usage:n     = load,
    nocomments     .bool_set:N  = \l__ufrgscca_nocomments_bool,
  }
\ProcessKeyOptions[ufrgscca / ppc]\relax


\RequirePackage{ longtable }
\RequirePackage{ pdfcomment }
\WarningFilter{ latex }{ name }
\RequirePackage[tikz]{ mdframed }
\RequirePackage{ ufrgscca-abnt }
\RequirePackage{ ufrgscca-curr }
\RequirePackage{ codedescribe } %% TODO: remove this !!! "help indicators"... => rqmts package !!!

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% PPC macros
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%% pre-defined status:
%      noref (default, still not in the text)
%      tbd (to be done)
%      review (in review, probably done)
%      attention (to be looked at)
%      done (done)
%      NSA (not relevant)
%      * (undefined, copy text)
%%
%%%%%%%%%%%%%%%%%%%



\starray_new:n { indicator }
\starray_def_from_keyval:nn { indicator }
 { 
    self        = ,
    view        = \c_true_bool ,
    has_lst     = \c_false_bool , 
    seqID       = , %this will have an unique hash (for a sequence)
    ind.struct  = 
      { 
        self            = ,
        short           = ,
        long            = ,
        extra           = , %some extra long text, monstly unused
        desc            = , %expanded text for 'MEC' (inep questionaire)
        status          = ,
        is_section      = \c_false_bool ,
        is_subsection   = \c_false_bool ,
        cnt             = 0 , %auxiliar 'counter' (num of references)
        seqID           = , %this will have an unique hash (for a sequence)
        labelref        = , %this will contain the 'hyperref label' (at doc's end) to be used.        
        ref.struct      =
          { 
            reflabel    = , %this will contain the 'hyperref label' (in doc) to be used.
          } ,
      } ,
 }

\starray_new:n { status }
\starray_def_from_keyval:nn { status }
 { 
    bgcolor     = ,
    txtcolor    = ,
    self        = ,
    text        = ,
    view        = \c_false_bool ,
    refcnt      = 0 , % 'counter'
 }

\starray_new:n { acrolist }
\starray_def_from_keyval:nn { acrolist }
 { 
    acronym     = ,
    long        = ,
 }


\tl_new:N \l__ufrgscca_uniqueID_tmpa_tl
\tl_new:N \l__ufrgscca_uniqueID_tmpb_tl
\NewDocumentCommand{ \declareindicator }{ st+O{ noref }mmm }
  { 
    %#3: status #4:org #5:mark #6:short text 
      \starray_set_iter_from_hash:nnF { indicator }{ #4 }
        { 
          \starray_new_term:nn { indicator }{ #4 }
          \starray_get_unique_id:nNTF { indicator }\l__ufrgscca_uniqueID_tmpa_tl
            { }
            { \tl_set:Nn \l__ufrgscca_uniqueID_tmpa_tl { }}
          \starray_set_prop:nnV { indicator }{ seqID }\l__ufrgscca_uniqueID_tmpa_tl
          \seq_new:c { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpa_tl _seq }
          
          \starray_set_prop:nnn { indicator }{ self }{ #4 }
        }
      \starray_new_term:nn { indicator.ind }{ @#5 }
      \starray_set_from_keyval:nn { indicator.ind }
        { 
          short  = { #6 } ,
          status = { #3 } ,
          self   = { #5 } ,
          labelref = { @ufrgscca@ #4 @ #5 } , %% to be issued when "printing the indicators' list"
        }
          \starray_get_unique_id:nNTF { indicator.ind }\l__ufrgscca_uniqueID_tmpb_tl
            { }
            { \tl_set:Nn \l__ufrgscca_uniqueID_tmpb_tl { }}          
          \starray_set_prop:nnV { indicator.ind }{ seqID }\l__ufrgscca_uniqueID_tmpb_tl
          \seq_new:c { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpb_tl _seq }
      \IfBooleanTF{ #1 }
        { 
          %% V-less : 'unique' seq
          \seq_put_right:cn { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpa_tl _seq }{ @#5 }
          
          \starray_set_prop:nnn { indicator.ind }{ is_section }{ \c_true_bool }
          \starray_set_prop:nnn { indicator }{ has_lst }{ \c_true_bool }
        }
        { }
      \IfBooleanTF{ #2 }
        { 
          %% V-less : 'unique' seq
          \seq_put_right:cn { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpa_tl _seq }{ @#5 }

          \starray_set_prop:nnn { indicator.ind }{ is_subsection }{ \c_true_bool }
          \starray_set_prop:nnn { indicator }{ has_lst }{ \c_true_bool }
        }
        { }


  }
  
  
\NewDocumentCommand{ \indicatorDesc }{ +m+m }
  { 
    \starray_set_from_keyval:nn { indicator.ind }
    { 
      long  = { #1 } ,
      extra = { #2 } ,
    }
  }

\NewDocumentCommand{ \indicatorText }{ +m }
  { 
    \starray_set_prop:nnn { indicator.ind }{ text }{ #1 }
  }


\NewDocumentCommand{ \lstind }{ O{ \section }O{ \subsection }m }
  { 
    \starray_set_iter_from_hash:nnT { indicator }{ #3 }
      { 
        %% V-less : new seq
        \starray_get_prop:nnN { indicator }{ seqID }\l__ufrgscca_uniqueID_tmpa_tl
        \seq_map_inline:cn { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpa_tl _seq }
          { 
            \starray_set_iter_from_hash:nn { indicator.ind }{ ##1 }
            \starray_term_parser:n { indicator.ind }
            \bool_if:nTF { \starray_parsed_get_prop:n{ is_section }}
              { #1 { \starray_parsed_get_prop:n{ short }} }
              { #2 { \starray_parsed_get_prop:n{ short }} }
            \starray_parsed_get_prop:n{ text }  
          }
      }
  }


\NewDocumentCommand{ \indsetstatus }{ O{ attention }mm }
  { 
    \starray_set_iter_from_hash:nn { indicator }{ #2 }
    \seq_set_from_clist:Nn \l__ufrgscca_tt_tmpa_seq { #3 }
    \seq_map_inline:Nn \l__ufrgscca_tt_tmpa_seq
      { 
        \starray_set_iter_from_hash:nn { indicator.ind }{ @##1 }
        \starray_gset_prop:nnn { indicator.ind }{ status }{ #1 }
      }
  }

\NewDocumentCommand{ \indsetview }{ m } 
  { 
    \starray_set_iter_from_hash:nn { indicator }{ #1 }
    \starray_gset_prop:nnn { indicator }{ view }{ \c_true_bool }
    
  }

\NewDocumentCommand{ \indsethide }{ m }
  { 
    \starray_set_iter_from_hash:nn { indicator }{ #1 }
    \starray_gset_prop:nnn { indicator }{ view }{ \c_false_bool }
  }



\NewDocumentEnvironment{ listofindicators }{ m }
  { 
    \begin{ list }{ \textbf{ ??}}
      { 
        \settowidth{ \labelwidth }{ #1 }
        \setlength{ \labelsep }{ 1em }
        \setlength{ \itemindent }{ 0mm }
        \setlength{ \leftmargin }{ \labelwidth }
        \addtolength{ \leftmargin }{ \labelsep }
        \setlength{ \rightmargin }{ 0mm }
        \setlength{ \itemsep }{ .1\baselineskip }
        \renewcommand{ \makelabel }[1]{ \makebox[\labelwidth][l]{ ##1 }}
      }
  }
  { 
    \end{ list }
  }


\NewDocumentCommand{ \helpindicators }{ }
  { 
    \bool_if:NT \l__ufrgscca_showind_bool 
      { 
    	\begin{ itemize }[nosep,label=,leftmargin=0mm]
    	  \item \tsmacro{ \indsethide }{ set } ~-~ Hide~ an~ indicator's~ set
    		\item \tsmacro{ \comment }[status]{ title,comment }  ~-~ Just~ a~ comment
    		\item \tsmacro{ \indref }[status]{ set,ref,comment }  ~-~ Single~ indicator's~ reference
    		\item \tsmacro{ \indref*}[status]{ set,ref,comment }  ~-~  (Short~ text~ only)
    		\item \tsmacro{ \indsetstatus }[status]{ set,ref's-clist } ~-~ Set~ the~ status~ of~ a~(comma~separated)~ list~ of~ indicators.
    	\end{ itemize }
    	where~ status:\newline
        \starray_iterate_over:nn { status }
        { 
          \starray_term_parser:n { status }
          \makebox[5mm]{ } \makebox[17mm][r]{ \textbf{ \starray_parsed_get_prop:n{ self }}}\ \ \starray_parsed_get_prop:n{ text }\newline
        }   
     }
  }


\NewDocumentCommand{ \ifshowind }{ +m+m }
  { 
    \bool_if:NTF \l__ufrgscca_showind_bool 
      { #1 }
      { #2 }
  }



%\cs_new:Npn \__ufrgscca_status_refincr:n #1 
%    { 
%     \int_incr:c { #1 }
%    }
%\cs_generate_variant:Nn \__ufrgscca_status_refincr:n { e }

\cs_generate_variant:Nn \starray_get_prop:nnN { enN }
\bool_new:N \l__ufrgscca_statuslst_bool
\seq_new:N \l__ufrgscca_statuslst_seq

\cs_new_protected:Npn \__ufrgscca_hypertarget:nn #1#2
  { 
    \hypertarget{ #1 }{ #2 }
  }
\cs_generate_variant:Nn \__ufrgscca_hypertarget:nn { en }

\cs_new_protected:Npn \__ufrgscca_hyperlink:nn #1#2
  { 
    \hyperlink{ #1 }{ #2 }
  }
\cs_generate_variant:Nn \__ufrgscca_hyperlink:nn { en }

\NewDocumentCommand{ \PrintIndicators }{ O{ }}
{ 
  \bool_if:NT \l__ufrgscca_showind_bool 
  { 
    { 
      \footnotesize
      \if@openright\cleardoublepage\else\clearpage\fi%%% TO BE CONVERTED Expl3
      
      \phantomsection
      \chapter*{ Indicadores #1 }
      \begin{ listofindicators }{ EMPTY LIST . . .}
          \tl_if_empty:nTF { #1 }
            { 
              \bool_set_false:N \l__ufrgscca_statuslst_bool
              \__ufrgscca_set_statuscolor:n{ attention }
            }
            { 
              \bool_set_true:N \l__ufrgscca_statuslst_bool
              \seq_set_from_clist:Nn \l__ufrgscca_statuslst_seq { #1 }
              \seq_map_inline:Nn \l__ufrgscca_statuslst_seq 
                { 
                  \starray_set_prop:nnn { status[##1]}{ view }{ \c_true_bool }
                }
            }
        \starray_iterate_over:nn { indicator }
          { 
            \starray_term_parser:n { indicator }
            \bool_if:nT { \starray_parsed_get_prop:n { view }}
              { 
                \starray_iterate_over:nn { indicator.ind }
                  { 
                    \starray_term_parser:n{ indicator.ind }
                    \starray_get_prop:enN { status[\starray_parsed_get_prop:n{ status }]}{ view } \l__ufrgscca_tt_tmpb_tl
                    \bool_if:nT { !\l__ufrgscca_statuslst_bool || \l__ufrgscca_tt_tmpb_tl }
                      { 
                        \starray_term_parser:n{ indicator.ind }
                        \__ufrgscca_set_statuscolor:e{ \starray_parsed_get_prop:n{ status }}
                       
                        \starray_get_prop:nnN { status }{ refcnt }\l__ufrgscca_tt_tmpa_int
                        \int_set:Nn \l__ufrgscca_tt_tmpb_int { \l__ufrgscca_tt_tmpa_int + 1 }
                        \starray_set_prop:nnV { status }{ refcnt }\l__ufrgscca_tt_tmpb_int
                        
                        \starray_term_parser:n { indicator.ind }
                        \item[
                            \textbf{ 
                              \color{ \l__ufrgscca_txtcolor_tl }
                              \__ufrgscca_hypertarget:en
                                { \starray_parsed_get_prop:n{ labelref }}
                                { \starray_get_prop:nn { indicator }{ self }:~\starray_get_prop:nn { indicator.ind }{ self }}
                            }] 
                            { \color{ \l__ufrgscca_txtcolor_tl }\starray_get_prop:nn { indicator.ind }{ short } \dotfill \normalsize\starray_get_prop:nn { indicator.ind }{ status }}
                            
                        \newline \starray_get_prop:nn { indicator.ind }{ long } \starray_get_prop:nn { indicator.ind }{ extra }
        %% V-less : new seq
        \starray_get_prop:nnN { indicator.ind }{ seqID }\l__ufrgscca_uniqueID_tmpb_tl
        \seq_if_empty:cF { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpb_tl _seq }
                          { 
                            \newline
                            \tl_set:Nn \l__ufrgscca_tt_tmpa_tl { } .\dotfill
                            %% V-less : new seq
                             \seq_map_inline:cn { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpb_tl _seq }
                              { 
                                \l__ufrgscca_tt_tmpa_tl \ref{ ##1 } ~(\pageref{ ##1 })
                                \tl_set:Nn \l__ufrgscca_tt_tmpa_tl { ,~}
                              }
                          }
                      }
                  }
                  
              }
          }
          \starray_iterate_over:nn { status }
            { 
              \starray_term_parser:n { status }
              \item[\textbf{ \starray_parsed_get_prop:n{ self }}]  \starray_parsed_get_prop:n { refcnt }
            }
      \end{ listofindicators }
    }
  }
}


\NewDocumentCommand{ \textmark }{ O{ attention }m }
  { 
    \bool_if:NT \l__ufrgscca_showind_bool 
      { 
        { 
          \__ufrgscca_set_statuscolor:n { #1 }
          \color{ \l__ufrgscca_txtcolor_tl }
          \textbf{ !!~ #2~ !!}
        }
      }
  }


\NewDocumentCommand{ \comment }{ O{ attention }m+m }
  { 
      \bool_if:NT \l__ufrgscca_showind_bool 
        { 
          \bool_if:NF \l__ufrgscca_nocomments_bool
          { 
    	    \__ufrgscca_set_statuscolor:n { #1 }
            \ \hfill\parbox{ 0.9\textwidth }{ \small
            \begin{ mdframed }[style=NEWindicatorsTikZ,frametitle=\__ufrgscca_tikz_title:n{ #2 }]
              { \footnotesize #3\par }
              \hfill\emph{ status:~}\textbf{ \color{ \l__ufrgscca_txtcolor_tl }#1 }
     	      \end{ mdframed }
            }\\[-2.7mm]  
    	  }
        }
  }



\let\remark\comment

\NewDocumentCommand{ \indtext }{ mm }
  { 
    \bool_if:NT \l__ufrgscca_showind_bool 
      { 
        \starray_get_prop:nn { #1 }{ #2 }{ short }
      }
  }


%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%
%%%
%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%


\tl_new:N \l__ufrgscca_tmp_indref_tl
\NewDocumentCommand{ \indref }{ sO{ }mm+m }
  { 
    \bool_if:NT \l__ufrgscca_showind_bool
    { 
    \starray_set_iter_from_hash:nn { indicator }{ #3 }
    \starray_set_iter_from_hash:nn { indicator.ind }{ @#4 }
    \tl_if_empty:nF { #2 }
    { 
      \starray_gset_prop:nnn { indicator.ind }{ status }{ #2 }
    }
    %% V-less : replacing / new seq
    \starray_get_unique_id:nNTF { indicator.ind }\l__ufrgscca_uniqueID_tmpb_tl
            { }
            { \tl_set:Nn \l__ufrgscca_uniqueID_tmpb_tl { }}
    % { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpb_tl _seq }
    
    \starray_get_prop:nnN { indicator.ind }{ cnt } \l__ufrgscca_tt_tmpb_tl
    \int_set:Nn \l__ufrgscca_tt_tmpa_int { \l__ufrgscca_tt_tmpb_tl + 1 }
    \starray_set_prop:nnV { indicator.ind }{ cnt } \l__ufrgscca_tt_tmpa_int
    \tl_set:Ne \l__ufrgscca_tmp_indref_tl { @indlabel@ #3 @ #4 - \int_use:N \l__ufrgscca_tt_tmpa_int }
    
    \seq_put_right:ce { l__ufrgscca_ind_ \l__ufrgscca_uniqueID_tmpb_tl _seq } { \l__ufrgscca_tmp_indref_tl }


    \label{ \l__ufrgscca_tmp_indref_tl }
    \starray_term_parser:n { indicator }
    \bool_if:nT { \starray_parsed_get_prop:n { view }}
    { 
      \starray_term_parser:n { indicator.ind }
      \__ufrgscca_set_statuscolor:e { \starray_parsed_get_prop:n { status }}
      \starray_term_parser:n { indicator.ind }
      \ \hfill
      \parbox{ 0.9\textwidth }
        { 
          \small
          \begin{ mdframed }[style=NEWindicatorsTikZ,frametitle=\__ufrgscca_tikz_title:n{ \__ufrgscca_hyperlink:en{ \starray_parsed_get_prop:n { labelref }}{ #3 ~:~ #4 }}]
            \pdftooltip{ \emph{ \starray_parsed_get_prop:n { short }}}{ \starray_parsed_get_prop:n { long }}\par
            \bool_if:NT \l__ufrgscca_indlong_bool 
              { 
    		      \IfBooleanF{ #1 }{ 
    	            \ifthenelse{ \equal{ \starray_parsed_get_prop:n { long }}{ }}{ }{ \enquote{ \footnotesize\starray_parsed_get_prop:n { long }}\par }
    			   }
              }
            \bool_if:NF \l__ufrgscca_nocomments_bool
              { 
                \ifthenelse{ \equal{ #5 }{ }}{ }{ { \emph{ \color{ \l__ufrgscca_comment_color_tl }{ #5 }}}\par }
              }
            \hfill\emph{ status: }\textbf{ \color{ \l__ufrgscca_txtcolor_tl }\starray_parsed_get_prop:n { status }}
     	  \end{ mdframed }
        }\\[-2.7mm]
    }
    }  
  }
  
\definecolor{ grayblack }{ rgb }{ 0.8,0.8,0.8 }


\tl_new:N \l__ufrgscca_txtcolor_tl
\tl_new:N \l__ufrgscca_bgcolor_tl
\tl_new:N \l__ufrgscca_comment_color_tl
\tl_set:Nn \l__ufrgscca_comment_color_tl { darkblue }

\cs_new_protected:Npn \__ufrgscca_set_statuscolor:n #1
  { 
    \starray_set_iter_from_hash:nnF { status }{ #1 }
      { \starray_set_iter_from_hash:nn { status }{ default } }
      \starray_get_prop:nnN { status }{ txtcolor }\l__ufrgscca_txtcolor_tl
      \starray_get_prop:nnN { status }{ bgcolor }\l__ufrgscca_bgcolor_tl
  }

\cs_generate_variant:Nn \__ufrgscca_set_statuscolor:n { e }


\cs_new_protected:Npn \__ufrgscca_set_txtcolor:n #1
  { 
    \starray_set_iter_from_hash:nnF { status }{ #1 }
      { 
        \starray_set_iter_from_hash:nn { status }{ default }
      }
        \starray_term_parser:n{ status }
        \color{ \starray_parsed_get_prop:n{ txtcolor }}
  }

\NewDocumentCommand{ \SetStatusColor }{ m }
  { 
    \__ufrgscca_set_txtcolor:n { #1 }
  }

\cs_if_exist:NF \__ufrgscca_def_colorpair:n
  { 
    \cs_new:Npn \__ufrgscca_def_colorpair:n #1
      { 
        \colorlet{ light#1 }{ white!85!#1 }
        \colorlet{ dark#1 }{ #1!70!black!100 }
        \colorlet{ darker#1 }{ #1!40!black!100 }
      }
  }

\cs_new:Npn \__ufrgscca_def_status:nnn #1#2#3
  { 
    \starray_new_term:nn { status }{ #1 }
    \starray_set_from_keyval:nn { status }
      { 
        txtcolor    = { dark#2 } ,
        bgcolor    = { light#2 } ,
        text        = { #3~ (#2)} ,
        self        = { #1 } ,
      }
    \__ufrgscca_def_colorpair:n { #2 }
  }

\__ufrgscca_def_status:nnn{ tbd }{ gray }{ To~ Be~ Done }
\__ufrgscca_def_status:nnn{ done }{ green }{ Done }
\__ufrgscca_def_status:nnn{ review }{ yellow }{ to~ be~ reviewed }
\__ufrgscca_def_status:nnn{ attention }{ red }{ needs~ Attention }
\__ufrgscca_def_status:nnn{ NSA }{ brown }{ NSA }
\__ufrgscca_def_status:nnn{ noref }{ magenta }{ no~ references }
\__ufrgscca_def_status:nnn{ EAD }{ violet }{ EAD }
\__ufrgscca_def_status:nnn{ MDi }{ teal }{ (courseware)...}
\__ufrgscca_def_status:nnn{ DOCs }{ blue }{ other~ DOCs }
\__ufrgscca_def_status:nnn{ default }{ cyan }{ everything~ else }
\__ufrgscca_def_status:nnn{ comment }{ blue }{ a~ comment }



\mdfdefinestyle{ NEWindicatorsTikZ }{ 
  linecolor=grayblack,
  linewidth=0.4pt,
%  skipabove=0.65\baselineskip,
%  skipbelow=0.5\baselineskip,
  skipabove=0pt,
  skipbelow=0pt,
  leftmargin =-3.5pt,
  rightmargin=-3.5pt,
  innerleftmargin=3pt,
  innerrightmargin=3pt,
  needspace=3\baselineskip,
  backgroundcolor=\l__ufrgscca_bgcolor_tl,
  usetwoside=false,
%	innertopmargin = 3pt,
%	innerbottommargin = 2pt,
	innertopmargin = 2pt,
	innerbottommargin = 2pt,
	roundcorner = 4pt,
	frametitle={ \__ufrgscca_tikz_title:n{ TITLE }},
	frametitleaboveskip=-0.6\baselineskip,
	frametitlebelowskip=0pt,
  frametitlealignment = \raggedleft,
	leftline = true,
	rightline = true,
	nobreak = true,
}

\tl_new:N \l__ufrgscca_TikZ_pos_tl
\tl_set:Nn \l__ufrgscca_TikZ_pos_tl { 0.44 }
\cs_new_protected:Npn \__ufrgscca_tikz_title:n #1
  { 
    \tikz[baseline=(current~ bounding~ box.east),outer~ sep=0pt,xshift=1cm,thin,color=grayblack]  
      \draw  (0,0) (\l__ufrgscca_TikZ_pos_tl,0) 
        node[anchor=west,rectangle,rounded~ corners,fill=white,draw] at (\l__ufrgscca_TikZ_pos_tl,0) { #1 } 
        node[anchor=west,rectangle,rounded~ corners,color=black] at (\l__ufrgscca_TikZ_pos_tl,0) { #1 };
  }




\NewDocumentCommand{ \fancyquote }{ O{ -2\topsep-2\parsep-2\partopsep-2\parskip }+mmm }
  { 
    \vspace{ #1 }
    { 
      \ \hfill
      \begin{ minipage }{ 0.5\textwidth }
        \noindent\scriptsize\emph{ ''#2''}
    	{ \vspace{ -\parsep }
          \begin{ flushright }
            \footnotesize 
              #3\\
              \sc #4
          \end{ flushright }
        } 
      \end{ minipage }\\
    }
  }


\NewDocumentEnvironment{ ppc.quote }{ }{ \begin{ displayquote }\begin{ itshape }\smaller }{ \end{ itshape }\end{ displayquote }}
%\preto\displayquote{ \begingroup\setlength{ \leftmargini }{ 0mm }}
%\appto\enddisplayquote{ \endgroup }
\RenewDocumentEnvironment{ quote }{ }
  { 
    \list{ }{ \leftmargin20mm\rightmargin0mm }
    \item\relax
  }
  { \endlist }
%

\NewDocumentCommand{ \labelhack }{ m }{ \def\@currentlabelname{ #1 }}



\NewDocumentCommand{ \acrodef }{ mmm }
  { 
    \starray_new_term:nn { acrolist }{ #1 }
    \starray_set_from_keyval:nn { acrolist }
    { 
      short = { #2 } ,
      long    = { #3 }
    }
  }

\NewDocumentCommand{ \acro }{ m }{ \starray_get_prop:nn{ acrolist[#1]}{ short }}
\NewDocumentCommand{ \acrol }{ m }{ \starray_get_prop:nn{ acrolist[#1]}{ long }}
\NewDocumentCommand{ \acrols }{ m }{ \starray_get_prop:nn{ acrolist[#1]}{ long }, \starray_get_prop:nn{ acrolist[#1]}{ short }}
\NewDocumentCommand{ \acrosl }{ m }{ \starray_get_prop:nn{ acrolist[#1]}{ short }, \starray_get_prop:nn{ acrolist[#1]}{ long }}
\NewDocumentCommand{ \acrofoot }{ m }{ \starray_get_prop:nn{ acrolist[#1]}{ short }\footnote{ \starray_get_prop:nn{ acrolist[#1]}{ long }}}
\NewDocumentCommand{ \printacrolist }{ O{ }m }{ 
    \begin{ listofabbrv }[#1]{ #2 }
    \starray_iterate_over:nn { acrolist }
      { \item[\starray_get_prop:nn{ acrolist }{ short }] \starray_get_prop:nn{ acrolist }{ long } }
    \end{ listofabbrv }
}



\RenewDocumentCommand{ \subparagraph }{ m }{ }
\RenewDocumentCommand{ \part }{ m }{ }
%
%Se alguém é capaz de me convencer e me evidenciar que o que penso
%ou faço não é correto, será com contentamento que me corrigirei; afinal,
%procuro a verdade, a qual jamais causou danos a alguém. Aquele, porém,
%que persevera no engano e na ignorância causa danos a si mesmo.

%Observa com olho crítico seus princípios norteadores e os indivíduos
%sensatos, tanto aquilo de que se esquivam como aquilo que buscam.

%Prestei algum benefício à comunidade? Se o fiz, então prestei um
%benefício a mim. Em todas as ocasiões tem isso sempre em mente e em lugar
%algum deixes de abrigar esse pensamento.

%%Caso ajas conforme a reta razão com referência ao que se coloca
%diante de ti, com seriedade, firmeza, benevolência, não admitindo que nada
%secundário te desvie de tua ação, mas conservando pura a divindade que
%existe em ti, como se devesses restituí-la de imediato; caso te vincules a isso,
%sem nada esperar nem fugir de nada, contente com tua atividade presente
%conforme a natureza, a dizer e murmurar em todo som emitido de tua boca
%uma verdade heroica, então viverás feliz. E não existe ninguém com o poder
%de impedi-lo.

%Se tu mesmo não consegues com teu esforço realizar algo, não penses
%ser isso impossível para o ser humano; se, entretanto, algo é possível ao ser
%humano e lhe é próprio, pensa que isso a ti também é acessível.


%É indispensável ter compreensão, atentando para cada palavra, daquilo
%que se diz, e sobre cada ação, deve-se ter compreensão do seu efeito. Nesse
%caso, é necessário ver diretamente a relação do ponto de vista de sua meta,
%ou melhor, a qual meta a ação se relaciona; quanto ao outro caso, é preciso
%observar o significado das palavras.

%Como és uma parte que ajuda a tornar um sistema social completo,
%faz toda ação tua ser uma parte integrante completa da vida social. Assim,
%qualquer ação tua que não tenha referência imediata ou remotamente ao fim
%social produz em tua vida uma ruptura violenta, impedindo que seja íntegra,
%e é de caráter sedicioso
