Skip to content

Instantly share code, notes, and snippets.

@ameisehaufen
Created March 18, 2021 00:51
Show Gist options
  • Save ameisehaufen/04db8a6e30cd504ff7949ff79267a531 to your computer and use it in GitHub Desktop.
Save ameisehaufen/04db8a6e30cd504ff7949ff79267a531 to your computer and use it in GitHub Desktop.
Small piece of code to generate loop in an array in latex
\usepackage{listofitems} % Para usar o array de itens
\setsepchar{\\/,/ }
\readlist{\participante}{ % Lista de participantes
% Posto Grad, Nome Completo, função relacioada ao projeto, função no setor/empresa.
Cel, Fulano \textbf{Sauro}, Gerente do \nomeProjeto, Adjunto da Divisão\\
Civil, Ciclano \textbf{Sauro}, Gerente do \nomeProjeto, Adjunto da Divisão
}
\setsepchar{,}
\newcommand{\printSignatures}[1]{%
\begin{center}
Quartel em Cuiabá, PR, \Dia/\Mes/\DTMfetchyear{date}.\\
\end{center}
\foreachitem \z \in \participante{%
\setsepchar{,}%
\expandafter\readlist\expandafter\ThisSet\expandafter{\z}%
\noindent\parbox[t]{0.7\textwidth}{\raggedright
\centering
\textbf{\MakeUppercase{\ThisSet[2]} - \ThisSet[1]}\\
\ThisSet[4]
}
\parbox[t]{0.3\textwidth}{\raggedright
\fbox{
\begin{minipage}[c]{1\linewidth}
\centering{\scriptsize{Assinatura}}\\
\vspace{5ex}
\end{minipage}}
}
}
}
\newcommand{\printParticipantsList}[1]{%
\foreachitem \z \in \participante{%
\setsepchar{,}%
\expandafter\readlist\expandafter\ThisSet\expandafter{\z}%
\ThisSet[1] \ThisSet[2] (\ThisSet[3])%
\ifthenelse{\equal{\participante[-1,2]}{\ThisSet[2]}}%
{% True case
.%
}
{% false case
\ifthenelse{\equal{\participante[-2,2]}{\ThisSet[2]}}%
{\ e o(a)
}%
{,
}%
}
}%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment