2

I've been trying to use the below code and anything inside the solution block doesn't show up. Any idea why?

\documentclass{exam}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{amsthm}

\begin{document}
\begin{questions}{}
\question test q?
\begin{solution}
    test ans
\end{solution}
\end{questions}
\end{document}
2
  • 1
    You need to indicate that you want to pronto the answers, e.g. with \documentclass[answers]{exam}.
    – user194703
    May 7, 2020 at 5:12
  • @Schrödinger'scat Ah that fixed it. If you would like to make that an answer so that it's easier to find for other people, I can mark it as solved.
    – user209429
    May 7, 2020 at 5:13

1 Answer 1

3

You need to indicate that you want to print the answers, e.g. by adding the answers key when loading the class, e.g. \documentclass[answers]{exam}.

\documentclass[answers]{exam}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{amsthm}

\begin{document}
\begin{questions}{}
\question test q?
\begin{solution}
    test ans
\end{solution}
\end{questions}
\end{document}

There are alternatives, you can also just say \printanswers.

You must log in to answer this question.