Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass{article}
- \usepackage{answers}
- \usepackage{enumitem}
- \usepackage{hyperref}
- \usepackage{multicol}
- \usepackage{changepage}
- \usepackage{etoolbox}
- \newcommand\getcurrentref[1]{%
- \ifnumequal{\value{#1}}{0}
- {??}
- {\the\value{#1}}%
- }
- \hypersetup{colorlinks=true}
- \setlength{\parindent}{0.0mm}
- % very useful during de-bugging!
- %\usepackage[left]{showlabels}
- %\showlabels{hypertarget}
- %\showlabels{hyperlink}
- % solutions files
- % short solutions
- \Opensolutionfile{shortsolutions}
- \Newassociation{shortsolution}{shortSoln}{shortsolutions}
- \Newassociation{short}{shortSolns}{shortsolutions}
- % long solutions
- \Opensolutionfile{longsolutions}
- \Newassociation{longsolution}{longSoln}{longsolutions}
- \Newassociation{longs}{longsSolns}{longsolutions}
- % new environment that sets up hypertargets both in the question
- % section, and in the answer section
- \newlist{myenum}{enumerate}{3}
- \newcounter{question}[subsection]
- \newenvironment{question}[1]%
- {%
- \refstepcounter{question}%
- % hyperlink to solution
- \hypertarget{question:{\thesubsection\thequestion}}{}%
- \Writetofile{shortsolutions}{\protect\hypertarget{shortsoln:\thesubsection\thequestion}{}}%
- \Writetofile{longsolutions}{\protect\hypertarget{longsoln:\thesubsection\thequestion}{}}%
- \begin{myenum}[label=\bfseries\protect\hyperlink{shortsoln:\thesubsection\thequestion}{\thequestion.},ref=\thequestion]
- \item%
- \hypersetup{linkcolor=black}%
- \hyperlink{longsoln:\thesubsection\thequestion}{#1}%
- }%
- {%
- \end{myenum}}
- \newenvironment{IntList}[1]{%
- \Opensolutionfile{mysolutions}
- \centering
- \setlength{\columnsep}{50pt}
- \begin{adjustwidth}{-3em}{-2em}\begin{multicols}{#1}}{\end{multicols}\end{adjustwidth}\Closesolutionfile{mysolutions}}
- \begin{document}
- \section{Problems}
- \subsection{Questions}
- \begin{multicols}{3}
- \begin{short}
- \vspace*{\baselineskip}
- \color{white} hello
- \vspace*{-\baselineskip}
- \end{short}
- \begin{longs}
- \vspace*{\baselineskip}
- \color{white} hello
- \vspace*{-\baselineskip}
- \end{longs}
- \begin{question}{$\int\sqrt{4-x}\mathrm{d}x$}
- \begin{shortsolution}
- $-\frac{2}{3}(4-x)^{\frac{3}{2}}+C$
- \end{shortsolution}
- \begin{longsolution}
- In order to do this, we must first make a substitution\ldots
- \end{longsolution}
- \end{question}
- \begin{question}{$\int(2x-1)^{50}\mathrm{d}x$}
- \begin{shortsolution}
- $\frac{1}{102}(2x-1)^{51}+C$
- \end{shortsolution}
- \begin{longsolution}
- A very long solution| much longer than the shorter solution
- \end{longsolution}
- \end{question}
- \begin{question}{$\int\sqrt[n]{x}\mathrm{d}x$}
- \begin{shortsolution}
- $\frac{n}{n+1}x^{\frac{1+n}{n}}+C$
- \end{shortsolution}
- \begin{longsolution}
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- Even longer!
- \end{longsolution}
- \end{question}
- \end{multicols}
- \subsection{Some more questions}
- \begin{multicols}{3}
- \begin{short}
- \vspace*{\baselineskip}
- \color{white} hello
- \vspace*{-\baselineskip}
- \end{short}
- \begin{longs}
- \vspace*{\baselineskip}
- \color{white} hello
- \vspace*{-\baselineskip}
- \end{longs}
- \begin{question}{$\int\sqrt{4-x}\mathrm{d}x$}
- \begin{shortsolution}
- $-\frac{2}{3}(4-x)^{\frac{3}{2}}+C$
- \end{shortsolution}
- \begin{longsolution}
- hi
- \end{longsolution}
- \end{question}
- \begin{question}{$\int(2x-1)^{50}\mathrm{d}x$}
- \begin{shortsolution}
- $\frac{1}{102}(2x-1)^{51}+C$
- \end{shortsolution}
- \begin{longsolution}
- ho
- \end{longsolution}
- \end{question}
- \begin{question}{$\int\sqrt[n]{x}\mathrm{d}x$}
- \begin{shortsolution}
- $\frac{n}{n+1}x^{\frac{1+n}{n}}+C$
- \end{shortsolution}
- \begin{longsolution}
- lets go
- \end{longsolution}
- \end{question}
- \end{multicols}
- \begin{huge}
- Input files / include files here
- \end{huge}
- % close solution files
- \Closesolutionfile{shortsolutions}
- \Closesolutionfile{longsolutions}
- \clearpage
- \section{SHORT answers}
- % renew the SHORT solution environment so that it hyperlinks back to
- % the question
- \renewenvironment{shortSoln}[1]{%
- % add some glue
- \vskip .5cm plus 2cm minus 0.1cm%
- {\bfseries \hyperlink{question:#1}{#1.}}%
- }%
- {%
- }%
- % input the file if it exists
- \IfFileExists{shortsolutions.tex}{\input{shortsolutions.tex}}{}
- \clearpage
- \section{LONG answers}
- % renew the LONG solution environment so that it hyperlinks back to
- % the question
- \renewenvironment{longSoln}[1]{%
- % add some glue
- \vskip .5cm plus 2cm minus 0.1cm%
- {\bfseries \hypersetup{linkcolor=blue}\hyperlink{question:#1}{#1.}}%
- }%
- {%
- }%
- % input the file if it exists
- \IfFileExists{longsolutions.tex}{\input{longsolutions.tex}}{}
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement