
我使用該cleveref
套件來引用memoir
類別中的浮點數(在本例中為子圖)。目前輸出看起來像這樣(對不起丹麥人,我認為這並不重要):
使用以下輸入(並非包括所有軟體包,ofc):
\documentclass[oneside,article,12pt,danish]{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\captiontitlefont{\slshape}
\subcaptionfont{\slshape}
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\begin{figure}[h!]
\centering
\subbottom[Subfigure 1 caption]{\rule{3cm}{1cm}\label{sub1}}
\hspace{1cm}
\subbottom[Subfigure 2 caption]{\rule{3cm}{1cm}\label{sub2}}
\caption{Figure text.}
\label{fig:secondfig}
\end{figure}
\cref{sub1,sub2}
\end{document}
我喜歡圖/子圖的設定方式,但我希望引用說5a
或5.a
而不是5(a)
不更改圖/子圖標題。在整個文件中是否有通用的方法來執行此操作,以便可以輕鬆地將其更改為某種隨機的符號?
答案1
此解決方案避免了載入的需要caption
,從而保留了memoir
.至少,看起來是這樣,儘管我的測試有點少。根據您的心情,取消註解/註解適當的行以實現帶或不帶點的格式。
\documentclass[oneside,article,12pt,danish]{memoir}
\newsubfloat{figure}
\captiontitlefont{\slshape}
\subcaptionfont{\slshape}
% \renewcommand{\thesubfigure}{\alph{subfigure}}% plain version
\renewcommand{\thesubfigure}{.\alph{subfigure}}% dotted version
\makeatletter
\renewcommand{\@thesubfigure}{(\alph{subfigure})%
\if@tightsubcap\hskip\subfloatlabelskip\else\space\fi}
\makeatother
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\begin{figure}[h!]
\centering
\subbottom[Subfigure 1 caption]{\rule{3cm}{1cm}\label{sub1}}
\hspace{1cm}
\subbottom[Subfigure 2 caption]{\rule{3cm}{1cm}\label{sub2}}
\caption{Figure text.}
\label{fig:secondfig}
\end{figure}
\cref{sub1,sub2}
\end{document}
如果您要加載xcolor
,那麼您可以(反常地)僅以巨大的藍色小寫字母排版對子圖位的引用,而不會影響標題或其他引用:
\renewcommand{\thesubfigure}{\Huge\color{blue}.\alph{subfigure}}% dotted version
顯然,這將是一個糟糕的選擇,但它表明可以輕鬆地將格式“更改為某種隨機符號”,同時保留子標題的格式和memoir
.
答案2
subfig
好的,這是使用和 的部分建議caption
。我以前沒有使用過回憶錄課程。如果我使用文章,數字被標記為“1.a”,當我切換到回憶錄時,我會得到“0.1.a”。你的一些程式碼不適合我編譯。我已經註解掉了。我已經更改了該圖,使其看起來更像我自己的程式碼(即subfloat
不是subbottom
),因為我以前沒有使用過後者。我已經合併了之前連結的問題的答案。
因此,根據上面關於非編譯程式碼的警告,我這裡的範例在圖形標籤方面滿足了您的要求(我認為)。
可能有更好的解決方案。
\documentclass[12pt]{memoir}
\usepackage{graphicx}
%%%%These do not work for me - is there a missing package?
%\newsubfloat{figure}
%\captiontitlefont{\slshape}
%\subcaptionfont{\slshape}
%%%%
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage[font=sl,labelfont=up]{caption}
\usepackage[font=sl,labelfont=up]{subfig}
\renewcommand\thesubfigure{\alph{subfigure}} % default: "(\alph{subfigure})"
\makeatletter
\renewcommand{\p@subfigure}{\thefigure.} % default: "\thefigure" (without the ".")
\makeatother
\begin{document}
\begin{figure}
\centering
\subfloat[Subfigure 1 caption]{\rule{3cm}{1cm}\label{sub1}}
\hspace{1cm}
\subfloat[Subfigure 2 caption]{\rule{3cm}{1cm}\label{sub2}}
\caption{Figure text.}
\label{fig:secondfig}
\end{figure}
\cref{sub1,sub2}
\end{document}