Cleveref 小写用于单个引用

Cleveref 小写用于单个引用

cleveref两个主要的引用命令:\Cref和,\cref取决于你是在句首引用(产生Figure 1)还是在其他地方引用(产生缩写形式fig. 1)。不过,在极少数情况下,人们可能希望在句子中间使用“长”标签。我该怎么做单身的标签是否为小写?答案使全部引用采用小写字母,但我正在寻找一种解决方案来保持包提供的标准cleveref,但在某些情况下将其更改为小写。

理想情况下,我希望在需要时有一个命令(比如说\smallCref)产生。figure 1

提前感谢你的帮助!

在此处输入图片描述

\documentclass{scrreprt}
\usepackage{cleveref}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics[width=0.5\linewidth]{example-image-a}
    \caption{Foo\label{fig:foo}}
\end{figure}

\Cref{fig:foo} shows a correct usage of \verb|\Cref{}| at the beginning of the sentence. Whereas we can see how to use \verb|\cref{}| at the end of a sentence (\cref{fig:foo}).
\par Sometimes though, one may want to reference \Cref{fig:foo} with the complete label ``figure'', but having it capitalized in the middle of a sentence is weird. How can I have that single reference in smallcaps, leaving all other references in the document in the original capitalization?
\end{document}

答案1

这是一个快速而肮脏的黑客攻击。创建一个新命令,结合\lcnamecref\labelcref

\newcommand{\lccref}[1]{\lcnamecref{#1}~\labelcref{#1}}

它将给你以下信息:

\documentclass{scrreprt}
\usepackage{cleveref}
  \newcommand{\lccref}[1]{\lcnamecref{#1}~\labelcref{#1}}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics[width=0.5\linewidth]{example-image-a}
    \caption{Foo\label{fig:foo}}
\end{figure}

\Cref{fig:foo} shows a correct usage of \verb|\Cref{}| at the beginning of the sentence. Whereas we can see how to use \verb|\cref{}| at the end of a sentence (\cref{fig:foo}).
\par Sometimes though, one may want to reference \lccref{fig:foo} with the complete label ``figure'', but having it capitalized in the middle of a sentence is weird. How can I have that single reference in smallcaps, leaving all other references in the document in the original capitalization?
\end{document}

在此处输入图片描述

相关内容