diff options
author | Karl Berry <karl@freefriends.org> | 2017-09-20 22:36:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-09-20 22:36:23 +0000 |
commit | baaddc3c242540fcc6eef178a4576c34df84c339 (patch) | |
tree | 3dd7e8072b95be228ebfff3acb9f40f0e7823b88 /Master/texmf-dist/doc/latex/xsim/examples | |
parent | 6fdb207f55c75b496f116c760eab2e1640de2b88 (diff) |
xsim (20sep17)
git-svn-id: svn://tug.org/texlive/trunk@45355 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/xsim/examples')
14 files changed, 340 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.hints.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.hints.pdf Binary files differnew file mode 100644 index 00000000000..6a6dab99cca --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.hints.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.hints.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.hints.tex new file mode 100644 index 00000000000..5fa3ed4ec8f --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.hints.tex @@ -0,0 +1,59 @@ +% https://tex.stackexchange.com/q/224408/ +\documentclass{article} +\usepackage{xsim} + +\usepackage{needspace} + +\DeclareExerciseProperty{hint} + +% we'll use a description list for the hints: +\newcommand\printhints{% + \begin{description} + \ForEachUsedExerciseByType{% + \def\ExerciseType{##1}% + \def\ExerciseID{##2}% + \GetExercisePropertyT{hint} + {% + \item[\XSIMmixedcase{\GetExerciseName}~##3] + ####1% + }% + }% + \end{description} +} + +\newcommand\hint[1]{\SetExerciseProperty{\ExerciseType}{\ExerciseID}{hint}{#1}} + +\begin{document} + +\section{Problems} +% set hint through option: +\begin{exercise}[subtitle=Pythagoras,hint=This is a hint to the first problem.] + This is the first problem. +\end{exercise} +\begin{solution} + This is the solution to the first problem. +\end{solution} + +\begin{exercise}[subtitle=Another Problem] + This is the second problem. +\end{exercise} +\begin{solution} + This is the solution to the second problem. +\end{solution} + +% set hint with custom command: +\begin{exercise}[subtitle=Yet Another Problem] + This is the third problem. + \hint{This is a hint to the third problem.} +\end{exercise} +\begin{solution} + This is the solution to the third problem. +\end{solution} + +\section{Hints} +\printhints + +\section{Solutions} +\printsolutions[headings=false] + +\end{document} diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.pdf Binary files differnew file mode 100644 index 00000000000..8050ee8f90a --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex new file mode 100644 index 00000000000..c2a9a3fe362 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex @@ -0,0 +1,81 @@ +% https://tex.stackexchange.com/q/94766/ +\documentclass[a4paper,10pt]{book} +\usepackage[utf8]{inputenc} + +\usepackage{xsim} +\xsimsetup{ + exercise/within=chapter, + exercise/template=theorem , + exercise/the-counter=\thechapter.\arabic{exercise} +} + +\DeclareExerciseEnvironmentTemplate{theorem} + {% + \par\addvspace{\baselineskip} + \noindent + \XSIMexpandcode{\noexpand\label{\ExerciseType:\ExerciseID}} + \Large\textbf{% + \space\GetExerciseProperty{counter}% + \GetExercisePropertyT{subtitle}{ (\PropertyValue)}% + } \normalsize\itshape + } + {\par\addvspace{\baselineskip}} + +\usepackage{multicol} + +\newcommand\listofexercises{ + \chapter*{List of Exercises} + \def\CurrentExerciseChapter{}% + \ForEachPrintedExerciseByType{ + \global\let\LastExerciseChapter\CurrentExerciseChapter + \xdef\CurrentExerciseChapter{\ExercisePropertyGet{##1}{##2}{chapter}}% + \XSIMifeqF{\LastExerciseChapter}{\CurrentExerciseChapter} + { + \XSIMifblankF{\LastExerciseChapter}{\end{multicols}} + \begin{multicols}{2}% + [\contentsline{chapter}{Chapter \CurrentExerciseChapter}{}{}] + } + \contentsline + {section} + {% + Exercise \ExercisePropertyGet{##1}{##2}{counter}% + \XSIMifblankF{##4}{ (##4)}% + } + {\pageref{##1:##2}}{}% + } + \end{multicols} +} + +% \usepackage{hyperref} +% \newcommand\theHexercise{\thechapter.\arabic{exercise}} + +\begin{document} + +\chapter{kinetic} +\begin{exercise} + 435-1 +\end{exercise} +\begin{exercise}[subtitle=Foo Bar] + 435-2 +\end{exercise} +\begin{exercise} + 435-3 +\end{exercise} + +\chapter{momentum} +\begin{exercise} + 436-1 +\end{exercise} +\begin{exercise} + 436-2 +\end{exercise} +\begin{exercise} + 436-3 +\end{exercise} +\begin{exercise} + 436-4 +\end{exercise} + +\listofexercises + +\end{document} diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-13635.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-13635.pdf Binary files differnew file mode 100644 index 00000000000..af889a6709f --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-13635.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-13635.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-13635.tex new file mode 100644 index 00000000000..3b52ce46b24 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-13635.tex @@ -0,0 +1,70 @@ +% https://tex.stackexchange.com/q/13635/ +\documentclass{article} +\usepackage{xsim} + +\DeclareExerciseEnvironmentTemplate{theorem:remark} + { + \par\addvspace{\baselineskip} + \noindent + \textit{% + \IfInsideSolutionF{\XSIMmixedcase{\GetExerciseName}~}% + \GetExerciseProperty{counter}}% + \GetExercisePropertyT{subtitle}{ \textup{(#1)}}% + . % + } + {\par\addvspace{\baselineskip}} + +\DeclareExerciseHeadingTemplate{exercises}{\subsection*{Exercises}} + +\xsimsetup{ + exercise/template = theorem:remark , + exercise/within = section , + exercise/the-counter = \thesection.\arabic{exercise} , + print-collection/headings = true , + print-collection/headings-template = exercises +} + +\DeclareExerciseCollection{prime numbers} +\DeclareExerciseCollection{Zeta function} + +\begin{document} + +\collectexercises{prime numbers} +\section{Prime Numbers} + +A \emph{prime number} is a positive integer other than $1$ that is only +divisible by $1$ and itself. + +\begin{exercise}[subtitle=Euclid's Theorem] + \label{ex:euclid} + Show that there are infinitely many prime numbers. +\end{exercise} + +As you will show in Exercise \ref{ex:euclid}, there are infinitely many +primes. The number of primes that are smaller than a given natural number $n$ +is denoted $\pi(n)$. + +\begin{exercise} + Find an asymptotic formula for $\pi(n)$. \emph{Hint:} You might find + Exercise \ref{ex:zeta} helpful. +\end{exercise} +\collectexercisesstop{prime numbers} + +\printcollection{prime numbers} + +\collectexercises{Zeta function} +\section{Zeta function} + +The zeta function is given by $\zeta(s) = \sum_{n=1}^\infty n^{-s}$, where $s$ +is a complex number with real part bigger than $1$. +\begin{exercise}\label{ex:zeta} + Extend $\zeta$ as far as possible and find all zeros + of the function. +\end{exercise} +For example $\zeta(2) = \frac{\pi^2}{6}$. + +\collectexercisesstop{Zeta function} + +\printcollection{Zeta function} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-155630.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-155630.pdf Binary files differnew file mode 100644 index 00000000000..6c9fc4482af --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-155630.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-155630.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-155630.tex new file mode 100644 index 00000000000..2edb7bfdad2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-155630.tex @@ -0,0 +1,26 @@ +% https://tex.stackexchange.com/q/155630/ +\documentclass{article} +\usepackage{xsim} + +\DeclareExerciseCollection{foo} + +\begin{document} + +\collectexercises{foo} +\begin{exercise} + foo +\end{exercise} +\begin{exercise} + bar +\end{exercise} +\begin{exercise} + baz +\end{exercise} +\collectexercisesstop{foo} + +% shuffle around for a different version: +\printexercise{exercise}{1} +\printexercise{exercise}{3} +\printexercise{exercise}{2} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-308883.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-308883.pdf Binary files differnew file mode 100644 index 00000000000..eb27dce140c --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-308883.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-308883.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-308883.tex new file mode 100644 index 00000000000..74e762fa08b --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-308883.tex @@ -0,0 +1,13 @@ +% https://tex.stackexchange.com/q/308883/ +\documentclass{article} +\usepackage{xsim,siunitx} +\xsimsetup{goal-print={\num{#1}}} +\sisetup{output-decimal-marker={,}} + +\begin{document} + +\begin{exercise}[points=2.5] + foo +\end{exercise} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-370642.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-370642.pdf Binary files differnew file mode 100644 index 00000000000..13933e80c3b --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-370642.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-370642.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-370642.tex new file mode 100644 index 00000000000..99b300c4a01 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-370642.tex @@ -0,0 +1,25 @@ +% https://tex.stackexchange.com/q/370642/ +\documentclass[a4paper,12pt]{article} +\usepackage{xsim} + +\DeclareExerciseEnvironmentTemplate{simple} + {\par\noindent\textbf{\GetExerciseProperty{counter}}. } + {\par} +\xsimsetup{exercise/template=simple} + +\begin{document} + +\begin{exercise}\label{eq1} + Let $X$ be such that\dots +\end{exercise} + +\begin{exercise} + In this exercise consider $Y=2$ \dots +\end{exercise} + +\begin{exercise} + Consider $X$ as in exercise~\ref{eq1} (I would like to see the issue + number~1) +\end{exercise} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530.pdf Binary files differnew file mode 100644 index 00000000000..137c8587693 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530.tex new file mode 100644 index 00000000000..48bf94cd6eb --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530.tex @@ -0,0 +1,66 @@ +\documentclass{article} +\usepackage{xsim} + +\DeclareExerciseType{subquestion}{ + exercise-env = question , + solution-env = answer , + exercise-name = Question , + solution-name = Answer , + exercise-template = item , + solution-template = item +} + +\DeclareExerciseProperty{title} + +\makeatletter +\DeclareExerciseEnvironmentTemplate{named} + {% + \subsection*{% + \GetExercisePropertyTF{title} + {#1} + {??\@latex@warning{Please give an exercise title}}% + }% + } + {} +\makeatother + +\DeclareExerciseEnvironmentTemplate{item} + {\item} + {} + +\DeclareExerciseCollection{exercise-pool} + +\xsimsetup{ + exercise/template = named +} + +\begin{filecontents*}{\jobname-exercises.tex} +\begin{question} + Who is the Defence Minister? +\end{question} +\begin{question} + Who is the Home Minister? +\end{question} +\begin{question} + Who is the Finance Minister? +\end{question} +\begin{question} + Who is the External Affairs Minister? +\end{question} +\end{filecontents*} + +\begin{document} + +\collectexercises{exercise-pool} +\input{\jobname-exercises.tex} +\collectexercisesstop{exercise-pool} + +\begin{exercise}[title=Answer the following in one sentence:] + \begin{enumerate} + \item Who is the President? + \item Who is the Prime Minister? + \printrandomexercises[collection=exercise-pool]{2} + \end{enumerate} +\end{exercise} + +\end{document} |