
我已經在套件中定義了一個環境exsheets
,並想使用cleveref
套件引用它,但無法找到方法。我嘗試了很多事情並嘗試閱讀exsheets
手冊。我也搜了一下。可能是手冊或互聯網上提供了解決方案,但我找不到。需要幫助。
以下是程式碼(不起作用),我希望它應該是不言自明的。
\documentclass[12pt]{book}
\usepackage{graphicx}
\usepackage{cleveref}
\usepackage{exsheets}
\NewQuSolPair{example}[name=Example,headings=runin]{egsolution}[name=Solution,print=true,headings=runin]
\begin{document}
\chapter{Sample chapter}
This is some text.
\begin{example}\label{ex:test}
This is some example.
\end{example}
\begin{egsolution}
This is the solution.
\end{egsolution}
This is some example \cref{ex:test}
\end{document}
答案1
該exsheets
軟體包仍然不允許使用另一個計數器question
(據我所知,儘管我向@clemens詢問了這一點以進行更改;-))
但是,cleveref
不知道標籤類型question
,所以
\crefname{question}{question}{questions}
和大寫變體
\Crefname{question}{Question}{Questions}
必須稍後定義。
cleveref
也應該是最後載入的包之一,即在exsheets
等等之後。
\documentclass[12pt]{book}
\usepackage{graphicx}
\usepackage{exsheets}
\usepackage{cleveref}
\NewQuSolPair{example}[name=Example,headings=runin]{egsolution}[name=Solution,print=true,headings=runin]
\crefname{question}{question}{questions}
\Crefname{question}{Question}{Questions}
\begin{document}
\chapter{Sample chapter}
This is some text.
\begin{example}\label{ex:test}
This is some example.
\end{example}
\begin{egsolution}
This is the solution.
\end{egsolution}
This is some example \cref{ex:test}. \Cref{ex:test} shows that ...
\end{document}