我正在尝试交叉引用定理或定义,但代码不起作用。代码如下。请帮助我。
提前致谢。
\documentclass[justified, twoside]{tufte-book} % Use the tufte-book class which in turn uses the tufte-common class
\usepackage{booktabs} % Better horizontal rules in tables
\usepackage[most]{tcolorbox}
\usepackage{mparhack}
\usepackage{amsmath,amsthm,amssymb,parskip}
\usepackage{cleveref}
\usepackage{pgf,tikz,pgfplots}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\usepackage[english]{babel} %%% 'french', 'german', 'spanish', 'danish', etc.
\usepackage{txfonts}
\usepackage{mathdots}
\usepackage{enumitem}
\usepackage{IEEEtrantools}
\usepackage{todonotes}
\usepackage{rotating}
\usepackage{caption}
\usetikzlibrary{arrows.meta,bending}%New package added to this file
\usepackage{tkz-euclide}
\usepackage{pgfplots}
\usepackage{tkz-fct}
\usepackage{hyperref}
\usepackage{graphicx, float} % Needed to insert images into the document
\usepgfplotslibrary{polar}
\usepgflibrary{shapes.geometric}
\usetikzlibrary{calc}
\usepackage{etoolbox}
\tcbuselibrary{xparse,skins,breakable}
%Defining Chapter Outline in tcolorbox
\newtcolorbox[auto counter]{chapteroutline}[2][]{
enhanced,
breakable,arc=0pt,outer arc=0pt,colback=white!90!yellow, colframe=red!50!blue,
fonttitle=\sc,
title={\textbf{\begin{Large}CHAPTER OUTLINE\end{Large} }}
}
\let\clearpage\relax % also to allow a screenshot{}
%Defining definition in tcolorbox
\newtcolorbox[auto counter,number within=chapter]{definition}[2][]{
enhanced,
breakable,arc=0pt,outer arc=0pt,colback=white!90!yellow, colframe=black!50!blue,
fonttitle=\sc,
title={\textbf{Definition ~\thetcbcounter: #1}}
}
\let\clearpage\relax % also to allow a screenshot{}
%definiting Theorem in tcolorbox
\newtcolorbox[auto counter, number within=chapter]{theorem}[2][]{
enhanced,
breakable,arc=0pt,outer arc=0pt,colback=green!2!white, colframe=black!45!green,
fonttitle=\sc,
title={Theorem ~\thetcbcounter: #1}
}
\let\clearpage\relax % also to allow a screenshot{}
%definiting Formulla in tcolorbox
\newtcolorbox[auto counter, number within=chapter]{formulla}[2][]{
enhanced,
breakable,arc=0pt,outer arc=0pt,colback=green!2!white, colframe=red!45!green,
fonttitle=\sc,
title={Formulla ~\thetcbcounter: #1}
}
\let\clearpage\relax % also to allow a screenshot{}
%definiting Remark in tcolorbox
\newtcolorbox[auto counter, number within=chapter]{remark}[2][]{
enhanced,arc=0pt,outer arc=0pt,colback=green!0!white, colframe=black!45!white,
fonttitle=\sc, attach boxed title to top left={yshift=-2mm,xshift=-3mm},
title={Remark ~\thetcbcounter: #1}
}
\let\clearpage\relax % also to allow a screenshot{}
%definiting Example in tcolorbox
\newtcolorbox[auto counter, number within=chapter]{example}[2][]{
enhanced,arc=0pt,outer arc=0pt,colback=white!0!white, colframe=yellow!90!white,
fonttitle=\sc, attach boxed title to top left={yshift=-2mm,xshift=-3mm},
title={Example ~\thetcbcounter: #1}
}
\let\clearpage\relax % also to allow a screenshot{}
% chapter format
\titleformat{\chapter}%
{\Huge\rmfamily\itshape\color{red}}% format applied to label+text
{\llap{\colorbox{red}{\parbox{1.5cm}{\hfill\itshape\huge\color{white}\thechapter}}}}% label
{2pt}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
% section format
\titleformat{\section}%
{\normalfont\Large\itshape\color{orange}}% format applied to label+text
{\llap{\colorbox{orange}{\parbox{1.5cm}{\hfill\color{white}\thesection}}}}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
% subsection format
\titleformat{\subsection}%
{\normalfont\large\itshape\color{blue}}% format applied to label+text
{\llap{\colorbox{blue}{\parbox{1.5cm}{\hfill\color{white}\thesubsection}}}}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
% paragraf format
\titleformat{\paragraph}%
{\normalfont\Large\itshape\color{red}}% format applied to label+text
{\llap{\colorbox{orange}{\parbox{1.5cm}{\hfill\color{blue}\thesection}}}}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
% definition format
\titleformat{\defn}%
{\normalfont\Large\itshape\color{orange}}% format applied to label+text
{\llap{\colorbox{orange}{\parbox{1.5cm}{\hfill\color{white}\thesection}}}}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
\DeclareMathOperator{\sech}{sech}
\DeclareMathOperator{\cs}{cosec}
\DeclareMathOperator{\csh}{cosech}
\usepackage{xspace} % Used for printing a trailing space better than using a tilde (~) using the \xspace command
\newcommand{\hlred}[1]{\textcolor{Maroon}{#1}} % Print text in maroon
\newcommand{\hairsp}{\hspace{1pt}} % Command to print a very short space
\newcommand{\ie}{\textit{i.\hairsp{}e.}\xspace} % Command to print i.e.
\newcommand{\eg}{\textit{e.\hairsp{}g.}\xspace} % Command to print e.g.
\newcommand{\docmsg}[2]{\bigskip\begin{fullwidth}\noindent\ttfamily#1\end{fullwidth}\medskip\par\noindent#2}
\usepackage{makeidx} % Used to generate the index
\makeindex % Generate the index which is printed at the end of the document
\pgfplotsset{my style/.append style={axis x line =middle, axis y line=middle, xlabel={$x$}, ylabel={$y$}, axis equal}}
\begin{document}
\begin{theorem}[Rolle's Theorem]\label{th:rolls}
Let $f:[a, b]\rightarrow \mathbb{R}$ be a function satisfying the following conditions:
\begin{enumerate}
\item $f(x)$ is continuous on the closed interval $[a,b].$
\item $f(x)$ is differentiable on the open interval $(a,b)$.
\item $f(a)=f(b).$\\
Then there exists atleast one number $c$ such that $a<c<b$ and
$f^{\prime}(c)=0.$
In other words $f(x)$ has a critical point in $(a,b)$.
\end{enumerate}
\end{theorem}
\ref{th:rolls}
\begin{example}\label{ex:01}
Verify Rolle's Theorem for $f(x)$, where
\[f\left(x\right)=8 x -x^{2}~~~\text{in}~~[0,8]\]
\end{example}
\ref{ex:01}
\end{document}