Text FormattingHelp me figure this enumerate problem

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
rob buffalo
Posts: 1
Joined: Tue Dec 21, 2010 10:11 pm

Help me figure this enumerate problem

Post by rob buffalo »

So, I am writing a solutions manual.
Need to have the Question 1 in front of a line and then Answer 1 in front of the other, then Question 2 and then Answer 2.

I am sure there is an easier way another than writing it in front of each and every line (then I have the indentation problem).

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Help me figure this enumerate problem

Post by frabjous »

It is not very clear what you want. "The indentation problem" -- how do you want it indented? How exactly do you want this to look? Without more information, we can only offer guesses.

From your brief description, it seems you want something like this:

Code: Select all

\documentclass{article}

\newcounter{question}
\setcounter{question}{0}
\newcommand{\question}{\refstepcounter{question}\item[Question~\thequestion.]}
\newcommand{\answer}{\item[Answer~\thequestion.]}

\begin{document}

\begin{enumerate}

\question What is your name?
\answer My name is Arthur of Camelot.

\question What is your quest?
\answer My quest is to seek the Holy Grail. 

\question What is your favorite color?
\answer My favorite color is blue.

\end{enumerate}

\end{document}
quest.png
quest.png (14.59 KiB) Viewed 1222 times
But I don't know if that's right. The description of the problem is too vague.
Post Reply