Using MiKTeX with PDFLaTeX on Windows
I want to create an environment that contains two minipages; the first one has a description item, and the second has a small text (or picture). This piece of code works as I want:
{
\noindent
\begin{minipage}{0.5\textwidth}
\begin{description}
\item[Label] Description
\end{description}
\end{minipage}\hfill
\begin{minipage}{0.3\textwidth}
Second minipage
\end{minipage}
}
I wanted to create a macro or environment to make it easy for me to introduce this kind of content. So I create the following environment with two arguments:
\newenvironment{myenvironment}[2]% 1:label, 2:second minipage text
{%
\noindent
\begin{minipage}{0.5\textwidth}
\begin{description}
\item[#1] % Description
}%
{%
\end{description}
\end{minipage}\hfill
\begin{minipage}{0.3\textwidth}
#2
\end{minipage}
}
But when I try to use it with
\begin{myenvironment}{Label}{Second minipage text}
Description text
\end{myenvironment}
I get Illegal parameter number in definition of \endmyenvironment.
pointing to the line that finishes the newenvironment
declaration. After some hours struggling with this I tried using double hashes (##
) and got two new different errors: You can't use `macro parameter character #' in restricted horizontal mode
and You can't use `macro parameter character #' in internal vertical mode
. This time the errors were pointing to the lines when I wanted to use the environment, but had no complaints on the definition.
What am I doing wrong?
\end
part of the environment definition.xparse
makes it available, or you should useenviron
. Alternatively, define the arguments in macros that you use within the\end
segment.