Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
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 7 '12 at 0:24
add comment

1 Answer

up vote 6 down vote accepted

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

share|improve this answer
    
How did you get the code to be all together? –  MaoYiyi Nov 7 '12 at 0:18
    
@MaoYiyi I am afraid I don't understand your question. Can you please rephrase it? (English is not my native tongue, so I don't understand it as it is now.) –  Gonzalo Medina Nov 7 '12 at 0:22
    
@MaoYiyi: I've corrected it in your original post. If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with {} on it). –  Werner Nov 7 '12 at 0:23
    
@MaoYiyi Ah, now that I see Werner's comment, I understand the question. Werner himself has provided the answer. –  Gonzalo Medina Nov 7 '12 at 0:52
    
@MaoYiyi I added to my answer some recommendation about using \label, and \ref that you might find useful. –  Gonzalo Medina Nov 7 '12 at 1:05
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.