我想用“第一章”、“第二章”等符号来引用我的章节,而不是“第 1 章”、“第 2 章”等。我该怎么做?
\documentclass{scrreprt}
\usepackage[english]{babel}
%Loaded here: microtype,graphicx,booktabs,caption,tabularx,hyperref,amsmath
\usepackage{classicthesis-preamble}
\usepackage{classicthesis}
% A personalization of description environment
\renewcommand{\descriptionlabel}[1]{\hspace*{\labelsep}\small\textsc{#1}}
\begin{document}
\chapter{MyChapter}
\label{ch:first}
\begin{description}
\item [In the \ref{ch:first}] I yada yada yada
\end{description}
\end{document}
答案1
与之一起使用的正确包refcount
是numname
:
\usepackage{refcount,numname}
\newcommand{\refc}[1]{\ordinaltoName{\getrefnumber{#1}} Chapter}
In the \refc{ch:first} we do something.
要获取链接,
\newcommand{\refc}[1]{\hyperref[#1]{\ordinaltoName{\getrefnumber{#1}} Chapter}}
答案2
你可以使用类似
\documentclass{scrreprt}
\usepackage[english]{babel}
%Loaded here: microtype,graphicx,booktabs,caption,tabularx,hyperref,amsmath
\usepackage{classicthesis-preamble}
\usepackage{classicthesis}
% A personalization of description environment
\renewcommand{\descriptionlabel}[1]{\hspace*{\labelsep}\small\textsc{#1}}
\usepackage{refcount}
\newcommand*{\refc}[1]{%
\setrefcountdefault{0}%
\hyperref[#1]{\ifcase\getrefnumber{#1}
???
\or First
\or Second
\or Third
% please extend this on your own
\else A kind of yellow
\fi Chapter}}
\begin{document}
\chapter{MyChapter}
\label{ch:first}
\begin{description}
\item [In the \refc{ch:first}] I yada yada yada
\end{description}
\end{document}
执行此操作。还有一个包恩戈尔德对于英语序数词,可以使用 that 来代替\ifcase
构造。
选择您可以修补\refstepcounter
并重新定义\p@chapter
以使所有内容\ref
成为章节的文本参考:
\documentclass{scrreprt}
\usepackage[english]{babel}
%Loaded here: microtype,graphicx,booktabs,caption,tabularx,hyperref,amsmath
\usepackage{classicthesis-preamble}
\usepackage{classicthesis}
% A personalization of description environment
\renewcommand{\descriptionlabel}[1]{\hspace*{\labelsep}\small\textsc{#1}}
\makeatletter
% 1. Allow \p@… to be a command with an argument
\renewcommand*\refstepcounter[1]{\stepcounter{#1}%
\protected@edef\@currentlabel
{\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
}
% Then ignore this argument at `\p@chapter` and use the completely different
% output instead.
\renewcommand\p@chapter[1]{\ordinalnumbertext{\value{chapter}} \@chapapp}%
\makeatother
\newcommand*{\ordinalnumbertext}[1]{%
\ifcase#1
???
\or First
\or Second
\or Third
\else A kind of yellow
\fi
}
\begin{document}
\chapter{MyChapter}
\label{ch:first}
\begin{description}
\item [In the \ref{ch:firsta}] I yada yada yada
\end{description}
\appendix
\chapter{MyChapter}
\label{ch:firsta}
\begin{description}
\item [In the \ref{ch:first}] I yada yada yada
\end{description}
\end{document}
这甚至适用于示例中所示的附录。