Skip to content

Instantly share code, notes, and snippets.

@diraol
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diraol/c639e9595f2bee7e01e0 to your computer and use it in GitHub Desktop.
Save diraol/c639e9595f2bee7e01e0 to your computer and use it in GitHub Desktop.
Macro para Requisitos de Engenharia de Software em LaTeX
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \let \hskip \vskip \let \vrule \hrule \let...
l.10 \PrintRequisitos
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
! You can't use `\hrule' here except with leaders.
\vline ->\vrule
\@width \arrayrulewidth
l.10 \PrintRequisitos
To put a horizontal rule in an hbox or an alignment,
you should use \leaders or \hrulefill (see The TeXbook).
! Missing number, treated as zero.
<to be read again>
}
l.10 \PrintRequisitos
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
}
l.10 \PrintRequisitos
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
[14
pdfTeX warning (ext4): destination with the same identifier (name{table.3.2}) h
as been already used, duplicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.65
pdfTeX warning (ext4): destination with the same identifier (name{table.3.
3}) has been already used, duplicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.65
]
\hyperlink {RF\theindiceFuncional }{RF\theindiceFuncional } & \CmdReqNome \\
%%01
\vfill
\begin{Requisito}
\ReqTipo{funcional}%Tipo
\ReqNome{Cadastrar usuário}%Nome
%\ReqLabel{cadUsu}%Label
\ReqDescr{O usuário realiza seu cadastro na plataforma.}%Desc.
\ReqPrioridade{alta}%Prioridade
\ReqStatus{aprovado}%Status
\ReqEstabilidade{alta}%Estabilidade
\ReqOrigem{interna}%Origem
\ReqRationale{Permite realizar um ``tracking'' do histórico dos usuários para oferecer informações mais precisas, além de permitir que o usuário utilize o ``game'', que demanda um acúmulo de participação na plataforma.}%Rationale
\ReqAssoc{}%Assoc
\end{Requisito}
%%02
\vfill
\begin{Requisito}
\ReqTipo{funcional}%Tipo
\ReqNome{Realizar login}%Nome
%\ReqLabel{login}%Label
\ReqDescr{O usuário deve fazer login para ter acesso ao sistema, impedindo que pessoas não autorizadas tenham acesso a certas funções do sistema.}%Desc.
\ReqPrioridade{alta}%Prioridade
\ReqStatus{aprovado}%Status
\ReqEstabilidade{alta}%Estabilidade
\ReqOrigem{usuario}%Origem
\ReqRationale{Método que previne que pessoas não autorizadas tenham acesso às funcionalidades do sistema, em especial as que alteram o banco de dados.}%Rationale
\ReqAssoc{Realizar login social}%Assoc
\end{Requisito}
\begin{table}[H]
\centering
\caption{Requisitos funcionais gerais}
\label{tab:reqFuncGeral}
\PrintRequisitos
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% REQUISITOS %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% USO %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%\begin{Requisito}
% \ReqTipo{<ARGUMENTO 1>}
% \ReqNome{<ARGUMENTO 2>}
% \ReqLabel{<LABEL>}
% \ReqDescr{<ARGUMENTO 3>}
% \ReqPrioridade{<ARGUMENTO 4>}
% \ReqStatus{<ARGUMENTO 5>}
% \ReqEstabilidade{<ARGUMENTO 6>}
% \ReqOrigem{<ARGUMENTO 7>}
% \ReqRationale{<ARGUMENTO 8>}
% \ReqAssoc{<ARGUMENTO 9>}
%\end{Requisito}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DESCRIÇÃO DOS ARGUMENTOS %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% *** Nenhum argumento pode conter caracteres especiais, como o 'underscore' ***
% <LABEL>: Label a ser usada para referencias internas do documento
% <ARGUMENTO 1>: TIPO: ´Funcional´ (funcional) ou ´Nao Funcional´ (nao funcional)
% <ARGUMENTO 2>: Nome do requisito
% <ARGUMENTO 3>: Descrição do Requisito
% <ARGUMENTO 4>: Prioridade [alta, media, baixa]
% <ARGUMENTO 5>: Status [proposto, aprovado, incorporado, validado]
% <ARGUMENTO 6>: Estabilidade [alta, media, baixa]
% <ARGUMENTO 7>: Origem [usuario, interna, externa]
% <ARGUMENTO 8>: Rationale - texto extenso
% <ARGUMENTO 9>: Requisitos Associados - por enquanto tem que listar na mão
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% CONTADORES DOS REQUISITOS
\newcounter{indiceFuncional}
\newcounter{indiceNaoFuncional}
%
%
%% New job (that is, file)
\newwrite\ans
\immediate\openout\ans=\jobname-temp
%
%
%% Usamos unexpanded... mas eu não sei porque. No meu
%% computador não funciona se removo o unexpanded. Acho
%% que deve ter algo haver com o `\\` dentro da expressão.
%% (Aliás, isso é muito provável, já que o significado
%% de `\\` é diferente no texto e em um ambiente tabular;
%% sua expansão tem que ser postergada para o momento em
%% que a tabela está sendo impressa (`PrintVolunteers`).
\newcommand{\AppendRequisito}[2]{%
\immediate\write\ans{\unexpanded{\hyperlink{#1}{#1} & #2\\}}%
}
%
\newcommand{\PrintRequisitos}{%
\begin{tabular}{|c|l|}%
\hline
\textbf{Identificação} & \textbf{Requisito} \\%
\hline%
\immediate\closeout\ans\input{\jobname-temp}%
\hline%
\end{tabular}%
}
%
%
%%%%%
\newenvironment{Requisito}{}{%
\CriaRequisito%
}
%
%
% FUNÇÕES INTERNAS
\newcommand{\CmdReqTipo}{}%
\newcommand{\CmdReqLabel}{}%
\newcommand{\CmdReqNome}{}%
\newcommand{\CmdReqDescr}{}%
\newcommand{\CmdReqPrioridade}{}%
\newcommand{\CmdReqStatus}{}%
\newcommand{\CmdReqEstabilidade}{}%
\newcommand{\CmdReqOrigem}{}%
\newcommand{\CmdReqRationale}{}%
\newcommand{\CmdReqAssoc}{}%
%
%
%
%FUNÇÕES USER FRIENDLY
\newcommand{\ReqTipo}[1]{%
\ifstrequal{#1}{funcional}{%
\stepcounter{indiceFuncional}%
\ReqLabel{RF\theindiceFuncional}%
\renewcommand{\CmdReqTipo}{\multicolumn{3}{|l|}{\textbf{No:} RF\theindiceFuncional \hypertarget{\CmdReqLabel}{}} & (X) Funcional & ( ) Não Funcional \\}
\AppendRequisito{RF\theindiceFuncional}{\CmdReqNome}
}{%
\stepcounter{indiceNaoFuncional}%
\ReqLabel{RNF\theindiceFuncional}%
\renewcommand{\CmdReqTipo}{\multicolumn{3}{|l|}{\textbf{No:} RN\theindiceNaoFuncional} & ( ) Funcional & (X) Não Funcional \\}
\AppendRequisito{RNF\theindiceNaoFuncional}{\CmdReqNome}
}
}
\newcommand{\ReqLabel}[1]{\renewcommand{\CmdReqLabel}{#1}}%
\newcommand{\ReqNome}[1]{\renewcommand{\CmdReqNome}{#1}}%
\newcommand{\ReqDescr}[1]{\renewcommand{\CmdReqDescr}{#1}}%
\newcommand{\ReqPrioridade}[1]{%
\ifstrequal{#1}{alta}{%
\renewcommand{\CmdReqPrioridade}{(X) Alta & ( ) Média & ( ) Baixa & \\}
}{%
\ifstrequal{#1}{media}{%
\renewcommand{\CmdReqPrioridade}{( ) Alta & (X) Média & ( ) Baixa & \\}
}{%
\renewcommand{\CmdReqPrioridade}{( ) Alta & ( ) Média & (X) Baixa & \\}
}
}
}
\newcommand{\ReqStatus}[1]{
\ifstrequal{#1}{proposto}{%
\renewcommand{\CmdReqStatus}{(X) Proposto & ( ) Aprovado & ( ) Incorporado & ( ) Válido \\}
}{
\ifstrequal{#1}{aprovado}{%
\renewcommand{\CmdReqStatus}{( ) Proposto & (X) Aprovado & ( ) Incorporado & ( ) Válido \\}
}{
\ifstrequal{#1}{incorporado}{%
\renewcommand{\CmdReqStatus}{( ) Proposto & ( ) Aprovado & (X) Incorporado & ( ) Válido \\}
}{
\renewcommand{\CmdReqStatus}{( ) Proposto & ( ) Aprovado & ( ) Incorporado & (X) Válido \\}
}%
}%
}
}%
\newcommand{\ReqEstabilidade}[1]{
\ifstrequal{#1}{alta}{%
\renewcommand{\CmdReqEstabilidade}{(X) Alta & ( ) Média & ( ) Baixa & \\}
}{%
\ifstrequal{#1}{media}{%
\renewcommand{\CmdReqEstabilidade}{( ) Alta & (X) Média & ( ) Baixa & \\}
}{%
\renewcommand{\CmdReqEstabilidade}{( ) Alta & ( ) Média & (X) Baixa & \\}
}
}
}
\newcommand{\ReqOrigem}[1]{
\ifstrequal{#1}{usuario}{%
\renewcommand{\CmdReqOrigem}{(X) Usuário & ( ) Interna & ( ) Externa \\}%
}{%
\ifstrequal{#1}{interna}{%
\renewcommand{\CmdReqOrigem}{( ) Usuário & (X) Interna & ( ) Externa \\}%
}{
\renewcommand{\CmdReqOrigem}{( ) Usuário & ( ) Interna & (X) Externa \\}%
}%
}%
}
\newcommand{\ReqRationale}[1]{\renewcommand{\CmdReqRationale}{#1}}%
\newcommand{\ReqAssoc}[1]{\renewcommand{\CmdReqAssoc}{#1}}%
%
%
%Função Requisito - utilizada indiretamente pelo ambiente Requisito
\newcommand{\CriaRequisito}{
\begin{table}[!h]
\begin{tabular}{|lllll|}%
\hline%
\CmdReqTipo%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Requisito:} \CmdReqNome%#2%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Descrição:} \CmdReqDescr%#3%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\textbf{Prioridade:} & \CmdReqPrioridade%
\hline%
\textbf{Status:} & \CmdReqStatus%
\hline%
\textbf{Estabilidade:} & \CmdReqEstabilidade%
\hline%
\textbf{Origem:} & \CmdReqOrigem%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Rationale:} \CmdReqRationale%#8%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Requisitos Associados:} \CmdReqAssoc%#9%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\end{tabular}
\end{table}
}% FIM DO COMMAND CriaRequisito
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% REQUISITOS %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% USO %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%\begin{Requisito}
% \ReqTipo{<ARGUMENTO 1>}
% \ReqNome{<ARGUMENTO 2>}
% \ReqLabel{<LABEL>}
% \ReqDescr{<ARGUMENTO 3>}
% \ReqPrioridade{<ARGUMENTO 4>}
% \ReqStatus{<ARGUMENTO 5>}
% \ReqEstabilidade{<ARGUMENTO 6>}
% \ReqOrigem{<ARGUMENTO 7>}
% \ReqRationale{<ARGUMENTO 8>}
% \ReqAssoc{<ARGUMENTO 9>}
%\end{Requisito}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DESCRIÇÃO DOS ARGUMENTOS %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% *** Nenhum argumento pode conter caracteres especiais, como o 'underscore' ***
% <LABEL>: Label a ser usada para referencias internas do documento
% <ARGUMENTO 1>: TIPO: ´Funcional´ (funcional) ou ´Nao Funcional´ (nao funcional)
% <ARGUMENTO 2>: Nome do requisito
% <ARGUMENTO 3>: Descrição do Requisito
% <ARGUMENTO 4>: Prioridade [alta, media, baixa]
% <ARGUMENTO 5>: Status [proposto, aprovado, incorporado, validado]
% <ARGUMENTO 6>: Estabilidade [alta, media, baixa]
% <ARGUMENTO 7>: Origem [usuario, interna, externa]
% <ARGUMENTO 8>: Rationale - texto extenso
% <ARGUMENTO 9>: Requisitos Associados - por enquanto tem que listar na mão
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% CONTADORES DOS REQUISITOS
\newcounter{indiceFuncional}
\newcounter{indiceNaoFuncional}
%
%
%%%%%
\newenvironment{Requisito}{}{%
\CriaRequisito%
}
%
%
% FUNÇÕES INTERNAS
\newcommand{\CmdReqTipo}{}%
\newcommand{\CmdReqLabel}{}%
\newcommand{\CmdReqNome}{}%
\newcommand{\CmdReqDescr}{}%
\newcommand{\CmdReqPrioridade}{}%
\newcommand{\CmdReqStatus}{}%
\newcommand{\CmdReqEstabilidade}{}%
\newcommand{\CmdReqOrigem}{}%
\newcommand{\CmdReqRationale}{}%
\newcommand{\CmdReqAssoc}{}%
%
%
%
%FUNÇÕES USER FRIENDLY
\newcommand{\ReqTipo}[1]{%
\ifstrequal{#1}{funcional}{%
\stepcounter{indiceFuncional}%
\ReqLabel{RF\theindiceFuncional}%
\renewcommand{\CmdReqTipo}{\multicolumn{3}{|l|}{\textbf{No:} RF\theindiceFuncional \hypertarget{\CmdReqLabel}{}} & (X) Funcional & ( ) Não Funcional \\}
}{%
\stepcounter{indiceNaoFuncional}%
\ReqLabel{RNF\theindiceFuncional}%
\renewcommand{\CmdReqTipo}{\multicolumn{3}{|l|}{\textbf{No:} RN\theindiceNaoFuncional} & ( ) Funcional & (X) Não Funcional \\}
}
}
\newcommand{\ReqLabel}[1]{\renewcommand{\CmdReqLabel}{#1}}%
\newcommand{\ReqNome}[1]{\renewcommand{\CmdReqNome}{#1}}%
\newcommand{\ReqDescr}[1]{\renewcommand{\CmdReqDescr}{#1}}%
\newcommand{\ReqPrioridade}[1]{%
\ifstrequal{#1}{alta}{%
\renewcommand{\CmdReqPrioridade}{(X) Alta & ( ) Média & ( ) Baixa & \\}
}{%
\ifstrequal{#1}{media}{%
\renewcommand{\CmdReqPrioridade}{( ) Alta & (X) Média & ( ) Baixa & \\}
}{%
\renewcommand{\CmdReqPrioridade}{( ) Alta & ( ) Média & (X) Baixa & \\}
}
}
}
\newcommand{\ReqStatus}[1]{
\ifstrequal{#1}{proposto}{%
\renewcommand{\CmdReqStatus}{(X) Proposto & ( ) Aprovado & ( ) Incorporado & ( ) Válido \\}
}{
\ifstrequal{#1}{aprovado}{%
\renewcommand{\CmdReqStatus}{( ) Proposto & (X) Aprovado & ( ) Incorporado & ( ) Válido \\}
}{
\ifstrequal{#1}{incorporado}{%
\renewcommand{\CmdReqStatus}{( ) Proposto & ( ) Aprovado & (X) Incorporado & ( ) Válido \\}
}{
\renewcommand{\CmdReqStatus}{( ) Proposto & ( ) Aprovado & ( ) Incorporado & (X) Válido \\}
}%
}%
}
}%
\newcommand{\ReqEstabilidade}[1]{
\ifstrequal{#1}{alta}{%
\renewcommand{\CmdReqEstabilidade}{(X) Alta & ( ) Média & ( ) Baixa & \\}
}{%
\ifstrequal{#1}{media}{%
\renewcommand{\CmdReqEstabilidade}{( ) Alta & (X) Média & ( ) Baixa & \\}
}{%
\renewcommand{\CmdReqEstabilidade}{( ) Alta & ( ) Média & (X) Baixa & \\}
}
}
}
\newcommand{\ReqOrigem}[1]{
\ifstrequal{#1}{usuario}{%
\renewcommand{\CmdReqOrigem}{(X) Usuário & ( ) Interna & ( ) Externa \\}%
}{%
\ifstrequal{#1}{interna}{%
\renewcommand{\CmdReqOrigem}{( ) Usuário & (X) Interna & ( ) Externa \\}%
}{
\renewcommand{\CmdReqOrigem}{( ) Usuário & ( ) Interna & (X) Externa \\}%
}%
}%
}
\newcommand{\ReqRationale}[1]{\renewcommand{\CmdReqRationale}{#1}}%
\newcommand{\ReqAssoc}[1]{\renewcommand{\CmdReqAssoc}{#1}}%
%
%
%Função Requisito - utilizada indiretamente pelo ambiente Requisito
\newcommand{\CriaRequisito}{
\begin{table}[!h]
\begin{tabular}{|lllll|}%
\hline%
\CmdReqTipo%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Requisito:} \CmdReqNome%#2%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Descrição:} \CmdReqDescr%#3%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\textbf{Prioridade:} & \CmdReqPrioridade%
\hline%
\textbf{Status:} & \CmdReqStatus%
\hline%
\textbf{Estabilidade:} & \CmdReqEstabilidade%
\hline%
\textbf{Origem:} & \CmdReqOrigem%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Rationale:} \CmdReqRationale%#8%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\multicolumn{5}{|l|}{%
\begin{minipage}{1\textwidth}%
\espacoVert%
\textbf{Requisitos Associados:} \CmdReqAssoc%#9%
\espacoVert%
\end{minipage}%
} \\%
\hline%
\end{tabular}
\end{table}
}% FIM DO COMMAND CriaRequisito
%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment