# Indenting the items in description environment

I have Q & A command that indents the start of the sentence, however using description environment breaks the indentation. How can I indent the description environment?

This is the source code.

\documentclass{article}
\newcounter{question}
\setcounter{question}{0}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\Hrule}{\rule{\linewidth}{0.3mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
\parindent=0pt% don't indent paragraphs in the title block
\centering
{\Large \bfseries\textsc{\@title}}
\HRule\par%
\textit{\@author \hfill \@date}
\par
}
\makeatother% resets the meaning of the at-sign (@)

\newcommand\Que[1]{%
\leavevmode\par
\stepcounter{question}
\noindent
Q\thequestion: \textit{#1}\par}

\newcommand\Ans[2][]{%
\leavevmode\par\noindent
{\leftskip10pt
A: \textbf{#1} #2\par}}

\title{Title}
\author{A and B}

\begin{document}
\maketitle

%\section{MapReduce}
\Que{Q}
\Ans{
A
\begin{description}
\item[X] Y
\end{description}
}

\end{document}

-
Do you mean "how can I indent the description environment"? –  karlkoeller Sep 26 '13 at 16:54
@karlkoeller: Yes. Thanks, I updated my post. –  prosseek Sep 26 '13 at 16:59
How about using lists that you can nest, for example \Que{question}{\A[abc]{xyz}}? This would allow you to turn answers on/off for different versions of the Q&A. –  Werner Sep 26 '13 at 17:45

## 2 Answers

Instead of using the \leftskip approach in the \Ans macro, I instead use a \hspace followed by a \parbox of reduced width.

\documentclass{article}
\usepackage{calc}
\newcounter{question}
\setcounter{question}{0}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\Hrule}{\rule{\linewidth}{0.3mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
\parindent=0pt% don't indent paragraphs in the title block
\centering
{\Large \bfseries\textsc{\@title}}
\HRule\par%
\textit{\@author \hfill \@date}
\par
}
\makeatother% resets the meaning of the at-sign (@)

\newcommand\Que[1]{%
\leavevmode\par
\stepcounter{question}
\noindent
Q\thequestion: \textit{#1}\par}

\newcommand\Ans[2][]{%
\leavevmode\par\noindent
{\hspace*{10pt}\parbox{\linewidth-10pt}{
A: \textbf{#1} #2\par}}}

\title{Title}
\author{A and B}

\begin{document}
\maketitle

%\section{MapReduce}
\Que{Q}
\Ans{
Answer that might be long enough to skip past the end of a line
Answer that might be long enough to skip past the end of a line
Answer that might be long enough to skip past the end of a line
\begin{description}
\item[X] Y
\end{description}
}

\end{document}

-

I would use the idiomatic way: using lists

\newcommand\Ans[2][]{%
\leavevmode\par\noindent
{\begin{list}{}{\setlength{\leftmargin}{10pt}}%
\item[]%
A: %
\textbf{#1} #2\par%
\end{list}%
}}


This way for every \Ans you start a list with a single item (with no label) and you can adjust every margin (see this for example).

I should mention that unlike solutions using parbox here the contents of \Ans can span several pages and are not treated as an unbreakable block.

-
That's a good point about the \parbox limitation. –  Steven B. Segletes Sep 26 '13 at 18:31