# Using tocloft to make a list of questions and remarks

This a follow-up on my previous question Using environ to make a list of environments?

Eventually I ended up with the following code using tocloft. I have tried to make it a MWE.

\documentclass[11pt]{scrartcl}

\usepackage{amsmath, amsthm}
%% Begin question thingies
\usepackage{tocloft} % http://ctan.org/pkg/tocloft
\newtheorem{xquestion}{Question}
\newtheorem{xremark}[xquestion]{Remark}
\newcommand\listxquestionsname{List of Remarks and Questions}
\newlistof{questionsandremarks}{qlist}{\listxquestionsname}
\newcommand\qdescription[1]{%
{\protect\makebox[2.5em][l]{{Q.}~\hfill\thexquestion\hspace{12pt}}#1}}
\newcommand\qdescriptionu[1]{%
{\protect\makebox[2.5em][l]{\textit{{Q.}}~\hfill\thexquestionu\hspace{12pt}}#1}}
{\protect\makebox[2.5em][l]{{R.}~\hfill\thexremark\hspace{12pt}}}}
\newenvironment{question}[1][]{\begin{xquestion}\qdescription{#1}}{\end{xquestion}}
\newenvironment{questionu}[1][]{\begin{xquestionu}\qdescriptionu{#1}}{\end{xquestionu}}
\setlength{\cftafterqlisttitleskip}{\parskip}
\renewcommand{\cftafterqlisttitle}{\\[\baselineskip] A cursive \textit{Q} means that this entry is about a question that is not (yet) answered in the text.}
%% End question thingies

\begin{document}
\begin{questionu}[A test]
Here is my question.
\end{questionu}

\begin{remark}
I also like to make remarks!
\end{remark}
\end{document}


I believe there are some issues with the number which is not properly aligned. How can I fix that?

So, now my question: is this good practice or am I doing it wrong? Furthermore, a bigger problem is the numbering of \thex.... They don't seem to be properly aligned. How do I change the dotted line to say something else (perhaps nothing)? Hitting me with good code hygiene is more than welcome as well! Furthermore, how do I properly wrap the description if it becomes longer than a line?

-

1. To correct the alignment of the counters, you can move the \hspace outside the \makebox.
2. To suppress the dots you can redefine \cftquestionsandremarksdotsep to be \cftnodots.
3. I would suggest to control the \makeboxes width and the value for the horizontal space after them, by using defined lengths; in that way, a unique change will assure consistency for the three entry types.
4. Using \cftsetindents you can control the indentation for the entries.

\documentclass[11pt]{scrartcl}
\usepackage{amsmath, amsthm}
\usepackage{tocloft}

%% Begin question thingies
\newtheorem{xquestion}{Question}
\newtheorem{xremark}[xquestion]{Remark}

\newcommand\listxquestionsname{List of Remarks and Questions}
\newlistof{questionsandremarks}{qlist}{\listxquestionsname}

\newlength\Labelwidth
\newlength\AfterLabelspace
\setlength\Labelwidth{2em}
\setlength\AfterLabelspace{10pt}

\newcommand\qdescription[1]{%
{\protect\makebox[\Labelwidth]{Q.\hfill\thexquestion}%
\protect\makebox[\AfterLabelspace]{}#1}}
\newcommand\qdescriptionu[1]{%
{\protect\makebox[\Labelwidth]{\textit{Q}.\hfill\thexquestion}%
\hspace{\AfterLabelspace}#1}}
{\protect\makebox[\Labelwidth]{R.\hfill\thexquestion}%
\hspace{\AfterLabelspace}}}

\newenvironment{question}[1][]{\begin{xquestion}\qdescription{#1}}{\end{xquestion}}
\newenvironment{questionu}[1][]{\begin{xquestionu}\qdescriptionu{#1}}{\end{xquestionu}}

\setlength{\cftafterqlisttitleskip}{\parskip}
\renewcommand{\cftafterqlisttitle}{\\[\baselineskip] A cursive \textit{Q} means that this entry is about a question that is not (yet) answered in the text.}

% suppress the dots in the new list
\renewcommand\cftquestionsandremarksdotsep{\cftnodots}
% set the proper indentation for the entries
\cftsetindents{questionsandremarks}{0em}{\dimexpr\Labelwidth+\AfterLabelspace\relax}

%% End question thingies

\begin{document}

\listofquestionsandremarks

\begin{questionu}[A test unanswered question with a description spanning more than one line in the list of remarks and questions]
Here is my question.
\end{questionu}