Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[12pt,a4paper]{book}
- usepackage{answers}
- usepackage{amsthm}
- usepackage{hyperref}
- usepackage{tcolorbox}
- usepackage{ifthen}
- usepackage{tikz}
- usetikzlibrary{shadows}
- tikzstyle{buttonstyle} = [rectangle, fill = black!30, draw = black!80, drop shadow, font={sffamilybfseries}, text=white]
- newcommand*{button}[1]{tikz{node[buttonstyle] {#1};}}
- theoremstyle{definition}
- newtheorem{ex}{%
- hypertarget{sol:theex}{ } hfill
- hyperlink{ex:theex}{button{Solution}}\
- phantomsection
- }[chapter]
- Newassociation{sol}{Soln}{corr}
- renewenvironment{Soln}[1]
- {parbigskipnoindentphantomsection{bfseries hypertarget{ex:#1}{}
- {bfseries Solution of exercise #1}hfill
- hyperlink{sol:#1}{button{Back to exercise #1}}\}quad}
- {parbigskip}
- % Usage MEExercise[keys]{exercise}{solution}
- newcommandMEExercise[3][]{
- ifthenelse{equal{#3}{}}
- { % The no solution case
- }
- { %Have a solution
- begin{tcolorbox}
- begin{ex}
- #2
- begin{sol}
- #3
- end{sol}
- end{ex}
- end{tcolorbox}
- }
- }
- begin{document}
- chapter{This}
- Opensolutionfile{corr}[ans1]
- section{Problems}
- begin{tcolorbox}
- begin{ex}
- First exercise.
- begin{sol}
- First solution.
- end{sol}
- end{ex}
- end{tcolorbox}
- %MEExercise{this is exercise 1}{this is solution of exercise 1}
- chapter{That}
- %newpage
- begin{ex}
- Second exercise.
- begin{sol}
- Second solution.
- end{sol}
- end{ex}
- %MEExercise{this is exercise 2}{this is solution of exercise 2}
- %newpage
- Closesolutionfile{corr}
- %newpage
- section{Solutions}
- input{ans1}
- end{document}
- begin{Soln}{1.1}
- First solution.
- end{Soln}
- begin{Soln}{1.2}
- this is solution of exercise 1 end {sol} end {ex} end {tcolorbox}
- chapter{That}
- %newpage
- begin{ex}
- Second exercise.
- begin{sol}
- Second solution.
- end{Soln}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement