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}
}
Best Answer
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.