3

The compiler is showing "LaTeX Error: Environment example undefined", which is 100% reproducible here.

\documentclass{article}
\title{Empirical distribution}
\author{Jane Doe}
\usepackage{newtxmath}
\usepackage{amsmath}
\begin{document}
\maketitle
\section{My first section}
\begin{example}
\xi_n = [x_1 \dots x_n]
\end{example}
\end{document}

error message

LaTeX Error: Environment example undefined.

You have created an environment (using \begin{…} and \end{…} commands) which is not recognized. Make sure you have included the required package for that environment in your preamble, and that the environment is spelled correctly.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.9 \begin{example}
                   
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

I wrote this by using the template that the compiler provided. Why the compiler does not its own template?

1 Answer 1

1

You are not providing any screenshot for Example style, so I've defined my own, and the codings are :

\newenvironment{example}{\bgroup\par\noindent\textbf{Example}\par%
\[}{\]\egroup}

Please paste the above codings after \begin{document} and then try...

5
  • Thanks a lot! The error is gone. The Example style is provided by the online compiler, I don't know how to get the definition of this style.
    – whnlp
    Sep 18, 2019 at 12:18
  • Glad to hear that the error got solved...
    – MadyYuvi
    Sep 18, 2019 at 12:20
  • I am getting Environment Verbatim undefined. even though \begin{Verbatim} is inside \begin{document} Mar 24, 2023 at 22:52
  • Correct code is \begin{verbatim} not Verbatim
    – MadyYuvi
    Mar 27, 2023 at 11:48
  • If still the error exists, then please provide your code, what you tried for
    – MadyYuvi
    Mar 27, 2023 at 11:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .