# Is there other possible way for continuous numbering?

I am creating a document using exam class. I have four question types here which i had created each a command. Is there facility to enforce continuous numbering for each question types instead of using the \begin{questions} ended with \end{questions}.

## example:

I. True or False Question type
1. ____ text text text text text text.
2. ____ text text text text text text.
3. ____ text text text text text text.

II. Enumeration
4. Elements of  nature
5. text text text text text text.
6. text text text text text text.


The sequence of the number in Part I is continued in the Part II. How can I make something like this one?

-

Try the enumitem package:

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}
\item First question
\item Second question
\end{enumerate}

Some other stuff...

\begin{enumerate}[resume]
\item More items
\item ...
\end{enumerate}

\end{document}


For more complicated nesting, you might want to use the series option of the package.

-
the enumitem package no longer works when i used the \item command inside the question type truefalse -- new command. \truefalse found in this link tex.stackexchange.com/questions/84646/… –  Kayla Feb 19 at 13:34
I guess in that case, you will have to make a counter of your own. See here for details: personal.ceu.hu/tex/counters.htm (Simply create a new counter and define a command that will return sequential numbers.) –  recluze Feb 19 at 14:00

Simply put \setcounter{tfno}{0} before defining the truefalse environment as in this code:

\documentclass{article}
\usepackage{amssymb,graphicx}
\usepackage{array,enumitem}
\usepackage{longtable}
\newcounter{tfno}
\renewcommand\arraystretch{2}
\newcommand{\mybox}{\resizebox{.5cm}{!}{\raisebox{-.5ex}{$\Box$}}}
%
\setcounter{tfno}{0} %% moved here
\newenvironment{truefalse}{%
%\setcounter{tfno}{0}  %% moved up
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{>{\stepcounter{tfno}\thetfno.}cp{.5\textwidth}@{\extracolsep{\fill}}cc}
\multicolumn{1}{r}{}&  & \fbox{\parbox{.75cm}{True}} & \fbox{\parbox{.75cm}{False}}  \\
}{%
\end{longtable}
}
\newcommand\tfquestion[1]{ & #1 & \mybox  & \mybox  \\}
\begin{document}
\begin{enumerate}[label=\Roman*.]
\item First set of questions
\begin{truefalse}
\tfquestion{This is a sample text.}
\tfquestion{This is another sample short text.}
\tfquestion{This is a long line containing text and wrapping into second line without hitting the boxes}
\end{truefalse}
%
\item Second set comes here.
\begin{truefalse}
\tfquestion{This is a sample text.}
\tfquestion{This is another sample short text.}
\tfquestion{This is a long line containing text and wrapping into second line without hitting the boxes}
\end{truefalse}
\end{enumerate}

\end{document}


-
Is this also possible in using the exam document class especially using the \begin{questions} and \end{questions}? i tried it but when I compiled the file, the number instead proceeding to 7 it started again with 1. What should I do about this? –  Kayla Feb 19 at 15:55
@Kayla Please provide the full code that is giving trouble. –  Harish Kumar Feb 19 at 16:00
Sir, exam.cls is an open source i think. Can be downloaded here ctan.cdpa.nsysu.edu.tw/macros/latex/contrib/exam/exam.cls There you'll find the questions environment \newenvironment{questions}. I don't understand it since it is connected all over other command in the class. –  Kayla Feb 19 at 16:11

If you don't want to have the question numbers start over again from 1, then don't end the questions environment. You can use the standard LaTeX \section command to insert your section headings, and if you enclose the \section command in the argument of a \fullwidth command, it won't be indented. For example, if you type

\documentclass[12pt]{exam}
\begin{document}
\renewcommand{\thesection}{\Roman{section}}
\begin{questions}
\fullwidth{\section{True or false question types}}
\question This is one of the questions.
\question This is one of the questions.
\question This is one of the questions.

\fullwidth{\section{Enumeration}}
\question This is one of the questions.
\question This is one of the questions.
\question This is one of the questions.
\end{questions}
\end{document}


then you'll get

-
not all of the new commands i declared in my own class depends on the questions environment. Some of the new commands can generate sequence of numbers not by using the questions environment. If i will use the questions environment which allows automatic numbering and the commands with automatic numbering together, then conflict or errors may be produced. It is advisable for some but in my case, it is not advisable. –  Kayla Feb 19 at 16:22
Sir i have used the command in the second solution from this thread and your solution using exam Assuming those variables are declared. the output of this code does not follow what supposed to be the order of number in each section/part. \begin{document} \section{First set of questions} \begin{truefalse} \tfquestion{text} \tfquestion{text text text} \tfquestion{text text text} \end{truefalse} \section{Second set comes here.} \begin{questions} \question{text text} \question{text text} \question{text } \end{questions} \end{document} –  Kayla Feb 19 at 16:44
@Kayla: The exam class assumes that all of your questions will be produced by the \question command; if you try to combine the questions environment with some other commands to produce questions, you're looking for trouble. That being said: If you give the command \setcounter{question}{\value{tfno}} immediately following \begin{questions}, then the sequence of question numbers will be as you want. However: Many parts of the exam class (e.g., \ifcontinuation, \ContinuedQuestion, etc.) will not work. –  Phil Hirschhorn Feb 19 at 23:52
is it possible to create an optional command like the \pointsinmargin used by the exam class? and takes by the question types as an optional argument? –  Kayla Feb 19 at 23:54
Sir, is it possible to create an optional command like the \pointsinmargin used by the exam class? and takes by the question types as an optional argument? for example: \enforcednumbering which when used numbers of different question types used where continuous. `part 1: 1,2,3,4 partII: 5,6,7 –  Kayla Feb 20 at 0:04