1

In my Latex-file there is the following part for defining new environments for theorem, lemma and so on:

enter image description here

Unfortunately, this produces some mistakes. When I write a new theorem, lemma etc. then the beginning is not correct as you may see here: The first letter of the first word is not shown correctly.

I am no expert in Latex and do not see how to change my code to delete this error. Can you please help me?

enter image description here

M. Meyer
  • 111
  • 3
    Please do not add code in an image, that is not copyable for us to test it on our computers. Please add an compilable code, minimalised to show only your probem (called MWE, minimal working example). Welcome to the side! – Mensch Oct 23 '15 at 20:01
  • 1
    Welcome to TeX.SX! It's not clear what those definitions are supposed to do. But they're very wrong, in my opinion. A sample of how you call them is needed. Why not using \newtheorem? – egreg Oct 23 '15 at 20:04
  • I assume you are doing something like \begin{theorem}Content of theorem.\end{theorem}. In that case, C is treated as the mandatory argument and ontent of theorem. is treated as the body. The way you've defined the environment, it takes one optional and one required argument. So the syntax is \begin{theorem}[<optional>]{<required>}<contents>\end{theorem}. But, as @egreg says, this is not a good way to do it in any case. – cfr Oct 23 '15 at 20:19
  • 1
    I suspect you're calling \begin{theorem}[Theorem 1] Let ...\end{theorem}, but it should be \begin{theorem}{1} Let ...\end{theorem} – egreg Oct 23 '15 at 20:20
  • My answer here introduces \(provide/re)newcommand(*), \(provide/re)newenvironment(*) etc. It may be helpful. – cfr Oct 23 '15 at 20:21
  • @egreg You are right, this was my mistake, thank you very much! – M. Meyer Oct 23 '15 at 20:54

1 Answers1

1

By what I can see from the picture, the expected call of the environments you define is of the form

\begin{theorem}{1}
Let $\mathscr{H}$ be a Hilbert space ...
\end{theorem}

and your output seems instead the result of

\begin{theorem}[Theorem 1]
Let $\mathscr{H}$ be a Hilbert space ...
\end{theorem}

which is wrong. Use the former syntax.


Note

I have doubts about your way of using LaTeX. Given those definitions, just one new environment suffices. You can call

\begin{theorem}{1}
Let $\mathscr{H}$ be a Hilbert space ...
\end{theorem}

\begin{theorem}[Corollary]{1}
In the situation of ...
\end{theorem}

and the output would be exactly the same, without the need for six almost identical definitions.

However, this is against the spirit of LaTeX, where manual numbering can and should be avoided. For theorem-like statements, LaTeX provides \newtheorem, which is improved by loading the amsthm package.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mathrsfs}

\theoremstyle{definition} % body font upright
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}

\begin{document}

\begin{theorem}\label{thm:projection}
Let $\mathscr{H}$ be a Hilbert space and $\mathscr{M}$ a closed
subspace of~$\mathscr{H}$. Moreover, let $x\in\mathscr{H}$. Then
there is a unique element $\hat{x}\in\mathscr{M}$ such that
\begin{equation}
\label{eq:projection}
\lVert x-\hat{x}\rVert = \inf_{y\in\mathscr{M}}\lVert x-y\rVert.
\end{equation}
Additionally, $\hat{x}\in\mathscr{M}$ and \eqref{eq:projection}~iff
$\hat{x}\in\mathscr{M}$ and $(x-\hat{x}\in\mathscr{M}^{\perp}$.
\end{theorem}

\begin{proof}
See \cite[p.~51]{BD91}.
\end{proof}

\begin{corollary}
In the situation of Theorem~\ref{thm:projection}, let $\mathcal{I}$
denote the identity map on $\mathscr{H}$. Then there is a unique map
$P_{\mathscr{M}}$ of $\mathscr{H}$ onto $\mathscr{M}$ such that
$\mathcal{I}-P_{\mathscr{M}}$ maps $\mathscr{H}$ onto $\mathscr{M}^{\perp}$.
\end{corollary}

\begin{thebibliography}{BD91}

\bibitem[BD91]{BD91} Whatever

\end{thebibliography}

\end{document}

enter image description here

egreg
  • 1,121,712