summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/listofanswers/listofanswers.sty
blob: b564c300b811ea887a8f3f53e8c0977ad587a5ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
\ProvidesPackage{listofanswers}[06/11/2012]

% version 1.2

\newcounter{group}
\newcounter{exercise}[group]
\newcounter{subexercise}[exercise]


\newcommand{\group}{%
	\refstepcounter{group}
	\subsection*{\centering\exercisesname.\;\groupname\;\thegroup}
   \addcontentsline{loa}{group}{\groupname\;\thegroup}
}

\newcommand{\exercise}{%
    \refstepcounter{exercise}
    \@ifstar\exerciseStar\exerciseNoStar
}

\newcommand{\exerciseNoStar}[1]{%
    \@ifnextchar\bgroup{\exerciseNoStarTwo{#1}}{\exerciseNoStarOne{#1}}
}

\newcommand{\exerciseNoStarOne}[1]{%
	\textbf{\theexercise.} #1
}

\newcommand{\exerciseNoStarTwo}[2]{%
	\textbf{\theexercise.} #1
	\addcontentsline{loa}{exercise}{%
     \textbf{\theexercise.}~#2\quad
	}
}

\newcommand{\exerciseStar}[2]{%
	\textbf{\theexercise*.} #1
	\addcontentsline{loa}{exercise}{%
     \textbf{\theexercise.}~#2\quad
	}
}

\newcommand{\subexercise}[1]{%
    \refstepcounter{subexercise}
    \@ifnextchar\bgroup{\subexerciseTwo{#1}}{\subexerciseOne{#1}}
}

\newcommand{\subexerciseOne}[1]{%
	\@alph\thesubexercise) #1
}

\newcommand{\subexerciseTwo}[2]{%
	\@alph\thesubexercise) #1
   \addcontentsline{loa}{subexercise}{%
     \textbf{\theexercise.}~\@alph\thesubexercise)~#2\quad
	}
}

\newcommand*{\l@group}[2]{\subsection*{\centering #1, p. #2}}

\newcommand*{\l@exercise}[2]{\noindent #1}

\newcommand*{\l@subexercise}[2]{\noindent #1}

\newcommand{\listofanswers}{%
	\answershead
   \renewcommand{\thefootnote}{\fnsymbol{footnote}}	
	\@starttoc{loa}
	\addcontentsline{toc}{\answerstype}{\answersname}
}

\@ifclassloaded{book}
{\newcommand{\answershead}{\chapter*{\answersname}}
 \newcommand{\answerstype}{chapter}}
{\newcommand{\answershead}{\section*{\answersname}}
 \newcommand{\answerstype}{section}}

\newcommand{\answersname}{Respuestas}
\newcommand{\exercisesname}{EJERCICIOS}
\newcommand{\groupname}{Grupo}