1

This is not my command but I copied from some other Latex help website. But when I write

\begin{definition}
YOLO
\end{definition}

I get the error message

\usepackage{bm}
\usepackage{xcolor}
\usepackage{varwidth}
\usepackage{array}
\usepackage{geometry}
\usepackage[pdftex,bookmarks=true]{hyperref}
\usepackage{pdfpages}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsthm}
\usepackage{tikz-cd}
\usetikzlibrary{cd}
\usepackage{tikz}
\usepackage{stackengine}
\usepackage{appendix}
\usepackage{mathrsfs}
\usepackage{eso-pic}
\usetikzlibrary{positioning}
\usepackage{titlesec, blindtext, color}
\usepackage[T1]{fontenc}
{
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\newenvironment{proof}[1][Proof]{\begin{trivlist}
        \item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
        \item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
        \item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
        \item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

\newcommand{\qed}{\nobreak \ifvmode \relax \else
    \ifdim\lastskip<1.5em \hskip-\lastskip
    \hskip1.5em plus0em minus0.5em \fi \nobreak
    \vrule height0.75em width0.5em depth0.25em\fi}
}
  • 1
    Which error? Most likely the compilations fails because proof is already defined – user31729 Jan 8 '16 at 6:35
  • @ChristianHupfer I guess that the error how do I fix this – Boltzee Jan 8 '16 at 6:59
6

You've placed all your definitions inside a group {...}, which limits the scope of all newly-defined macros (including environments). That is, they're local and don't survive the group, making the definition useless.

Remove the grouping {...} to fix this problem.

  • while this is true, trying to define \newenvironment{proof} will result in the error ! LaTeX Error: Command \proof already defined. a more subtle approach is needed. – barbara beeton Jan 8 '16 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.