\documentclass[danish]{article}
\usepackage{babel,enumitem}
\newcounter{animals}
\newenvironment{exercise}
{\begin{list}{Answer~(\arabic{animals}):}%
{\setlength{\labelsep}{8pt}%
\setlength{\itemindent}{8pt}%
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{0pt}%
\usecounter{animals}}}%
{\end{list}}
\begin{document}
Wierd animal features:
\begin{enumerate}[label=Question~(\arabic*),leftmargin=*,labelsep=\parindent]
\item Why is a horse not blue?
\item Why can a goat not fly?
\end{enumerate}
Explanations:
\begin{exercise}
\item It would look stupid.
\item I actually have seen a flying goat.
\end{exercise}
\end{document}
I would like to automatically align ``Why is...''/``Why can...'' with ``It would...''/``I have...'' vertically. How do I do this?
Thank you in advance!
P.S. I can of course do it manually by changing the length of \labelsep and \itemindent.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
\documentclass[danish]{article}
\usepackage{babel,enumitem}
\newlist{Questions}{enumerate}{1}
\setlist[Questions]{label=Question~(\arabic*),leftmargin=*,itemindent=4.5em,labelsep=*}
\newlist{Answers}{enumerate}{1}
\setlist[Answers]{label=Answer~(\arabic*):,leftmargin=*,itemindent=4.5em,labelsep=*}
\begin{document}
Wierd animal features:
\begin{Questions}
\item Why is a horse not blue?
\item Why can a goat not fly?
\end{Questions}
Explanations:
\begin{Answers}
\item It would look stupid.
\item I actually have seen a flying goat.
\end{Answers}
\end{document}
The enumitem is a very good package, unfortunately I can't say the same about its manual. So maybe it is possible with it but I wasn't able to figure it out.
\documentclass[danish]{article}
\usepackage{babel,enumitem}
\usepackage{lipsum}% for dummy text
\newlength\mylabelwidth
\setlength\mylabelwidth{7em}
\makeatletter
\newlength\my@labelindent
\setlength\my@labelindent{0pt}
\newcommand*\mylabelindent{\noindent\hspace*{\my@labelindent}}
\makeatother
\newcounter{question}
\newenvironment{questions}
{%
\def\Item{%
\stepcounter{question}%
\par\mylabelindent
\parbox{\mylabelwidth}{Question~(\arabic{question}):}}%
\vskip0pt\relax\addvspace{\baselineskip}% skip before the env
}%
{\par\noindent\vskip0pt\relax\addvspace{\baselineskip}}% skip after the env
\newcounter{answer}
\newenvironment{answers}
{%
\def\Item{%
\stepcounter{answer}%
\par\mylabelindent
\parbox{\mylabelwidth}{Answer~(\arabic{answer}):}}%
\vskip0pt\relax\addvspace{\baselineskip}%
}%
{\par\noindent\vskip0pt\relax\addvspace{\baselineskip}}
\begin{document}
Wierd animal features:
\begin{questions}
\Item Why is a horse not blue? \lipsum[4]
\Item Why can a goat not fly?
\end{questions}
Explanations:
\begin{answers}
\Item It would look stupid.
\Item I actually have seen a flying goat.
\end{answers}
\end{document}
Hm, that's strange... unfortunately the log does not say what's going on and simply ends with emergency stop. Have you tried deleting the aux file? (forget the last question if you created a new file)
Maybe you can remove the \lipsum and see what happens (although I can't think of a reason why that shouldn't work. The code uses no esoteric packages or anything. Should be pretty working nicely (unless I'm missing something, obviously…)