I'm using LyX and want to have an end mark for examples, definitions and theorems within chapters like this:
Theorem 1.1 Statement......
Definition 1.1 Statement......
Example 1.1 Statement......
Example 1.2 Statement......
Definition 1.2 Statement......
My LaTex preamble in LyX is:
\documentclass[12pt,oneside,english]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=4cm,bmargin=4cm,lmargin=4cm,rmargin=2cm}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parindent}{40bp}
\usepackage{color}
\usepackage{babel}
\usepackage{array}
\usepackage{bm}
\usepackage{multirow}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{setspace}
\usepackage[authoryear]{natbib}
\doublespacing
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=true]
{hyperref}
\hypersetup{
linkcolor=black,citecolor=black,urlcolor=blue,filecolor=blue,pdfpagelayout=OneColumn,pdfnewwindow=true,pdfstartview=XYZ,plainpages=false,pdfpagelabels,citecolor=blue,linkcolor=blue}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{example}{\protect\examplename}
\else
\newtheorem{example}{\protect\examplename}[chapter]
\fi
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{fact}{\protect\factname}
\else
\newtheorem{fact}{\protect\factname}[chapter]
\fi
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{defn}{\protect\definitionname}
\else
\newtheorem{defn}{\protect\definitionname}[chapter]
\fi
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{thm}{\protect\theoremname}
\else
\newtheorem{thm}{\protect\theoremname}[chapter]
\fi
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm}
\usepackage{babel}
\usepackage{hyperref}
\hypersetup{colorlinks=true,citecolor=blue, linkcolor=blue}
\usepackage{graphicx,epstopdf}
\usepackage{amsmath}
\usepackage[toc,page]{appendix}
\usepackage{bm}
\usepackage{tocloft,calc}
\renewcommand{\cftchappresnum}{Chapter } \AtBeginDocument{\addtolength\cftchapnumwidth{\widthof{\bfseries Chapter }}}
\setlength{\cftafterloftitleskip}{12pt} % list of figures
\setlength{\cftafterlottitleskip}{12pt} % list of tables
\setlength{\cftaftertoctitleskip}{12pt} % table of contents
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning}
\usepackage{enumerate}
\usepackage[format=plain,labelfont=bf,up,textfont=it,up]{caption}
\usepackage{amssymb}
\usepackage{thmtools}
\declaretheorem[style=definition,qed=$\blacksquare$,numberwithin=chapter]{definition}
\makeatother
\providecommand{\definitionname}{Definition}
\providecommand{\examplename}{Example}
\providecommand{\factname}{Fact}
\providecommand{\theoremname}{Theorem}
\begin{document}
Text
\end{document}
I would highly appreciate your help to figure out this problem. Thanks




\defnalready defined as an error, it must be from some other package that you're using. Perhaps just change the environmentdefnI defined to something likedefntnso it is unique. – Werner Aug 09 '12 at 05:15