0

I have a macro called \task which formats the text in a specific way. Now for every task I have to add the taskname as a column and an empty cell underneath.

So how can I achieve the following?

\documentclass{article}

\newcommand{\task}[1]{\par \bigskip \noindent {\bf{Task {#1}}}}
\newcommand{\makeTasktable}{%
\begin{tabular}{*{10}{|c}}
  % For every \task do:
  %   echo taskname &
  % done
  1.1 & 1.2 & 1.3 \\
  \hline
  % For every \task do:
  %   echo &
  % done
  & &
\end{tabular}

}

\begin{document}
\makeTasktable

\task{1.1} Foo
\task{1.2} Bar
\task{1.3} Baz
\end{document}

table

4
  • I do not understand your question. If you don't get an answer maybe you should add the desired output (hand drawing or use PowerPoint etc). Could you use a list like description? If yes, have a look at the enumitem package. Apr 22, 2017 at 23:44
  • 1
    Unrelated, \bf is outdated -- use \textbf{Text} or \bfseries (switch). Apr 22, 2017 at 23:45
  • neither \noindent nor \bf take an argument in {..} Apr 23, 2017 at 0:11
  • Packages like exsheets or the exam class (and others) provide ready made and customizable commands to create what you want, an exam sheet and a point table. Why do you want to reinvent thte wheel?
    – Johannes_B
    Apr 23, 2017 at 4:53

1 Answer 1

1

Using package exsheets. The grade table even comes as an example file, copy/paste and done.

hsnExsheets

\documentclass{article}
\usepackage{exsheets}
\SetupExSheets{
    counter-format=se.qu,
    counter-within=section,
    headings=runin,
}
\DeclareTranslation{english}{exsheets-exercise-name}{Task}

\begin{document}


\section{Capybara}
\begin{question}{2}
    Foo
\end{question}
\begin{question}{6}
    Bar
\end{question}
\section{Wombat}
\begin{question}{1}
    Baz
\end{question}

\bigskip\noindent
\begin{tabular}{|l|*{\numberofquestions}{c|}c|}\hline
  Task & \ForEachQuestion{\QuestionNumber{#1}\iflastquestion{}{&}} & Total \\ \hline
  Points   & \ForEachQuestion{\GetQuestionProperty{points}{#1}\iflastquestion{}{&}} & \pointssum* \\ \hline
  Reached  & \ForEachQuestion{\iflastquestion{}{&}} & \\ \hline
\end{tabular}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .