I observed an unwanted behavior of my self-made environment. The following code sometimes creates spaces after the environment head and sometimes doesn't.
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{ifthen}
\newenvironment{Theorem}[1][]{%
\medskip%
\par%
\noindent%
\textbf{Theorem.}%
\ifthenelse{ \equal{#1}{} }{}{ (#1)}%
\it%
}%
{%
\smallskip\par%
}
\newenvironment{Theorem2}{%
\medskip%
\par%
\noindent%
\textbf{Theorem.}%
\it%
}%
{%
\smallskip\par%
}
\begin{document}
\begin{Theorem}
That is a cool Theorem
\end{Theorem}
\begin{Theorem}[of some famous guy]
That is a cool Theorem
\end{Theorem}
\begin{Theorem2}
another cool theorem
\end{Theorem2}
\begin{Theorem2}%
another cool theorem
\end{Theorem2}
\end{document}
The result is:
Is there a way of forcing LaTeX to ignore all normal spaces in the definition of an environment such that I can only add spaces by \space
?
And can I add something to the definition of the environment such that it ignores all spaces and pars that appear directly after the call of the environment such that
\begin{Theorem2}
some text
\end{Theorem2}
produces the same as
\begin{Theorem2}%
some text
\end{Theorem2}
?
\usepackage{amsthm}
and\newtheorem*{Theorem}{Theorem}
?