General ⇒ Questions and Solutions
Questions and Solutions
\item {Question}{Solution}
And then "tell" latex to only print out the questions (without solutions) for the study guide and then to print out only solutions (without the questions) when I'm creating the solution manual.
However, I'm still relatively new to latex and I don't know if this capability exists. So, I'm wondering if there's some built-in function or something I could add on to do this. If anyone can point me in the right direction, I'd appreciate it. Thanks!
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 90
- Joined: Fri Nov 06, 2009 7:29 am
Questions and Solutions
I think this (messy) code should do what you want:
Code: Select all
\newcommand{\answers}{yes} %put 'yes' if you want answers displayed or leave blank if you don't want answers displayed
\newcommand{\questions}{yes} %put 'yes' if you want questions displayed or leave blank if you don't want questions displayed
\newcommand{\question}[4]{\ifthenelse{\equal{\questions}{yes}}{\textbf{#1} #2\newline}{} \ifthenelse{\equal{\answers}{yes}}{\textbf{#3} #4\newline}{}}
\question{Question 1}{question goes here}{Answer to Question 1}{answer goes here}
\question{Question 2}{question goes here}{Answer to Question 2}{answer goes here}
All you do is set questions or answers to 'yes' and they will display.
You can add counters and things to get the numbering right, but this will allow you to turn the questions and answers on or off.
There is probably a better way, but this will work

Hope that helps
Questions and Solutions
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/