8

I just want one section to be renumbered, not all the \parts numbering.

I have found this in the manual:

\renewcommand{\thepartno}{\Roman{partno}}

But that is making all the numbering for \part to be Roman.

I can't find in the manual where to just have it renumber for a certain section.

\documentclass[a4paper]{exam}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{paralist}
\usepackage{enumerate}
\renewcommand{\thepartno}{\Roman{partno}}

\begin{document}
\smallskip
\begin{questions}
\question Which of the following is continuous at $x = 0$ ?
\begin{center}
    \begin{parts}
    \part $f\left(x\right) = \vert x \vert$
    \part $f\left(x\right) = e^{x}$
    \part $f\left(x\right) = \ln\left(e^{x} - 1 \right)$
    \end{parts}
\end{center}
\begin{oneparchoices}
\choice I only
\choice II only
\choice I and II only
\choice II and III only
\choice none
\end{oneparchoices}

\begin{solution}
\end{solution}
\vspace{\stretch{2}}
\end{questions}
\end{document}
Werner
  • 603,163
MaoYiyi
  • 1,135
  • 1
  • 11
  • 20
  • Instead of adding quotes to the code lines, just select the whole code block and press Ctrl-K or click on the {} icon above the box. – egreg Nov 07 '12 at 00:24

1 Answers1

10

You can use

\renewcommand{\thepartno}{\Roman{partno}}

inside the parts environment to keep the change local:

\documentclass[a4paper]{exam}

\begin{document}

\begin{questions}
\question Which of the following is continuous at $x = 0$ ?
    \begin{parts}
\renewcommand{\thepartno}{\Roman{partno}}
    \part $f\left(x\right) = \vert x \vert$
    \part $f\left(x\right) = e^{x}$
    \part $f\left(x\right) = \ln\left(e^{x} - 1 \right)$
    \end{parts}
\question Which of the following is continuous at $x = 0$ ?
    \begin{parts}
    \part $f\left(x\right) = \vert x \vert$
    \part $f\left(x\right) = e^{x}$
    \part $f\left(x\right) = \ln\left(e^{x} - 1 \right)$
    \end{parts}
\end{questions}


\end{document}

enter image description here

As a side note, you can use the \label, \ref mechanism to avoid manual numbering:

\documentclass[a4paper]{exam}

\begin{document}

\begin{questions}
\question Which of the following is continuous at $x = 0$ ?
    \begin{parts}
\renewcommand{\thepartno}{\Roman{partno}}
    \part\label{abs} $f\left(x\right) = \vert x \vert$
    \part\label{exp} $f\left(x\right) = e^{x}$
    \part\label{log} $f\left(x\right) = \ln\left(e^{x} - 1 \right)$
    \end{parts}
\begin{oneparchoices}
\choice \ref{abs} only
\choice \ref{exp} only
\choice \ref{abs} and~\ref{exp} only
\choice \ref{exp} and~\ref{log} only
\choice none
\end{oneparchoices}
\end{questions}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128