% % Package ethuebung % % Some Definitions for Exercise sheets for ETH Zurich (german/english) % % % !!! DO NOT EDIT THIS FILE. SEE NOTE BELOW. !!! % % % The latest version of this style file, along with all necessary documentation and % examples, can be found on github.com: % % https://github.com/phfaist/ethuebung % % % Author: Philippe Faist (2012-2014) % \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{ethuebung}[2014/10/28 ethuebung package] % % NOTE: The same LaTeX file will compile both the "Uebungsblatt" and the "Musterloesung", by % passing the [sol] option to the {ethuebung} package: % % \usepackage[sol]{ethuebung} % % % NOTE: If you want the exercise sheet in German instead of in English, use % % \usepackage[deutch]{ethuebung} % will provide the Uebungsblatt % or % \usepackage[deutch,sol]{ethuebung} % will provide the Musterloesung % % % % NOTE: Do _NOT_ modify this file unless you are actively contributing to its development. % A modified style sheet will break standards and will spread confusion as to % which version one should use. ALL ASPECTS OF THE EXERCISE SHEET CAN BE CUSTOMIZED BY USE % OF SPECIFIC LaTeX COMMANDS IN YOUR EXERCISE SHEET LATEX FILE. Have a look at the FAQ and % documentation provided with the package. If you are in for more advanced customization, % look at the source code here, but redefine the relevant commands **in your TeX % file**. If you think there is a bug or a feature is missing from this package, you can % contact me to propose a modification. If you fix the bug yourself, or modify this % package in order to improve it, PLEASE let me know, in order to propagate your % improvements or fixes upstream. % % % % % ---- % Require some base pacakges % ---- \RequirePackage{amssymb} \RequirePackage{amsmath} \RequirePackage{graphicx} \RequirePackage{ifpdf} \ifpdf % This is to be done at \begin{document} to avoid an option clash with xcolor if options % are given there. Indeed, pdfpages requires -> eso-pic requires -> xcolor ; so make % sure this package requirement is done late. \AtBeginDocument{\RequirePackage{pdfpages}} \fi % ---- % Some utilities % ---- % % Utility to test whether the argument contains any text. % % If #1 is not empty, then expands to #2, otherwise to #3. % \newcommand{\ueb@ifnotempty}[3]{% {% \setbox0=\hbox{#1}\ifdim\wd0=0pt% #3% \else% #2% \fi% }% } % % % Utility to add a space before the argument, if the argument contains text % Use this for combining labels for example, % Exercise~\ref{exerciseref}\ueb@maybespace{\ref{exercisepart}} will work also in case % \ref{exercisepart} expands to empty text. % % Taken from: http://tex.stackexchange.com/questions/53068/ % % \def\ueb@maybespace#1{% {% \setbox0=\hbox{#1}\ifdim\wd0=0pt% % EMPTY \else% ~#1% content, preceeded by a space \fi% }% } % % Utility like \ueb@maybespace, except adds the space after the content instead of % before. % \def\ueb@maybespaceafter#1{% {% \setbox0=\hbox{#1}\ifdim\wd0=0pt% % EMPTY \else% #1~% content, then a space \fi% }% } % % In the same spirit as before: insert space between two arguments only if both are % non-empty. % \def\ueb@maybespacebetween#1#2{% \ueb@ifnotempty{#1}{#1\ueb@maybespace{#2}}{#2}% } % % Utility that takes one argument, and expands to nothing. % \def\ueb@killarg#1{}% % % utility to expand \arabic* etc. into \arabic{counter} for any given counter. % % This calls \ueb@defexpandstarcounter for each of \arabic, \Alph, \alph, \Roman, and % \roman. % \def\ueb@defexpandexenumeratecounters#1{% e.g. {exenumeratei} \ueb@defexpandstarcounter{#1}{\arabic}% \ueb@defexpandstarcounter{#1}{\Alph}% \ueb@defexpandstarcounter{#1}{\alph}% \ueb@defexpandstarcounter{#1}{\Roman}% \ueb@defexpandstarcounter{#1}{\roman}% } % % Utility to redefine a counter formatter (e.g. \alph) to check if the argument is a star, % and to use a specific counter if this is the case (like in enumitem) % % This redefines the given command (e.g. \alph) to check if the parameter is a star. If it % is not a star, it acts normally, by expanding to \alph{} (but does not expand % that command). If the parameter is a star, then the counter named by #2 is used: % \alph{#2}. Again, that command is left unexpanded. % % See also enumitem.sty source. % \def\ueb@defexpandstarcounter#1#2{% e.g. {exenumeratei}{\alph} \global\expandafter\let\csname ueb@old@\string #2\endcsname #2% \def#2##1{% \if*##1\@empty% \expandafter\noexpand\csname ueb@old@\string #2\endcsname{#1}% \else% \expandafter\noexpand\csname ueb@old@\string #2\endcsname{##1}% \fi% }% } \newcommand{\ueb@withstarredcounters}[2][\ueb@TheStarredSymbol]{% \begingroup% \let\ueb@old@alph\alph% \let\ueb@old@Alph\Alph% \let\ueb@old@roman\roman% \let\ueb@old@Roman\Roman% \let\ueb@old@arabic\arabic% \def\alph##1{\ueb@old@alph{##1}#1}% \def\Alph##1{\ueb@old@Alph{##1}#1}% \def\roman##1{\ueb@old@roman{##1}#1}% \def\Roman##1{\ueb@old@Roman{##1}#1}% \def\arabic##1{\ueb@old@arabic{##1}#1}% #2% \endgroup% } % % Code from http://www.tug.org/TUGboat/tb17-1/tb50hose.pdf % originally termed "\QNameLetName" % \def\ueb@NameLetName#1#2{% \expandafter% \expandafter% \expandafter% \let% \expandafter% \expandafter% \csname#1\endcsname% \csname#2\endcsname% } % ---- % Take care of exercise counters etc. % ---- % % Define a counter to number the exercises, and a counter for sub-exercises that is reset % at each new exercise. % % % Counter for \uebung{}/\exercise{} % \newcounter{uebcounter} \setcounter{uebcounter}{0} \renewcommand{\theuebcounter}{\arabic{uebcounter}} \newcommand{\theHuebcounter}{\arabic{uebcounter}} % for hyperref % % Counter for \subuebung{}/\subexercise{} % \newcounter{subuebcounter}[uebcounter] \setcounter{subuebcounter}{0} \renewcommand{\thesubuebcounter}{\theuebcounter.\arabic{subuebcounter}} \newcommand{\theHsubuebcounter}{\theHuebcounter.\arabic{subuebcounter}} % for hyperref % % internal label name for exercises. See \uebung{} and \subuebung{}: a label like this is % automatically pinned on each new exercise. % \def\ueb@labelforthisexercise{exercise:\arabic{uebcounter}.\arabic{subuebcounter}} % % internal label name for exercise parts. % \def\ueb@labelforthisexercisepart{exercisepart:\arabic{uebcounter}.\arabic{subuebcounter}.\alph{exenumeratei}.\roman{exenumerateii}} % ---- % Define what kind of LaTeX section/paragraph kind to use for new exercises, % sub-exercises, and loesung sections. % ---- % % Define what kind of paragraph (or sectioning command) a \uebung{} should use. We simply % use a plain old \paragraph{}. % % Note that this macro can take up to two arguments, the exercise label and the exercise % title. % \newcommand{\ueb@uebparagraph}{\paragraph} % % Define what kind of paragraph (or sectioning command) a \subuebung{} should % use. \subparagraph{} generates some ugly leading space, so we use a customized % subparagraph-type sectioning command. % \newcommand{\ueb@subuebsubparagraph}{% \@startsection{subparagraph}{5}% {\z@}% no indent {3.25ex \@plus1ex \@minus .2ex}% default taken from article.cls {-0.5em}% default taken from article.cls {\normalfont\normalsize\bfseries}% default taken from article.cls } % % Utility to start a new paragraph with some standard lengths. % % #1 is indent, #2 is skip, #3 is formatting of the label. % % The default values are copied from article.cls. % \def\ueb@startsubparagraph#1#2#3{% \@startsection{subparagraph}{5}% {#1}% {3.25ex \@plus1ex \@minus .2ex}% {#2}% {#3}% } % % Utility to start a new paragraph with spacing and indent if #1 is non-empty (it's meant % to be the subparagraph label). % \def\ueb@startsubparagraphSpaceIfNotEmpty#1{% \ueb@ifnotempty{#1}{% % % In case we have a non-empty label % \gdef\ueb@tmp@dostartsection{% \ueb@startsubparagraph{\parindent}{-1em}{\normalfont\normalsize\bfseries}% }% }{% % % In case we have an empty Label, don't start a subparagraph but simply a new % paragraph, with some small additional space. This is needed because otherwise % {loesung} blocks that start with \begin{exenumerate} with no exercise text add % waaaayy too much space between the exercise heading and the first item of the list. % % Also, if you wish to further reduce the space................................. % \gdef\ueb@tmp@dostartsection{% % %\ueb@startsubparagraph{\z@}{\z@}{}% % \par% \vspace{\ueb@subparagraphwithemptylabelparspace}% }% }% % \ueb@tmp@dostartsection% % } % % Hack... see above. this is the amount of space left after a 'loesungsubparagraph' with % an empty label. % \def\ueb@subparagraphwithemptylabelparspace{1em} % % Define what kind of paragraph (or sectioning command) to use for the beginning of a % `loesung' environment. % \newcommand{\ueb@loesungsubparagraph}{% \ueb@startsubparagraphSpaceIfNotEmpty{\ueb@TheUebungSolLabel}% } % % Define what kind of paragraph (or sectioning command) to use for the beginning of a % `tips' environment. % \newcommand{\ueb@tipssubparagraph}{% \ueb@startsubparagraphSpaceIfNotEmpty{\ueb@TheUebungTipsLabel}% } % % Hooks for new exercises % \def\ueb@preuebunghook{} \def\ueb@uebunghook{} \def\ueb@presubuebunghook{} \def\ueb@subuebunghook{} % % Use \ueb@AtUebung{ commands ... } and \ueb@AtSubUebung{ ... } to execute arbitrary % commands at the beginning of a new exercise or a new sub-exercise. These commands are % inspired by \def\AtBeginDocument in latex.ltx. % \def\ueb@AtBeforeUebung{\g@addto@macro\ueb@preuebunghook} \def\ueb@AtUebung{\g@addto@macro\ueb@uebunghook} \def\ueb@AtBeforeSubUebung{\g@addto@macro\ueb@presubuebunghook} \def\ueb@AtSubUebung{\g@addto@macro\ueb@subuebunghook} % ---- % Commands for new exercise and sub-exercise % ---- % Some internal utilities first. % % Format an annotation to an exercise. For example, the number of points that are awarded % for successfully completing the exercise. % \newcommand{\ueb@exerciseannot}[1]{% % {\vspace*{-1.2em}\begin{flushright}\footnotesize\emph{[#1]}\end{flushright}\vspace*{-1ex}}% { \def\annot{\uebExerciseAnnotation{#1}} \setbox0=\hbox{\annot}% \setbox1=\hbox{[with short annotation]}% reference width for "short annotation" \ifdim\wd0<\wd1% % short annotation: can be displayed on the same line % {% this code taken from http://tex.stackexchange.com/questions/16330 \unskip\nobreak\hfil\penalty50 \hskip1em\hbox{}\nobreak\hfil\annot% \parfillskip=0pt \finalhyphendemerits=0\par% }% \else% % longer annotation: use new line \\[1pt]% {\vbox{\raggedleft\annot}}% \fi% }% } % % Set this macro to some short text. The width of this text will be used as reference to % what is considered a "short annotation" (ie., which will be displayed on the same line) % \def\ueb@shortannotationreftextwidth{[short annotation]} % % % Commands to issue to pin down a number to this exercise. essentially refsteps's % uebcounter. This also sets \uebTheUebungNumber to the current \theuebcounter. % \newcommand{\ueb@numberthisuebung}{% % % Step the exercise number counter. % \refstepcounter{uebcounter}% % % Automatically assign an internal label to this exercise. See also % \ueb@labelforthisexercise. % \expandafter\label{\ueb@labelforthisexercise}% % \let\uebTheUebungNumber\theuebcounter% % }% % % To be called for exercises without number (\uebung*{}). Also sets \uebTheUebungNumber to % an empty macro. % \newcommand{\ueb@thisuebungnonumber}{% % % \uebung*{}: don't number this uebung. % \def\uebTheUebungNumber{}% % } % *** Exercise *** % % LaTeX Command for an *exercise title* such as "Exercise 1.". Implemented based on LaTeX % \paragraph{} stuff. % % Usage is \uebung{} % \uebung*{} % \uebung{}[] % \uebung*{}[] % \newcommand{\uebung}{% % % Produce a warning if the \uebung or \exercise command is misplaced % \ifdefined\ueb@marker@WarnOn@exercise% \PackageWarning{ethuebung}{% **** Misplaced \protect\uebung, your exercise might not appear on all versions (ex, sol, tips) of the sheet: \ueb@marker@WarnOn@exercise.% }% \else% \fi% % % Use latex' \@ifstar. Choose the correct corresponding \@uebungstar or \@uebung macro. % \@ifstar{\@uebungstar}{\@uebung}% % } % % % \newcommand{\@uebung}[1]{% % % Save the uebung title % \def\ueb@uebzetitle{#1}% % % % Set up usual Uebung numbering % \def\ueb@doThisUebungNumber{\ueb@numberthisuebung}% % % And start the exercise, taking into account the possible annotation that might be % there. \ueb@startuebung is a macro that takes an optional argument. % \ueb@startuebung% % } \newcommand{\@uebungstar}[1]{% % % Save the uebung title % \def\ueb@uebzetitle{#1}% % % Set up no numbering % \def\ueb@doThisUebungNumber{\ueb@thisuebungnonumber}% % % And start the exercise, taking into account the possible annotation that might be % there. \ueb@startuebung is a macro that takes an optional argument. % \ueb@startuebung% % } % % Start a new exercise, using the optional argument as annotation, and \ueb@uebzetitle as % exercise title. % % \uebung will expand to this macro, once it has consumed the exercise title. This is % needed so that the optional annotation can be given _after_ the exercise title. % \newcommand{\ueb@startuebung}[1][]{% \def\ueb@theexannotation{#1}% \expandafter\@@uebung{\ueb@uebzetitle}% } % % % Start a new exercise. % \newcommand{\@@uebung}[1]{% % % % Run custom-set commands for pre-exercise, if any. % \ueb@preuebunghook% % % % in case we're providing {exenumerate}, reset the counter to restart from (a). Note % that this command is defined also if we don't provide {exenumerate} environment as a % no-op. % \exenumeratereset% % % % Prepare the commands that we will run in the uebung label. This involves incrementing % the exercise counter. (We have to do this in the label, not before, because otherwise % we might \refstepcount{} the counter just before a page break. Even \leavevmode does % not help always because \paragraph{} usually adds some space.) % \def\ueb@tmp@fulluebunglabelarg{% % % Set an exercise number, and set the \ueb@ThisUebungNumber to \theuebcounter. If % \uebung*{} was used, then this command will not do anything and set % \ueb@ThisUebungNumber to an empty value. % \ueb@doThisUebungNumber{}% % % Display the exercise label. % \uebTheUebungLabel% }% % % Now actually start the LaTeX \paragraph{} and display the title of the exercise. Don't % forget to protect \ueb@tmp@fulluebunglabelarg because it is a fragile command!! % \ueb@uebparagraph{\protect\ueb@tmp@fulluebunglabelarg{}}{\ueb@TheExTitleFont{#1}}% % % % If there is an annotation, display it % \ueb@ifnotempty{\ueb@theexannotation}{\ueb@exerciseannot{\ueb@theexannotation}}{}% % % % Make sure we start a new paragraph, don't continue on the same line as the exercise % title. % \par% % % % Run custom-set commands, if any. % \ueb@uebunghook% % } % % In case this command gets taken into TOC or anywhere else... % \def\ueb@tmp@fulluebunglabelarg{} % % define \exercise as alias for \uebung % \def\exercise{\uebung} % *** Sub-Exercise *** % % Like for \uebung{}. % \newcommand{\subuebung}[1]{% % % Start a new sub-exercise. % % % Produce a warning if the \subuebung or \subexercise command is misplaced % \ifdefined\ueb@marker@WarnOn@exercise% \PackageWarning{ethuebung}{% **** Misplaced \protect\subuebung, your sub-exercise might not appear on all versions (ex, sol, tips) of the sheet: \ueb@marker@WarnOn@exercise.% }% \else% \fi% % % Run custom-set commands for pre-sub-exercise, if any. % \ueb@presubuebunghook% % % % in case we're providing {exenumerate}, reset the counter to restart from (a). % \exenumeratereset% % % Step the sub-exercise number counter. % \refstepcounter{subuebcounter}% % % Assign an automatic label to this exercise. See also \ueb@labelforthisexercise. % \expandafter\label{\ueb@labelforthisexercise}% % % % Now actually start the LaTeX \subparagraph{} (or whatever) and display the title of % the exercise. % % To change the label displayed, use e.g. \UebungSubLabel{Aufgabe}, you don't have to % change this source file % \ueb@subuebsubparagraph{\uebTheUebungSubLabel}{\ueb@TheSubExTitleFont{#1}}\hspace*{3ex}% % % Don't force a new paragraph, in case the user wants to continue on the same % line. The user can still force a newline simply by leaving an empty line after \subuebung{}. % % % Run custom set commands, if any % \ueb@subuebunghook% % } % % define \subexercise as alias for \subuebung % \def\subexercise{\subuebung} % % Keywords for exercises. This is a dummy command: it will only serve as placeholder for % external tools that will scan the LaTeX file. This command itself expands to nothing. % \newcommand{\keywords}[1]{} % ---- % Two utilities (intended for the solutions): an environment that discard its contents and % an environment that simply shows it normally. % ---- % % This will be used as building block for {loesung}, {onlymusterloesung} % etc. environments. % \newsavebox{\ueb@thecontentsthatwillbediscarded} \newenvironment{uebhidecontents}{% begin hide contents environment % % create a box to hold the contents, and then we'll discard it % \setbox\ueb@thecontentsthatwillbediscarded=\vbox\bgroup% % % Define a marker so that we know that we're inside a {uebhidecontents} environment. % \def\ueb@marker@In@uebhidecontents{}% \providecommand\ueb@marker@WarnOn@exercise{within \protect\begin{notuebungsblatt}...\protect\end{notuebungsblatt} environment (or such)}% % % Redefine some LaTeX commands to no-ops to avoid some warnings and errors like % "undefined reference"'s, or "float lost". % \let\ref\ueb@killarg% \def\figure{}\def\endfigure{}% \def\table{}\def\endtable{}% \let\caption\relax% % % This allows labels to be produced in AUX file even if they are hidden. Useful, e.g., % for equations within {onlyuebungsblatt} that you want to reference from the solutions. % \let\ueb@old@write\write% \def\write{\immediate\ueb@old@write}% % }{% % end defs % \egroup% close the group % } \newenvironment{uebshowcontents}{% dummy environment that just displays its contents. \bgroup% % % Define a marker so that we know that we're inside a {uebshowcontents} environment. % \def\ueb@marker@In@uebshowcontents{}% \providecommand\ueb@marker@WarnOn@exercise{within \protect\begin{onlyuebungsblatt}...\protect\end{onlyuebungsblatt} environment (or such)}% % }{ %end defs \egroup% } % ---- % Counters for equations in different contexts. % ---- \renewcommand{\theequation}{\uebExerciseEqLabel} % % Creates definitions for a new `equation context' such as for solutions or for tips % parts. % % For example, % \ueb@makeeqcontext{loesung}{L.\arabic{equation}} % will define the command \ueb@eqcontext@loesung, which you can call to enter 'loesung' % equation context with equations numbered L.1, L.2, etc. % % Remember to call \ueb@eqcontext@<...> within a LaTeX group ( with braces, % {\ueb@eqcontext@<...> ... } , or with \bgroup\ueb@eqcontext@<...> ... \egroup ), so that % the original equation definitions are restored afterwards. % \def\ueb@makeeqcontext#1#2{% \edef\ueb@tmp@eqcontextcountername{uebeq#1}% \expandafter\newcounter{\ueb@tmp@eqcontextcountername}% \expandafter\def\csname ueb@eqcontext@#1\endcsname{% \expandafter\let\expandafter\c@equation\csname c@uebeq#1\endcsname% \renewcommand{\theequation}{#2}% \ueb@makeeqcontext@redefHequation{#1.\arabic{equation}}% for hyperref % }% }% \def\ueb@makeeqcontext@redefHequation#1{} % will be defined when importing hyperref % % For {loesung} sections % \ueb@makeeqcontext{loesung}{\uebLoesungEqLabel} % % For {tips} sections % \ueb@makeeqcontext{tips}{\uebTipsEqLabel} % ---- % Solutions environments % ---- % *** Solution *** % % Define two environments, showloesung and hideloesung. One of these two will be aliased % to {loesung} to display or to hide loesung contents. % % % A base environment that sets up font and equation numbering and encloses everything into % a group. This is used also for \begin{onlymusterloesung}...\end{onlymusterloesung} etc. % \newenvironment{showloesungenv}{% % begin shown loesung environment % % % Enclose everything inside \bgroup ... \egroup, so that definitions stay local to the % environment. % \bgroup% % % Define a marker so that we know that we're inside a {showloesungenv} environment. % \def\ueb@marker@In@showloesungenv{}% \providecommand\ueb@marker@WarnOn@exercise{within \protect\begin{loesung}...\protect\end{loesung} environment}% % % Setup the font for the loesung % \ueb@TheLoesungFont% \let\normalsize\ueb@TheLoesungFont% % % Setup equation numbering. % \ueb@eqcontext@loesung% % }{% end loesung-type environment defs % % This \par is needed to fix line spacing of the last paragraph in the loesung % environment. % \par% % %\ueb@setueb% this is not needed since our redefinitions of equation numbering are % enclosed inside a \bgroup ... \egroup \egroup% }% % % An environment that displays its contents, with a small label, a special font and proper % equation numbering. % \newenvironment{showloesung}{% % % Set ourselves in a loesung-type environment % \showloesungenv% % % Define a marker so that we know that we're inside a {showloesung} environment. This is % inside a \bgroup...\egroup so these definitions are local to the environment. % \def\ueb@marker@In@showloesung{}% \def\ueb@marker@WarnOn@exercise{within \protect\begin{loesung}...\protect\end{loesung} environment}% % % Display the label, and start the LaTeX (sub)paragraph % \ueb@loesungsubparagraph{\ueb@TheUebungSolLabel}% font is already in effect %\ueb@loesungsubparagraph{\ueb@TheLoesungFont{\ueb@TheUebungSolLabel}}% % % If we're outside an {exenumerate} environment, reset it so that the exenumerate that % will be in the solution starts from (a) again. % \ifdefined\@enumctr\else% \exenumeratereset% Reset {exenumerate} counter \fi% % }{% end loesung environment defs % \endshowloesungenv% % \vspace{\uebLoesungEndVSpace}% % } % % An environment that discards all its contents. Loesung equation numbering is set up so % as not to mess up surrounding equation numbering if there are equations in the % contents. % \newenvironment{hideloesung}{% % % begin hidden loesung environment % % % Use {uebhidecontents} environment defined above. % \uebhidecontents% % % Enclose everything inside \bgroup ... \egroup % \bgroup% % % Define a marker so that we know that we're inside a {hideloesung} environment. % \def\ueb@marker@In@hideloesung{}% \def\ueb@marker@WarnOn@exercise{within \protect\begin{loesung}...\protect\end{loesung} environment}% % % The equations will still be processed and assigned numbers, but just not displayed! % \ueb@eqcontext@loesung% % % }{% end loesung environment defs % % % Close the \bgroup ... \egroup % \egroup% % %\ueb@setueb% this is not needed since our redefinitions of equation numbering are % enclosed inside a \bgroup ... \egroup % % Close the {uebhidecontents} environment % \enduebhidecontents% % } % % define \begin{loesung}...\end{loesung} as in exercise sheet mode, i.e. just hide its % solutions content. This will be overwritten by the \UebungMakeSolutionsSheet command. % This makes \begin{loesung}...\end{loesung} an alias of the {hideloesung} envionment. % \def\loesung{\hideloesung} \def\endloesung{\endhideloesung} % % define \begin{solution}...\end{solution} as an alias of the {loesung} environment, % whichever that one actually is in the end (show or hide solutions). Use \def and not % \let because the meaning of {loesung}/\loesung might change. % \def\solution{\loesung} \def\endsolution{\endloesung} % ---- % Solutions provided as PDF Attachments (eg. scanned handwritten solutions) % ---- % % solution as PDF attachment: the pdf pages are inserted at the end of the document, and % referred to appropriately. The inserted pages are superimposed with a title referring to % which exercise those pages offer a solution to. % % % Define a counter for the attached solutions, to identify different attached % solutions. Used for creating labels at where the solutions are included. % \newcounter{uebattachedsolutionscounter} \setcounter{uebattachedsolutionscounter}{0} % % internal sequence of commands for including a PDF solution at end of document % % Usage: \ueb@solattached@AtEndDocumentCommands% % {\ueb@labelforthisexercise}% % {\ueb@labelforthisexercisepart}% % {}% % {<\includepdf options>} % \def\ueb@solattached@AtEndDocumentCommands#1#2#3#4{% \def\ueb@solattached@labelforthisexercise{#1}% \def\ueb@solattached@labelforthisexercisepart{#2}% \def\ueb@solattached@pdftoinclude{#3}% \def\ueb@solattached@pdfincludeoptions{#4}% % \def\ueb@solattached@theexercise{\expandafter\ref{\ueb@solattached@labelforthisexercise}}% \def\ueb@solattached@theexercisepart{\expandafter\ref{fullexpart:\ueb@solattached@labelforthisexercisepart}}% \def\uebattachedsolutiontheexercisenumber{\ueb@AttachSolutionTheExerciseNumber}% % \setlength\unitlength{1pt}% \includepdf[pagecommand={% \ueb@AttachSolutionIncludepdfPageCommand% },% picturecommand*={% % add the label to the first page of our solutions \refstepcounter{uebattachedsolutionscounter}\expandafter\label{solattached:\ueb@solattached@labelforthisexercisepart}% % add any custom overlay stuff to the first page only \ueb@AttachSolutionIncludepdfPictureCommandStar% }, % picturecommand={% % add overlay stuff to each included page; this is by default our title \ueb@AttachSolutionIncludepdfPictureCommand% }, #4]% those where the options to \includepdf[]{} {\ueb@solattached@pdftoinclude}% the pdf file to include }% % % The command that will actually implement \pdfloesung. This takes care of inserting some % loesung text with a reference to the page on which the PDF is included, and takes care % of inserting proper \AtEndDocument{} stuff for PDF inclusion. % % Usage: \pdfloesung[<\includepdf options>]{} % \pdfloesung{} % \newcommand{\ueb@dopdfloesung}[2][pages={-}]{% % % Insert some text that we're attaching the solution to this exercise at the end of the % sheet, and mark the given PDF file for inclusion at end of document. % % Attach a label here. % \expandafter\label{\ueb@labelforthisexercisepart}% % % If we're inside an {exenumerate} environment, then pin a label to this exercise part. % \ifueb@haveexenum% \expandafter\ueb@exenumfulllabel{fullexpart:\ueb@labelforthisexercisepart}% \else\fi% % % Display some text inviting the user to look at the end of the document at e.g. a % specific page number. % \begin{loesung}% \def\uebthepageattached{\expandafter\pageref{solattached:\ueb@labelforthisexercisepart}}% {\ueb@TheTextAttachedSolution}% \end{loesung}% % % % define a specific macro (identified by the PDF file name..... ugh!) for including the % PDF at the end of the file, keeping the current values (pdf file, ex #, label) % \expandafter\xdef\csname AtEndDocCmds@#2\endcsname{% \noexpand\ueb@solattached@AtEndDocumentCommands% {\ueb@labelforthisexercise}% {\ueb@labelforthisexercisepart}% {#2}% {#1}% }% % % and now mark that macro to be called at the end of the document. % \expandafter\AtEndDocument{\csname AtEndDocCmds@#2\endcsname}% % } % % Define a no-op command that describes how \pdfloesung{} should function when not in % solutions sheet mode. % \newcommand{\ueb@hidepdfloesung}[2][pages={-}]{} % % By default, \pdfloesung does nothing. This is overwritten by \UebungMakeSolutionsSheet. % \def\pdfloesung{\ueb@hidepdfloesung} \def\pdfsolution{\ueb@hidepdfloesung} % % These lengths will be where the text of the superimposed title will be placed on the PDF % pages. % \newlength{\uebattachedsoltitlex} \newlength{\uebattachedsoltitley} % % A shorthand for a sequence of {picture} commands that will display a suitable title on % the top of the attached solutions PDF pages. % \def\ueb@AttachSolutionDefaultTitlePictureCommand{% \setlength\unitlength{1pt}% \setlength{\uebattachedsoltitlex}{0.5\paperwidth}% \setlength{\uebattachedsoltitley}{\paperheight}% \addtolength{\uebattachedsoltitley}{-\ueb@LengthAttachedSolutionTitleTop}% % \put(\strip@pt\uebattachedsoltitlex,\strip@pt\uebattachedsoltitley){% \makebox(0,0)[c]{% % TITLE for this solutions page \ueb@TheAttachedSolutionTitleFont{\ueb@TheAttachedSolutionTitle}% }% }% % \put(5,5){\line(1,0){\strip@pt\uebattachedsoltitlex}} % DEBUG % \put(5,5){\line(0,1){\strip@pt\uebattachedsoltitley}} % DEBUG } % ---- % Switching between exercise and solutions sheet. % ---- % % conditionals for use in the exercise sheet. % % \ifmusterloesung ... \else ... \fi % \ifuebungsblatt ... \else ... \fi % \newif\ifmusterloesung \musterloesungfalse \newif\ifuebungsblatt \uebungsblatttrue % % \begin{onlymusterloesung} ... \end{onlymusterloesung} and % \begin{notmusterloesung} ... \end{notmusterloesung} % % By default, prepare as for an exercise sheet. % \def\onlymusterloesung{\hideloesung} \def\endonlymusterloesung{\endhideloesung} \def\notmusterloesung{\uebshowcontents} \def\endnotmusterloesung{\enduebshowcontents} % % \begin{onlyuebungsblatt} ... \end{onlyuebungsblatt} % % By default, prepare as for an exercise sheet. % \def\onlyuebungsblatt{\uebshowcontents} \def\endonlyuebungsblatt{\enduebshowcontents} \def\notuebungsblatt{\uebhidecontents} \def\endnotuebungsblatt{\enduebhidecontents} % % define English terminology version as aliases to the above. Use \def because the % meaining of \onlymusterloesung etc. might change (obviously, since we could become the % solutions sheet instead of an exercise sheet). % % \begin{onlysolutions} ... \end{onlysolutions} % \begin{onlyexercisesheet} ... \end{onlyexercisesheet} % \def\onlysolutions{\onlymusterloesung} \def\endonlysolutions{\endonlymusterloesung} \def\onlyexercisesheet{\onlyuebungsblatt} \def\endonlyexercisesheet{\endonlyuebungsblatt} \def\notsolutions{\notmusterloesung} \def\endnotsolutions{\endnotmusterloesung} \def\notexercisesheet{\notuebungsblatt} \def\endnotexercisesheet{\endnotuebungsblatt} % % This command holds the title "keyword" of the exercise or solutions sheet. This will by % default be either "Series" or "Solutions", but these labels can be customized with % \UebungsblattTitleSeries{...} and \UebungsblattTitleSolutions{...}. % % By default, we define this as the "series" label; this will be overwritten in % \UebungMakeSolutionsSheet to display the "solutions" label instead. % \newcommand{\uebUebungsBlattTitle}{\ueb@TheUebungsblattTitleSeries} % % Command to change the behavior of this sheet and turn it into a solutions sheet. Now the % {loesung} environment will be redefined to display its contents, as well as % \ifmusterloesung, {onlymusterloesung} and {onlyuebungsblatt} % % % ### TODO: Instead of redefining here all loesung commands, why not define all loesung % commands with inner conditionals \ifmusterloesung ? % ### ... but that's less efficient, and it's cleaner this way... % \newcommand{\UebungMakeSolutionsSheet}{% % % Set us in solutions mode, setup the conditionals correctly. % \musterloesungtrue% \uebungsblattfalse% % % The title of the sheet has to be changed to refer to the defined solution sheet title % and not the defined exercise sheet title. % \renewcommand{\uebUebungsBlattTitle}{\ueb@TheUebungsblattTitleSolutions}% % % We need to redefine the loesung commands to show the solutions instead of hiding % them. % % This makes \begin{loesung}...\end{loesung} an alias of the {showloesung} envionment. % \def\loesung{\showloesung}% \def\endloesung{\endshowloesung}% % % define \pdfloesung and \pdfsolution for attached solutions % \def\pdfloesung{\ueb@dopdfloesung}% \def\pdfsolution{\ueb@dopdfloesung}% % % define \begin{onlymusterloesung}...\end{onlymusterloesung} to show contents % \def\onlymusterloesung{\showloesungenv}% \def\endonlymusterloesung{\endshowloesungenv}% \def\notmusterloesung{\uebhidecontents}% \def\endnotmusterloesung{\enduebhidecontents}% % % and define \begin{onlyuebungsblatt}...\end{onlyuebungsblatt} to hide contents % \def\onlyuebungsblatt{\uebhidecontents}% \def\endonlyuebungsblatt{\enduebhidecontents}% \def\notuebungsblatt{\uebshowcontents}% \def\endnotuebungsblatt{\enduebshowcontents}% % } % ---- % Tips sections % ---- % % A base environment that sets up font and equation numbering and encloses everything into % a group. This is used also for \begin{onlytipssheet}...\end{onlytipssheet} etc. % \newenvironment{showtipsenv}{% % begin shown tips environment % % % Enclose everything inside \bgroup ... \egroup, so that definitions stay local to the % environment. % \bgroup% % % Define a marker so that we know that we're inside a {showtipsenv} environment. % \def\ueb@marker@In@showtipsenv{}% \providecommand\ueb@marker@WarnOn@exercise{within \protect\begin{onlytips}...\protect\end{onlytips} environment (or such) }% % % Setup the font for the tips % \ueb@TheTipsFont% \let\normalsize\ueb@TheTipsFont% % % Setup equation numbering. % \ueb@eqcontext@tips% % }{% end tips-type environment defs % % This \par is needed to fix line spacing of the last paragraph in the tips % environment. % \par% % %\ueb@setueb% this is not needed since our redefinitions of equation numbering are % enclosed inside a \bgroup ... \egroup \egroup% }% % % An environment that displays its contents, with a small label, a special font and proper % equation numbering. % \newenvironment{showtips}{% % % Set ourselves in a tips-type environment % \showtipsenv% % % Define a marker so that we know that we're inside a {showtips} % environment. {showtipsenv} ensures a \bgroup ... \egroup, so these definitions are % local to the environment. % \def\ueb@marker@In@showtips{}% \def\ueb@marker@WarnOn@exercise{within \protect\begin{tips}...\protect\end{tips} environment}% % % Display the label, and start the LaTeX (sub)paragraph % \ueb@tipssubparagraph{\ueb@TheUebungTipsLabel}% font is in effect already %\ueb@tipssubparagraph{\ueb@TheTipsFont{\ueb@TheUebungTipsLabel}}% % % If we're outside an {exenumerate} environment, reset it so that the exenumerate that % will be in the solution starts from (a) again. % \ifdefined\@enumctr\else% \exenumeratereset% Reset {exenumerate} counter \fi% % }{% end tips environment defs % \endshowtipsenv% % \vspace{\uebTipsEndVSpace}% % } % % An environment that discards all its contents. Tips equation numbering is set up so % as not to mess up surrounding equation numbering if there are equations in the % contents. % \newenvironment{hidetips}{% % % begin hidden tips environment % % % Use {uebhidecontents} environment defined above. % \uebhidecontents% % % Enclose everything inside \bgroup ... \egroup % \bgroup% % % Define a marker so that we know that we're inside a {hidetips} environment. % \def\ueb@marker@In@hidetips{}% \def\ueb@marker@WarnOn@exercise{within \protect\begin{nottipssheet}...\protect\end{nottipssheet} environment (or such) }% % % The equations will still be processed and assigned numbers, but just not displayed! % \ueb@eqcontext@tips% % % }{% end tips environment defs % % % Close the \bgroup ... \egroup % \egroup% % % % Close the {uebhidecontents} environment % \enduebhidecontents% % } % % define \begin{tips}...\end{tips} as in exercise sheet mode, i.e. just hide its tips % content. This will be overwritten by the \UebungMakeTipsSheet command. This makes % \begin{tips}...\end{tips} an alias of the {hidetips} envionment. % \def\tips{\hidetips} \def\endtips{\endhidetips} % % define \begin{tipps}...\end{tipps} as an alias of the {tips} environment, % whichever that one actually is in the end (show or hide solutions). Use \def and not % \let because the meaning of {tips}/\tips might change. % \def\tipps{\tips} \def\endtipps{\endtips} % % Conditional to check if we're compiling a tips sheet % \newif\iftipssheet \tipssheetfalse % % \begin{onlytipssheet} ... \end{onlytipssheet} and % \begin{nottipssheet} ... \end{nottipssheet} % % By default, prepare as for an exercise sheet. % \def\onlytipssheet{\hidetips} \def\endonlytipssheet{\endhidetips} \def\nottipssheet{\uebshowcontents} \def\endnottipssheet{\enduebshowcontents} % % Command to change the behavior of this sheet and turn it into a tips sheet. Now the % {tips} environment will be redefined to display its contents, as well as % \iftipssheet, {onlytipssheet}. % % This command does not alter \ifmusterloesung or \ifuebungsblatt. The only interference % with the \UebungMakeSolutionsSheet is setting the main title of the sheet. % \newcommand{\UebungMakeTipsSheet}{% % % Set us in tips mode, setup the conditionals correctly. % \tipssheettrue% \uebungsblattfalse% % % The title of the sheet has to be changed to refer to the defined solution sheet title % and not the defined exercise sheet title. % \renewcommand{\uebUebungsBlattTitle}{\ueb@TheUebungsblattTitleTips}% % % We need to redefine the tips commands to show the tips instead of hiding them. % % This makes \begin{tips}...\end{tips} an alias of the {showtips} envionment. % \def\tips{\showtips}% \def\endtips{\endshowtips}% % % define \begin{onlytipssheet}...\end{onlytipssheet} to show contents % \def\onlytipssheet{\showtipsenv}% \def\endonlytipssheet{\endshowtipsenv}% \def\nottipssheet{\hidetips}% \def\endnottipssheet{\endhidetips}% % % % and define \begin{onlyuebungsblatt}...\end{onlyuebungsblatt} to hide contents % \def\onlyuebungsblatt{\uebhidecontents}% \def\endonlyuebungsblatt{\enduebhidecontents}% \def\notuebungsblatt{\uebshowcontents}% \def\endnotuebungsblatt{\enduebshowcontents}% % % } % ---- % Hints text % ---- % % Provides a simple paragraph with a `Hint' title (or whatever you told % \UebungHinweisLabel{}) with the contents in a special font. % % Customize the paragraph appearance & setting by redefining \uebHinweisParagraph{}{}. % \newcommand{\hinweis}[1]{\uebHinweisParagraph{\ueb@TheHinweisLabel}{#1}} % % Same as \hinweis, except displays the title `Hints' by default. Use this if there is % more than one hint provided. Of couse, you can customize the label with % \UebungHinweiseLabel{}. % % Customize the paragraph appearance & setting by redefining \uebHinweisParagraph{}{}. % \newcommand{\hinweise}[1]{\uebHinweisParagraph{\ueb@TheHinweiseLabel}{#1}} % % Define \hint and \hints to be aliases for \hinweis and \hinweise % \def\hint{\hinweis} \def\hints{\hinweise} % ---- % exenumerate environment for exercise parts % ---- % % The {exenumerate} environment acts like an {enumerate} environment, with some convenient % presets being preconfigured. % % In case you worry about enumitem.sty compatibility, or you need the older enumerate % package (but you shouldn't, because we use [shortlabels]{enumitem} which should emulate % the enumerate package), you can pass the package option `noexenum' and the package % enumitem.sty will not be imported and the environment {exenumerate} will not be % defined. % % % This is called by \uebung{} to reset the exenumerate list. However, it must be defined % only if we are caring about exenumerates. It is properly defined in % \ueb@defineEnumerates. % \newcommand{\exenumeratereset}{} % % A conditional that will tell us if we have defined {exenumerate} environment, or if the % user has specified the `noexenum' package option inhibiting the definition of % {exenumerate} and the inclusion of enumitem.sty. % \newif\ifueb@haveexenum \ueb@haveexenumfalse % *** Define {exenumerate} environments and related utilities *** % % Definitions for \begin{enumerate}, \begin{exenumerate} etc. and use the {enumitem} % package with [shortlabels]. % \newcommand{\ueb@defineEnumerates}{ % % Set our conditional tester to TRUE, ie. \ifueb@haveexenum will now report true. % \ueb@haveexenumtrue % % Include the enumitem.sty package. The `shortlabels' option emulates the older % `enumerate.sty' package that has more convenient label definitions. % \RequirePackage[shortlabels]{enumitem} % % This is an internal command to reset the exenumerate counter to start from % (a). Otherwise, the enumerate command resumes any previous listings, which is useful % to include some text between exercise parts. % % This is called in \uebung{} and \subuebung{} to reset the counter to (a). % % These commands are stolen from a newer enumitem.sty file since ours is too old to be % able to use \restartlist{...} % \renewcommand{\exenumeratereset}{% \let\enit@resume@exenumerate\@empty% } % *** \begin{exenumerate}...\end{exenumerate} environment *** % % A simple {enumerate} environment with (a), (b), ... labeling (customizable) % \newlist{exenumerate}{enumerate}{3} % % Set up the exenumerate environment with enumitem settings. Obey settings set by % \UebungLabelEnum{} and \UebungLabelEnumSub{}. % \def\ueb@setlistexenumerateone##1{\setlist[exenumerate,1]{##1}} \def\ueb@setlistexenumeratetwo##1{\setlist[exenumerate,2]{##1}} \expandafter\ueb@setlistexenumerateone{label=\ueb@TheUebungLabelEnum,% ref=\ueb@TheUebungLabelEnumRef, resume} \expandafter\ueb@setlistexenumeratetwo{label=\ueb@TheUebungLabelEnumSub,% ref=\ueb@TheUebungLabelEnumSubRef} \let\ueb@orig@exenumerate\exenumerate \def\exenumerate{\par\ueb@orig@exenumerate} % % This command is meant to act like a \label{} command, except that: % - if inside an exenumerate environment, it stores the full reference to the current % exercise part, for example `(c)' or `(c) (ii)'. % - if outside of an exenumerate environment, it simply stores an empty string. % \newcommand{\ueb@exenumfulllabel}[1]{% {% % all is enclosed within a LaTeX group so that \theexenumerateii is restored at the % end of this command. \ifdefined\@enumctr% % WE ARE INSIDE AN exenumerate ENVIRONMENT % \@enumctr is defined: we are inside an exenumerate environment \def\theexenumerateii{\ueb@TheUebungLabelEnumSubRefCombined}% \expandafter\addtocounter{\@enumctr}{-1}% cancel next counter step \expandafter\refstepcounter{\@enumctr}% \label{##1}% \else% % WE ARE OUTSIDE OF AN exenumerate ENVIRONMENT % use exenumerate counter as dummy for setting empty ref. We could have done this % certainly much more properly but the effect is the same... THIS IS UGLY. \def\theexenumeratei{}% \addtocounter{exenumeratei}{-1} % cancel effect of \refstepcounter{} \refstepcounter{exenumeratei}% \label{##1}% \fi% % all is enclosed within a LaTeX group so that \theexenumerateii is restored. }% } % % Still provide \exenumfulllabel for backwards compatibility % \let\exenumfulllabel\ueb@exenumfulllabel % % But first of all provide \exenumfull\label{} syntax. % \def\exenumfull\label##1{% \ueb@exenumfulllabel{##1}% } } % % Some auxiliary definitions for \exstarred ... % \def\ueb@exstarred@makecase#1#2{% \expandafter\def\csname ueb@exstarred@case@\string#1\endcsname{#2}% } \ueb@exstarred@makecase{\item}{\ueb@exstarred@item} \ueb@exstarred@makecase{\uebung}{\ueb@exstarred@uebung} \ueb@exstarred@makecase{\exercise}{\ueb@exstarred@uebung} \ueb@exstarred@makecase{\subuebung}{\ueb@exstarred@subuebung} \ueb@exstarred@makecase{\subexercise}{\ueb@exstarred@subuebung} \def\ueb@exstarred@labelexenumeratei{% \expandafter\ueb@withstarredcounters[\ueb@TheStarredSymbol]{\ueb@old@labelexenumeratei}% } \def\ueb@exstarred@theuebcounter{\ueb@old@theuebcounter{}\ueb@TheStarredSymbol} \def\ueb@exstarred@thesubuebcounter{\ueb@old@thesubuebcounter{}\ueb@TheStarredSymbol} % % \exstarred for starred exercises/subexercises/items % \def\exstarred#1{% % % Produce friendly warning in case a wrong argument is provided % \ifcsname ueb@exstarred@case@\string#1\endcsname\else% \PackageWarning{ethuebung}{**** Cannot produced starred version of unknown command `\protect#1'}% \fi% % % Specialize to our specially-written command % \csname ueb@exstarred@case@\string#1\endcsname% } \def\ueb@exstarred@item{% \let\ueb@old@labelexenumeratei\labelexenumeratei% % \let\labelexenumeratei\ueb@exstarred@labelexenumeratei% % \item% \let\labelexenumeratei\ueb@old@labelexenumeratei% } \def\ueb@exstarred@uebung#1{% \def\ueb@exstarred@uebung@title{#1}% \ueb@exstarred@uebung@maybeannot% } \newcommand{\ueb@exstarred@uebung@maybeannot}[1][]{% \let\ueb@old@theuebcounter\theuebcounter% \let\theuebcounter\ueb@exstarred@theuebcounter% % \expandafter\uebung{\ueb@exstarred@uebung@title}[#1]% \let\theuebcounter\ueb@old@theuebcounter% } \def\ueb@exstarred@subuebung#1{% \let\ueb@old@thesubuebcounter\thesubuebcounter% \let\thesubuebcounter\ueb@exstarred@thesubuebcounter% % \subuebung{#1}% \let\thesubuebcounter\ueb@old@thesubuebcounter% } % ---- % page geometry % ---- % % This will set up the geometry correctly. This is done after package options are % processed. % \newcommand{\ueb@setgeometry}{% \RequirePackage{geometry}% % and set some margins nicely \setlength{\parindent}{0pt}% \setlength{\parskip}{3mm}% \setlength{\baselineskip}{6mm}% \setlength{\textheight}{24cm}% \setlength{\topmargin}{-1.5cm}% \setlength{\evensidemargin}{0cm}% \setlength{\oddsidemargin}{0cm}% \setlength{\textwidth}{16cm}% } % ---- % The Document Header % ---- % % Define a hook for the beginning of the exercise sheet, after the header % \def\ueb@hook@sheettop{}% % % Call \ueb@AtBeginSheet{ cmds... } to add commands to be executed at the beginning of the % sheet, after the header is displayed. % \def\ueb@AtSheetTop{\g@addto@macro\ueb@hook@sheettop} % % The main command that will draw the document header. % % Some vertical space is first left, as set in \uebHeaderTopVSpace. Then % \ueb@displayheader is called. Then more vertical space as set in \uebHeaderBelowVSpace % is added. % \newcommand{\MakeUebungHeader}{% draw the exercises document header % % First, leave some vertical space % \vspace*{\uebHeaderTopVSpace}% % % Then, display the header, as defined by \ueb@displayheader. If you want to customize % the header entirely, redefine \ueb@displayheader. (Of course, it's easier to redefine % certain components of the header, see \uebHeaderLogo etc.) % \noindent\ueb@displayheader% % % Leave some space after the header. % \vspace*{\uebHeaderBelowVSpace}% % % \global\@topnum\z@% Prevents figures from going at top of page. % % % Finally, execute custom commands that have to be executed at the beginning of the % sheet. % \ueb@hook@sheettop% } % % A utility command that will draw a simple header with three "columns", inserting % \uebHeaderLogo, \uebHeaderCenter and \uebHeaderRight in three respective minipages of % respective widths \uebHeaderLogoWidth, \uebHeaderCenterWidth, \uebHeaderRightWidth. % Then a horizontal line is drawn, after a vertical spacing of \uebHeaderMidVSpace. % % When customizing the header appearance, you may redefine this command instead of % \MakeUebungHeader to already have top & bottom vertical spacing set up. % \newcommand{\ueb@displayheader}{% % % Display the full header. % \begin{minipage}{\textwidth}% % % The main header, with logo and title and everything % \begin{minipage}[b]{\uebHeaderLogoWidth}{\uebHeaderLogo}\end{minipage}% \begin{minipage}[b]{\uebHeaderCenterWidth}{\uebHeaderCenter}\end{minipage}% \begin{minipage}[b]{\uebHeaderRightWidth}{\uebHeaderRight}\end{minipage}% \vspace*{\uebHeaderMidVSpace}% % % A horizontal line under the main header % \ueb@headerHRule% % % "Due by" and other sub-header line stuff % \ueb@subHeaderLine% % \end{minipage} } % % The H-Rule produced under the main header. By default, just a \hrule. % \def\ueb@headerHRule{\hrule} % % Display the "due by" line, or other annotations, under the header (sub-header line), if % there is any contents at all to be displayed. % \newcommand{\ueb@subHeaderLine}{% \ueb@ifnotempty{\ueb@subHeaderLine@content@l\ueb@subHeaderLine@content@c\ueb@subHeaderLine@content@r}{% \ueb@do@subHeaderLine% }{}% } % % The "due by" line, or other annotations, under the header % \newcommand{\ueb@do@subHeaderLine}{% % % Skip some space under the main hrule % \vspace*{\ueb@subHeaderLine@skiptop}% % % Set internal length register to 1/3 (approx) of page width, this will be the width of % each \makebox{} for each of the sub-header line parts % \setlength{\ueb@subHeaderLine@partwidth}{0.33\textwidth}% % {% %\par% % % Set the required font % \ueb@TheSubHeaderLineFont% % % Definitions on the left % \makebox[\ueb@subHeaderLine@partwidth][l]{\ueb@subHeaderLine@content@l}% \hfill% % % Definitions in the center % \makebox[\ueb@subHeaderLine@partwidth][c]{\ueb@subHeaderLine@content@c}% \hfill% % % Definitions on the right % \makebox[\ueb@subHeaderLine@partwidth][r]{\ueb@subHeaderLine@content@r}% }% % % Skip some space at the bottom. Since there is usually already quite a lot of space % skipped, just skip back one line to avoid too much space. See % \ueb@subheaderLine@skipbottom, defined by default to -\baselineskip. % \vspace*{\ueb@subHeaderLine@skipbottom}% } % % Some helpers: % % % Space just below the header hrule to skip % \def\ueb@subHeaderLine@skiptop{1ex}% % % content of left part of sub-header line (Use \UebungSubHeader[l]{...} or % \UebungSubHeaderPar[l]{...}) % \def\ueb@subHeaderLine@content@l{\ueb@ifnotempty{\ueb@TheDiscussion}{\uebDiscussion}{}} % % content of center part of sub-header line (Use \UebungSubHeader[c]{...} or % \UebungSubHeaderPar[c]{...}) % \def\ueb@subHeaderLine@content@c{} % % content of right part of sub-header line (Use \UebungSubHeader[c]{...} or % \UebungSubHeaderPar[c]{...}) % \def\ueb@subHeaderLine@content@r{\ueb@ifnotempty{\ueb@TheDueBy}{\uebDueBy}{}} % % Space to skip below the sub-header line % \def\ueb@subHeaderLine@skipbottom{-\baselineskip} % % Internal helper. (will be set to 1/3 of the page width inside the sub-header line) % \newlength\ueb@subHeaderLine@partwidth % % Deprecated. Use \ueb@subHeaderLine instead. % \newcommand{\ueb@headerDueByLine}{% \PackageWarning{ethuebung}{**** \protect\ueb@headerDueByLine is deprecated! Please use \protect\ueb@subHeaderLine instead!}% \ueb@subHeaderLine% } % ---- % Some compositions that form up part of the exercise or solutions sheet. % ---- % % The amount of spacing that should be left under the center title (to shift it vertically % with respect to logo & right column text) % \newlength{\ueb@LengthTitleCenterVSpacing} % % The spacing between the top of the paper and the title on attached pdf pages. % \newlength{\ueb@LengthAttachedSolutionTitleTop} \newcommand{\ueb@AttachSolutionIncludepdfPageCommand}{\thispagestyle{plain}} \newcommand{\ueb@AttachSolutionIncludepdfPictureCommandStar}{% % commands to add overlay stuff to first page of included pdf only. see also % \ueb@AttachSolutionIncludepdfPictureCommand for overlay stuff on each included page. % % by default we don't overlay anything specific extra on first page. to customize, % redefine this command to add more \put(){..} instructions. % % Note that an internal \label{} is automatically added to the first page of an attached % document, regardless of whether this command was redefined or not. } \newcommand{\ueb@AttachSolutionIncludepdfPictureCommand}{% \ueb@AttachSolutionDefaultTitlePictureCommand% } \newcommand{\ueb@AttachSolutionTheExerciseNumber}{% \ueb@solattached@theexercise{}\ueb@maybespace{\ueb@solattached@theexercisepart}% } \newcommand{\ueb@TheUebungLabelEnumSubRefCombined}{% \ueb@TheUebungLabelEnumRef{}~\ueb@TheUebungLabelEnumSubRef% } % ---- % Customization Commands % ---- % % These commands are documented in the official documentation. :) % % commands to customize all possible stuff, fonts, labels, text etc. \newcommand{\UebungLoesungFont}[1]{\def\ueb@TheLoesungFont{#1}} \newcommand{\UebungHinweisFont}[1]{\def\ueb@TheHinweisFont{#1}} \newcommand{\UebungExTitleFont}[1]{\def\ueb@TheExTitleFont{#1}} \newcommand{\UebungSubExTitleFont}[1]{\def\ueb@TheSubExTitleFont{#1}} \newcommand{\UebungTipsFont}[1]{\def\ueb@TheTipsFont{#1}} \newcommand{\UebungLabel}[1]{\def\ueb@TheUebungLabel{#1}} \newcommand{\UebungSubLabel}[1]{\def\ueb@TheUebungSubLabel{#1}} \newcommand{\UebungLabelEnum}[1]{% % \def\ueb@TheUebungLabelEnum{#1}% {% \ueb@defexpandexenumeratecounters{exenumeratei}% \xdef\ueb@temp@uebungLabelEnumRef{\ueb@TheUebungLabelEnum}% }% \let\ueb@TheUebungLabelEnumRef\ueb@temp@uebungLabelEnumRef% } \newcommand{\UebungLabelEnumSub}[1]{% \def\ueb@TheUebungLabelEnumSub{#1}% {% \ueb@defexpandexenumeratecounters{exenumerateii}% \xdef\ueb@temp@uebungLabelEnumSubRef{\ueb@TheUebungLabelEnumSub}% }% \let\ueb@TheUebungLabelEnumSubRef\ueb@temp@uebungLabelEnumSubRef% } \newcommand{\UebungSolLabel}[1]{\def\ueb@TheUebungSolLabel{#1}} \newcommand{\UebungHinweisLabel}[1]{\def\ueb@TheHinweisLabel{#1}} \newcommand{\UebungHinweiseLabel}[1]{\def\ueb@TheHinweiseLabel{#1}} \newcommand{\UebungSolEquationLabel}[1]{\def\ueb@TheSolEquationLabel{#1}} \newcommand{\UebungTipsLabel}[1]{\def\ueb@TheUebungTipsLabel{#1}} \newcommand{\UebungTipsEquationLabel}[1]{\def\ueb@TheTipsEquationLabel{#1}} \newcommand{\UebungsblattTitleSeries}[1]{\def\ueb@TheUebungsblattTitleSeries{#1}} \newcommand{\UebungsblattTitleSolutions}[1]{\def\ueb@TheUebungsblattTitleSolutions{#1}} \newcommand{\UebungsblattTitleTips}[1]{\def\ueb@TheUebungsblattTitleTips{#1}} \newcommand{\UebungsblattNumber}[1]{\def\theUebungsblattNumber{#1}} \newcommand{\UebungsblattTitleFont}[1]{\def\ueb@TheUebungsblattTitleFont{#1}} \newcommand{\UebungTitleCenterVSpacing}[1]{\setlength\ueb@LengthTitleCenterVSpacing{#1}} \newcommand{\UebungAttachedSolutionTitleTop}[1]{\setlength\ueb@LengthAttachedSolutionTitleTop{#1}} \newcommand{\UebungAttachedSolutionTitleFont}[1]{\def\ueb@TheAttachedSolutionTitleFont{#1}} \newcommand{\UebungAttachedSolutionTitle}[1]{\def\ueb@TheAttachedSolutionTitle{#1}} \newcommand{\UebungTextAttachedSolution}[1]{\def\ueb@TheTextAttachedSolution{#1}} \newcommand{\UebungDueByLabel}[1]{\def\ueb@TheDueByLabel{#1}} \newcommand{\UebungDueBy}[1]{\def\ueb@TheDueBy{#1}} \newcommand{\UebungDiscussionLabel}[1]{\def\ueb@TheDiscussionLabel{#1}} \newcommand{\UebungDiscussion}[1]{\def\ueb@TheDiscussion{#1}} \newcommand{\UebungSubHeaderLineFont}[1]{\def\ueb@TheSubHeaderLineFont{#1}} \newcommand{\UebungStarredSymbol}[1]{\def\ueb@TheStarredSymbol{#1}} \newcommand{\UebungSubHeader}[2][c]{% \expandafter\def\csname ueb@subHeaderLine@content@#1\endcsname{#2}% }% % helpers: \def\ueb@subHeaderLine@pardefs@l{\raggedright} % par settings for left subheader part \def\ueb@subHeaderLine@pardefs@c{\centering} % par settings for center subheader part \def\ueb@subHeaderLine@pardefs@r{\raggedleft} % par settings for right subheader part \newcommand{\UebungSubHeaderPar}[2][c]{% \expandafter\def\csname ueb@subHeaderLine@content@#1\endcsname{% \parbox{\textwidth}{% \csname ueb@subHeaderLine@pardefs@#1\endcsname% #2% }% }% }% % course-specific \newcommand{\UebungLecture}[1]{\def\theUebungLecture{#1}} \def\theUebungProf{} \newcommand{\UebungProf}[1]{% % If we already have a value, append new value \ueb@ifnotempty{\theUebungProf}{% % \let\oldUebungProf\theUebungProf% % \xdef\ueb@tmp@theUebungProf{\oldUebungProf{}\par #1}% \let\ueb@t@UebungProf\theUebungProf% \g@addto@macro\ueb@t@UebungProf{\ueb@JoinProfs #1}% \global\let\ueb@tmp@theUebungProf\ueb@t@UebungProf% }{% \gdef\ueb@tmp@theUebungProf{#1}% } \let\theUebungProf\ueb@tmp@theUebungProf% } \def\UebungLecturer{\UebungProf} % \UebungLecturer is an alias of \UebungProf \def\theUebungLecturer{\theUebungProf} % \theUebungLecturer is an alias of \theUebungProf \newcommand{\ueb@JoinProfs}{\\[-1pt]} \newcommand{\UebungSemester}[1]{\def\theUebungSemester{#1}} % Possibility to change the logo \newcommand{\UebungLogoFile}[1]{% \renewcommand{\uebHeaderLogo}{\includegraphics[width=\textwidth]{#1}}% } % customizeable compositions % -------------------------- % don't use \theuebcounter, because it will fail for \uebung*{}. \newcommand{\uebTheUebungLabel}{\ueb@maybespacebetween{\ueb@TheUebungLabel}{\uebTheUebungNumber}.} \newcommand{\uebTheUebungSubLabel}{\ueb@maybespaceafter{\ueb@TheUebungSubLabel}\thesubuebcounter.} \newcommand{\uebExerciseEqLabel}{\arabic{equation}} \newcommand{\uebLoesungEqLabel}{\ueb@TheSolEquationLabel\arabic{uebeqloesung}} \newcommand{\uebTipsEqLabel}{\ueb@TheTipsEquationLabel\arabic{uebeqtips}} \newcommand{\uebHinweisParagraph}[2]{\par {\ueb@TheHinweisFont #1\hspace*{2mm} #2}} \newcommand{\uebSerieTitle}{\uebUebungsBlattTitle\ueb@maybespace{\theUebungsblattNumber}.} \newcommand{\uebHeaderLogo}{\ETHLogo} \newcommand{\uebHeaderCenter}{% \begin{center}{% \ueb@TheUebungsblattTitleFont% \makebox[0pt][c]{\theUebungLecture}\\[1mm]% \uebSerieTitle% \vspace*\ueb@LengthTitleCenterVSpacing% }% \end{center}% } \newcommand{\uebHeaderRight}{% \begin{flushright}% \theUebungSemester\\% \theUebungLecturer% \end{flushright}% } \newcommand{\uebDueBy}{\ueb@TheDueByLabel{}: \ueb@TheDueBy} \newcommand{\uebDiscussion}{\ueb@TheDiscussionLabel{}: \ueb@TheDiscussion} \newcommand{\uebExerciseAnnotation}[1]{\footnotesize\textit{[#1]}} % customizeable lengths & adjustments \newcommand{\uebHeaderTopVSpace}{-15mm} \newcommand{\uebHeaderMidVSpace}{2mm} \newcommand{\uebHeaderBelowVSpace}{2mm} \newcommand{\uebHeaderLogoWidth}{.25\textwidth} \newcommand{\uebHeaderCenterWidth}{.50\textwidth} \newcommand{\uebHeaderRightWidth}{.2499\textwidth} \newcommand{\uebLoesungEndVSpace}{3mm} \newcommand{\uebTipsEndVSpace}{3mm} % ---- % Locale & Language Settings % ---- % % define the corresponding language settings % \def\ueb@curlanguage{English} \def\ueb@loadbabel@English{% \RequirePackage[english]{babel}% \selectlanguage{english}% } \def\ueb@loadbabel@Deutsch{% \RequirePackage[german]{babel}% \selectlanguage{german}% } % % Internal conditional to remember if the user wanted us to load the babel package for % him/her. % \newif\if@uebwantbabel \@uebwantbabeltrue % % Language change command. % % the optional argument is the babel name for the given language. % \newcommand{\UebungLanguage}[1]{% % % load appropriate babel definitions, if needed % % ###: use \ifpackageloaded:babel first here, to make sure to include babel only if it's % not already been included? % \if@uebwantbabel% \ifcsname ueb@loadbabel@#1\endcsname\csname ueb@loadbabel@#1\endcsname% \else% \PackageWarning{ethuebung}{**** Can't load babel definitions for unknown language `#1'}% \fi% \else% \fi% % % % Now actually load our language definitions % \ueb@UebungLanguage{#1}% % } % % Language change command, without loading babel package. % \newcommand{\ueb@UebungLanguage}[1]{% % % no longer in previous language % \ifdefined\ueb@curlanguage% % % redefine the previous iflang-helper to show second argument (`else') % \expandafter\def\csname ueb@iflang@\ueb@curlanguage\endcsname##1##2{##2}% \fi% % % Remember this language in our internal language setting % \def\ueb@curlanguage{#1}% % % and define a iflang-helper for \ueb@iflanguage, which simply displays its first % argument. % \expandafter\def\csname ueb@iflang@\ueb@curlanguage\endcsname##1##2{##1}% % % % Now, call the definitions needed to setup the language % \ifcsname ueb@setlanguage@#1\endcsname% % if the language definition is there, call it \csname ueb@setlanguage@#1\endcsname% \else% % otherwise, it's a package warning. \PackageWarning{ethuebung}{**** Unknown language `#1'.}% \fi% % } % % Conditionally include code depending on current language. % % USAGE: \ueb@iflanguage{}{}{} % e.g.: \ueb@iflanguage{Deutsch}{auf Deutsch}{this is not in german} % \newcommand{\ueb@iflanguage}[3]{% % % if an iflang-helper is defined, then we may be in that language % \ifcsname ueb@iflang@#1\endcsname% % % use the if-helper % \csname ueb@iflang@#1\endcsname{#2}{#3}% % \else % % otherwise, we're not in that language: expand to `else' part % #3% \fi% % } % ---- % Default settings, labels and fonts % ---- % % labels & definitions that are specific to English % \newcommand{\ueb@setlanguage@English}{% % % FOR ANYONE THINKING ABOUT MODIFYING THESE LABELS HERE: Just copy the relevant line below % in your own LaTeX file, before \begin{document}, and change the label there. % % Please don't edit this file! (See warning at top of file.) % \UebungLabel{Exercise}% \UebungSubLabel{}% \UebungSolLabel{Solution.}% \UebungHinweisLabel{Hint.}% \UebungHinweiseLabel{Hints.}% \UebungSolEquationLabel{S.}% \UebungTipsLabel{Tips.}% \UebungTipsEquationLabel{T.}% \UebungsblattTitleSeries{Series}% \UebungsblattTitleSolutions{Solutions}% \UebungsblattTitleTips{Tips}% \UebungDueByLabel{Due by}% \UebungDiscussionLabel{Discussion}% % \UebungAttachedSolutionTitle{Solution to Exercise~\uebattachedsolutiontheexercisenumber.}% \UebungTextAttachedSolution{The solution to this exercise is attached on page~\uebthepageattached.}% % } % % labels & definitions specific to German % \newcommand{\ueb@setlanguage@Deutsch}{% % % FOR ANYONE THINKING ABOUT MODIFYING THESE LABELS HERE: Just copy the relevant line below % in your own LaTeX file, before \begin{document}, and change the label there. % % Please don't edit this file! (See warning at top of file.) % \UebungLabel{\"Ubung}% \UebungSubLabel{}% \UebungSolLabel{L\"osung.}% \UebungHinweisLabel{Hinweis.}% \UebungHinweiseLabel{Hinweise.}% \UebungSolEquationLabel{L.}% \UebungTipsLabel{Tipps.}% \UebungTipsEquationLabel{T.}% \UebungsblattTitleSeries{\"Ubungsblatt}% \UebungsblattTitleSolutions{Musterl\"osung}% \UebungsblattTitleTips{Tipps}% \UebungDueByLabel{Abgabe}% \UebungDiscussionLabel{Besprechung}% % \UebungAttachedSolutionTitle{L\"osung zu der \"Ubung~\uebattachedsolutiontheexercisenumber.}% \UebungTextAttachedSolution{Die L\"osung dieser \"Ubung finden Sie im Anhang auf der Seite~\uebthepageattached.}% } % % FOR ANYONE THINKING ABOUT MODIFYING THESE SETTINGS HERE: Just copy the relevant line % below in your own LaTeX file, before \begin{document}, and change the setting there. % % Please don't edit this file! (See warning at top of file.) % \UebungLoesungFont{\def\baselinestretch{1.1}\footnotesize} \UebungHinweisFont{\small\itshape} \UebungExTitleFont{\bfseries\itshape} \UebungSubExTitleFont{\bfseries\itshape} \UebungTipsFont{\small\itshape} \UebungTitleCenterVSpacing{0mm} \UebungAttachedSolutionTitleTop{1.3\baselineskip} \UebungAttachedSolutionTitleFont{\bfseries\small\underline} \UebungLabelEnum{(\alph*)} % cf enumitem pkg doc. \alph*,\Alph*,\roman*,\Roman*,\arabic* \UebungLabelEnumSub{(\roman*)} \UebungsblattTitleFont{\large\bfseries} \UebungDueBy{} \UebungDiscussion{} \UebungSubHeaderLineFont{\small} \UebungStarredSymbol{*} % % Set the English definitions by default. This does not load the babel package. These % definitions will be overwritten if the language is german in the options processing % section or with \UebungLanguage{} % \ueb@UebungLanguage{English} % % these should be redefined in the exercise sheet TeX file % \UebungLecture{Topics in Traditional Swiss Cheese-based Meals.} %\UebungProf{} % don't provide default, since the values append \UebungSemester{Summer 1905} % at the time LaTeX was really fashionable. %\UebungLogoFile{} % graphics file for custom logo instead of ETH (PDF or PNG for pdflatex; EPS for dvips) % uebungsblatt number. by default, provide a package warning that it is not set by the % exercise sheet TeX file. \UebungsblattNumber{$\langle$Not Defined$\rangle$% \PackageWarning{ethuebung}{**** The exercise sheet number was not set. Use the command % \protect\UebungsblattNumber{N} to set it. --}% } % ---------------------------------------------------------------- % RATHER SIMPLE STYLE ENGINE % -------------------------- % % Command to set style. This just looks for a command called \uebstyle@