How to rename or "copy" a latex environment
There are four ways how to copy an environment:
Using low-level copy. This is a true copy in the TeX's sense, but it's a non-LaTeXy solution. The environment
answers
is now independent from any re-definition ofquestions
.\let\answers\questions \let\endanswers\endquestions
Using slightly higher-level copy. If
questions
is re-defined, so isanswers
automatically.\newenvironment{answers}{\questions}{\endquestions}
Using proper LaTeX groups too. Same as the previous, but an extra level of unnecessary grouping is added. I wouldn't recommend it.
\newenvironment{answers}{% \begin{questions}% }{% \end{questions}% }
Defining the environment from scratch. If you define
questions
, you can defineanswers
the same way:\newenvironment{questions}{BLA}{BLABLA} \newenvironment{answers}{BLA}{BLABLA}
Or in case of environments defined by a special command, for instance:
\newtheorem{questions}{BLA} \newtheorem{answers}{BLA}
Use the one which is most suitable for the task.
Edit: Questionnaire time!
This solution sets a new command called \qanda
, a modified version of this post by cgnieder and this question for placing a title.
The new command takes two arguments, but inside of each argument we have a potentially infinite list, so in the first argument you'll write the questions, while in the second one the answers, obviously in the same order.
Additionally the answers' list has been rotated but you can do what you want with it. Here's the output:
And here's the code:
\documentclass{article}
\usepackage{enumitem}
\usepackage{xparse}
\usepackage{rotating}
\setlist[enumerate]{itemsep=-1mm}
\NewDocumentCommand\qanda{>{\SplitList{;}}m>{\SplitList{;}}m}
{
\paragraph{Questions:}
\begin{enumerate}
\ProcessList{#1}{ \insertq }
\end{enumerate}
\vspace{2cm}
\begin{turn}{180}
\begin{minipage}{\textwidth}
\paragraph{Answers:}
\begin{enumerate}
\ProcessList{#2}{ \inserta }
\end{enumerate}
\end{minipage}
\end{turn}
}
\newcommand\insertq[1]{\item #1}
\newcommand\inserta[1]{\item #1}
\begin{document}
\section*{Questionnaire}
And now some questions and (rotated) answers.
\qanda{% Questions
What's the name of our star?;
What planet comes after the Earth?}%
{% Answers
Sun;%
Mars}%
\end{document}
Original answer
\documentclass{article}
\usepackage{enumitem}
\newlist{questions}{enumerate}{3}
\setlist[questions]{label=\arabic*.}
\newlist{answers}{enumerate}{3}
\setlist[answers]{label=\arabic*.}
\begin{document}
\begin{questions}
\item lorem ipsum
\item lorem ipsum
\end{questions}
\begin{answers}
\item lorem ipsum
\item lorem ipsum
\end{answers}
\end{document}