[Tex/LaTex] How to number and reference to “definitions” in latex

cross-referencing

I want the following format in LaTeX:

Definition 1 [apple]:
apple is a fruit.

Definition 2 [cat]:
cat is a fluffy animal. 
.
.

Best Answer

Without using any packages you could use inbuilt theorem environment

\documentclass[10pt]{article}
\newtheorem{mydef}{Definition}

%use next two lines instead for non-italic alternative
%\newtheorem{preremark}{Definition}
%\newenvironment{mydef}{\begin{preremark}\upshape}{\end{preremark}}

\begin{document}    
\begin{mydef}\label{def:def444}
Here is a new definition
\end{mydef}

\begin{mydef}[Somebody]\label{def:def555}
Here is another new definition
\end{mydef}

That was Definition~\ref{def:def444} and Definition~\ref{def:def555}

\end{document}

enter image description here

Related Question