Listas de acciones ordenadas por persona

Listas de acciones ordenadas por persona

Estoy creando una clase para actas de reuniones porque tengo algunas demandas bastante específicas; minutes.styno parece cumplir con todos mis requisitos.

Hay algunos buenos avances, pero estoy completamente estancado en lo siguiente: quiero poder definir elementos de acción a medida que los encuentro en las reuniones y ordenarlos automáticamente por persona.

Sería genial si pudiera escribir algo como esto:

\action{Peter}{next week}{Take out the garbage}

\action{Mike}{tomorrow}{Prepare a presentation for the thing}

\action{Peter}{2015-02-28}{Clean the kitchen}

\action{Peter}{tomorrow}{Water the plants}

\action{Mike}{yesterday}{Cleanse the bathroom}

Y haga que todo se muestre en un descriptionentorno como este:

\begin{description}
  \item[Peter] \hfill \\
     Water the plants     \hfill \textbf{tomorrow} \\
     Take out the garbage \hfill \textbf{next week} \\
     Clean the kitchen    \hfill \textbf{2015-02-28} \\
  \item[Mike] \hfill \\
     Prepare a presentation for the thing \hfill \textbf{tomorrow} \\
     Cleanse the bathroom                 \hfill \textbf{yesterday} \\
\end{description}

No es necesario ordenar las tareas por fecha de entrega por persona, aunque también me encantaría recibir sugerencias para eso. Agruparlos por persona es más crítico.

Obviamente necesito una estructura de datos, pero no tengo idea de por dónde empezar ni cómo funcionarían. ¿Existe algo como una matriz, una lista, un mapa hash o algo que permita ordenar con bastante facilidad?

Tampoco estoy vinculado a ningún compilador en particular. Si hay características, digamos luatexque harán que este camino sea más fácil, entonces eso no sería un problema.

¿Alguien puede indicarme la dirección correcta? ¿Es siquiera posible?

Respuesta1

Aquí hay un punto de partida:

ingrese la descripción de la imagen aquí

\documentclass{article}

\usepackage{multido}
\newcounter{personcntr}% Keep track of number of persons
\makeatletter
\newcommand{\action}[3]{% \action{<name>}{<time>}{<duty>}
  \@ifundefined{person@#1}{% If person doesn't exist
    \stepcounter{personcntr}% Next person
    \expandafter\xdef\csname person@#1\endcsname{1}% One time/duty
    \expandafter\xdef\csname person@bynumber@\thepersoncntr\endcsname{#1}% Number person

  }{% Person already exists
    \expandafter\xdef\csname person@#1\endcsname{%
      \number\numexpr\csname person@#1\endcsname+1}% Step number of time/duty
  }%
  \expandafter\xdef\csname person@#1@\csname person@#1\endcsname @time\endcsname{#2}% Store time
  \expandafter\xdef\csname person@#1@\csname person@#1\endcsname @duty\endcsname{#3}% Store duty
  \ignorespaces
}
\gdef\newpar{\par}% \multido doesn't enjoy \par

\newcommand\printactions{% Print actions
  \def\descriptionBODY{}% Empty descriptionBODY
  {\let\item\relax% Prevent expansion of \item
   \let\newpar\relax% Prevent expansion of \newpar
    \multido{\iPerson=1+1}{\value{personcntr}}{% Step through all persons
      % Extract person name
      \expandafter\xdef\expandafter\thisperson\expandafter{\csname person@bynumber@\iPerson\endcsname}%
      \protected@xdef\descriptionBODY{%
        \descriptionBODY%
        \item[\thisperson] \leavevmode\newpar}% Add person name to descriptionBODY
      % Extract person number
      \expandafter\xdef\expandafter\thispersonnum\expandafter{\csname person@\thisperson\endcsname}%
      \multido{\iDuty=1+1}{\thispersonnum}{%
        \protected@xdef\descriptionBODY{%
          \descriptionBODY%
          \csname person@\thisperson @\iDuty @duty\endcsname% Add person duty to descriptionBODY
          \hfill
          {\bfseries\csname person@\thisperson @\iDuty @time\endcsname}% Add person time to descriptionBODY
          \newpar
        }%
      }%
    }%
  }%
  % Print person time/duty
  \begin{description}
    \descriptionBODY
  \end{description}
}
\makeatother

\begin{document}

\action{Peter}{next week}{Take out the garbage}

\action{Mike}{tomorrow}{Prepare a presentation for the thing}

\action{Peter}{2015-02-28}{Clean the kitchen}

\action{Peter}{tomorrow}{Water the plants}

\action{Mike}{yesterday}{Cleanse the bathroom}

\printactions

\end{document}

información relacionada