add tag
JeT
Based on https://tex.stackexchange.com/questions/352734/how-to-turn-an-exam-document-into-a-beamer-document, I have the general principle to toggle between `exam` and `beamer`. I need to make sure to `\renewenvironment `for commands that are in one class and not the other.

Extending this, I now try to integrate my exams/cases into my `book` workflow (with lockdowns and remote classes, my written exams are obsolete, but their content is still useful). 

My problem is that `\part` are both in `book` and `exam` class and that I use `part` in the book. But in `exam`, `\part` can be used as a part for sectioning like in `book`, **or** like an `\item` in `\begin{parts}` environment.

`\newcommand{\part}[1][1]{ \item  }` is  obviously what NOT to do. But what shall I do ?

PS : https://github.com/XaF/exam/blob/master/exam.cls for the definitions of \parts in `exam` class. Reference is made to `\newcommand\partshook{}`. Then I am stuck.


MWE
```
%\documentclass{exam}
\documentclass{book}
 \newenvironment{questions}{
  \begin{enumerate}}{\end{enumerate}}
 \newenvironment{parts}{
  \begin{enumerate}}{\end{enumerate}}
 \newcommand{\question}[1][1]{\item  }
% \newcommand{\part}[1][1]{ \item  } %<- obviously what NOT to do

\begin{document}

\part{First part}
\chapter{List of questions}
\section{First set of questions}
\begin{questions}
 
 \question first one
 %\begin{parts}
 %\part subquestion 1
 %\part subquestion 2
 %\end{parts}
 \question second one
 \question third one
 
 
\end{questions}

\end{document}
```

Top Answer
samcarter
You could redefine the `\part` macro just inside your `parts` environment:

```
%\documentclass{exam}
\documentclass{book}
 \newenvironment{questions}{
  \begin{enumerate}}{\end{enumerate}}
 \newenvironment{parts}{
  \begin{enumerate}\renewcommand{\part}[1][1]{\item  }}{\end{enumerate}}
 \newcommand{\question}[1][1]{\item  }
 


\begin{document}

\part{First part}
\chapter{List of questions}
\section{First set of questions}
\begin{questions}
 
 \question first one
 \begin{parts}
 \part subquestion 1
 \part subquestion 2
 \end{parts}
 \question second one
 \question third one
 
 
\end{questions}

\part{First part}
\chapter{List of questions}
\section{First set of questions}

\end{document}
```

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.