summaryrefslogtreecommitdiff
path: root/info/examples/ltt/question.sty
diff options
context:
space:
mode:
Diffstat (limited to 'info/examples/ltt/question.sty')
-rw-r--r--info/examples/ltt/question.sty59
1 files changed, 59 insertions, 0 deletions
diff --git a/info/examples/ltt/question.sty b/info/examples/ltt/question.sty
new file mode 100644
index 0000000000..0444ed3337
--- /dev/null
+++ b/info/examples/ltt/question.sty
@@ -0,0 +1,59 @@
+% QUESTION.STY
+% Erzeugt Sammlungen von Fragen und Antworten
+\RequirePackage{ifthen}
+\newsavebox{\collect}
+
+\@ifundefined{chapter}
+ {\newcounter{question}
+ \renewcommand{\thequestion}
+ {\arabic{question}}}
+ {\newcounter{question}[chapter]
+ \renewcommand{\thequestion}
+ {\thechapter-\arabic{question}}
+ \newcommand{\p@questioncnt}
+ {\thechapter-}}
+
+% Sammelt die Antworten, die zunaechst in Box \tmp
+% erstellt werden, in \collect zum Drucken.
+% Umgebung fuer die Fragen
+\newenvironment{question}[1][]
+{\begin{trivlist}\item[]\refstepcounter{question}
+ \makebox{\bfseries $\triangleright~$%
+ Frage~\thequestion%
+ \ifthenelse{\equal{#1}{}}%
+ {}{~(#1)}\hspace{0,5em}}
+}
+{\end{trivlist}}
+
+% Umgebung fuer die Loesungen
+\newenvironment{answer}[1][]
+{\global\setbox\collect=\vbox\bgroup
+ \unvbox\collect
+ \begin{trivlist}\item[]
+ \makebox{\bfseries $\triangleright~$%
+ Antwort~\thequestion%
+ \ifthenelse{\equal{#1}{}}{}{~(#1)}\hspace{0,5em}}
+}
+{\end{trivlist}\egroup}
+
+\newenvironment{answer*}[1][]
+{\global\setbox\collect=\vbox\bgroup
+ \unvbox\collect
+ \begin{trivlist}\item[]
+ \makebox{\bfseries $\triangleright$~%%
+ \ifthenelse{\equal{#1}{}}{Antwort}{#1}\hspace{0,5em}}
+}
+{\end{trivlist}\egroup}
+
+% chapter* als Gliederung der Loesungen sowie
+% Text der Standardueberschrift
+\@ifundefined{chapter}
+ {\newcommand{\questionhead}[1]{\section*{#1}}}
+ {\newcommand{\questionhead}[1]{\chapter*{#1}}}
+\newcommand{\qheadtitle}{Antworten zu den Fragen}
+
+% drucke die Antwortenbox
+\newcommand{\printanswers}[1][\qheadtitle]
+ {\questionhead{#1}
+ \unvbox\collect
+ } \ No newline at end of file