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 am preparing a Q&A document. I created the image below in MS Word. I was wondering if there is a way this can be accomplished in LaTeX. I want to keep formatting consistent through out the document.

Is there such a template available? If not then how can i create my own templates/ environments

Q&A

share|improve this question
    
There are only one answer per question is it? Should the first words be bold like shown? –  Martin Scharrer May 3 '12 at 15:23
    
Yes there is only one answer per question. If there are more than one answers then it would be displayed starting on a new line. Bold would be nice, increases readability. –  Raama May 3 '12 at 15:29

1 Answer 1

up vote 12 down vote accepted

For something simple like you specified I would go for two simple definitions, \Que and \Ans. For more complicated formatting and features check the answers package.

\documentclass{article}
\usepackage{lipsum}
\newcounter{question}
\setcounter{question}{0}
\begin{document}

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

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

\Que{Here first question would come}
\Ans{\lipsum[1]\lipsum[1]}

\Que{Here second question would come}
\Ans{\lipsum[1]\lipsum[1]}
\end{document}
share|improve this answer
    
thanks a lot for your help –  Raama May 3 '12 at 18:07
    
Thank you for this template. Two thoughts about it: 1) maybe it's better to remove the dot after A for consistency; 2) maybe it's better to change \textbf{#1} #2\par to \textbf{#1}#2\par. This will make sure that the space after the long dash is the same as in the question part. –  Exeleration-G Dec 27 '13 at 15:01
1  
@Exeleration-G Both are good suggestions and there is also more improvements one could add. I just wanted to illustrate that it is fairly easy to build macros for such tasks, rather than spending time to learn the ins and outs of one of the larger packages. Please feel free to edit and improve. –  Yiannis Lazarides Dec 27 '13 at 15:42

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.