在另一个问题enumitem
我询问了在引用的图形标题中使用内联枚举时可能出现的和不兼容性hyperref
。那里的正确答案似乎是我需要在 hyperref 之前加载 enumitem,并将标签放在标题的开头。
然而,在我的实际文档中,我使用的是cas-sc
爱思唯尔分类,它hyperref
在cas-sc
类中加载(但似乎没有加载enumitem
)。
为了确保enumitem
在之前加载,我通过在执行后添加行来hyperref
修补该类。cas-sc
\RequirePackage[inline]{enumitem}
\LoadClass{article}
令我惊讶的是,另一个问题中提到的解决方案在这里不起作用。autoref
仍然显示“项目”而不是“图形”。所以我认为这cas-sc
在某种程度上阻碍了我的尝试。
如果有人能在这里看看我会很高兴。
文件test.aux
\newlabel{figure:foo1}{{1}{1}{}{Item.2}{}}
\newlabel{figure:foo2}{{1}{1}{}{Item.4}{}}
文件test.tex
\documentclass{cas-sc}
\usepackage[]{natbib}
\begin{document}
\begin{figure}
figure-content
\caption[]{\label{figure:foo1}figure-caption \begin{enumerate*}\item 1\item2\end{enumerate*}}
\label{figure:foo2}
\end{figure}
\autoref{figure:foo1}
\autoref{figure:foo2}
\end{document}
修补文件cas-sc.sty
%%
%% This is file `cas-dc.cls'.
%%
%% This file is part of the 'CAS Bundle'.
%% ......................................
%%
%% It may be distributed under the conditions of the LaTeX Project Public
%% License, either version 1.3c of this license or (at your option) any
%% later version. The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
%% The list of all files belonging to the 'CAS Bundle' is
%% given in the file `manifest.txt'.
%%
%% $Id: cas-sc.cls 66 2021-05-11 14:17:42Z rishi $
\def\RCSfile{cas-sc}%
\def\RCSversion{2.3}%
\def\RCSdate{2023/01/25}%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{\RCSfile}[\RCSdate, \RCSversion: Formatting class
for CAS single column articles]
%
\def\ABD{\AtBeginDocument}
%
% switches
%
\newif\iflongmktitle \longmktitlefalse
\newif\ifdc \global\dcfalse
\newif\ifsc \global\sctrue
\newif\ifcasreviewlayout \global\casreviewlayoutfalse
\newif\ifcasfinallayout \global\casfinallayoutfalse
\newcounter{blind}
\setcounter{blind}{0}
\def\blstr#1{\gdef\@blstr{#1}}
\def\@blstr{1}
\newdimen\@bls
\@bls=\baselineskip
\DeclareOption{singleblind}{\setcounter{blind}{1}}
\DeclareOption{doubleblind}{\setcounter{blind}{2}}
\DeclareOption{longmktitle}{\global\longmktitletrue}
\DeclareOption{final}{\global\casfinallayouttrue}
\DeclareOption{review}{\global\casreviewlayouttrue}
\ExecuteOptions{a4paper,10pt,oneside,fleqn}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}
\RequirePackage[inline]{enumitem}
\RequirePackage{graphicx}
\RequirePackage{amsmath,amsfonts,amssymb}
\allowdisplaybreaks
\RequirePackage{expl3,xparse}
\@ifundefined{regex_match:nnTF}{\RequirePackage{l3regex}}{}
\RequirePackage{etoolbox}
\RequirePackage{booktabs,makecell,multirow,array,colortbl,dcolumn,stfloats}
\RequirePackage{xspace,xstring,footmisc}
\RequirePackage[svgnames,dvipsnames]{xcolor}
\RequirePackage[colorlinks]{hyperref}
\colorlet{scolor}{black}
\colorlet{hscolor}{DarkSlateGrey}
\hypersetup{%
pdfcreator={LaTeX3; cas-sc.cls; hyperref.sty},
pdfproducer={pdfTeX;},
linkcolor={hscolor},
urlcolor={hscolor},
citecolor={hscolor},
filecolor={hscolor},
menucolor={hscolor},
}
% \AtEndDocument{\hypersetup
% {pdftitle={\csuse{__short_title:}},
% pdfauthor={\csuse{__short_authors:}}}}
\let\comma\@empty
\let\tnotesep\@empty
\let\@title\@empty
%
% Load Common items
%
\RequirePackage{cas-common}
%
% Specific to Single Column
%
\ExplSyntaxOn
\RenewDocumentCommand \maketitle {}
{
\ifbool { usecasgrabsbox }
{
\setcounter{page}{0}
\thispagestyle{empty}
\unvbox\casgrabsbox
} { }
\pagebreak
\ifbool { usecashlsbox }
{
\setcounter{page}{0}
\thispagestyle{empty}
\unvbox\casauhlbox
} { }
\pagebreak
\thispagestyle{first}
\ifbool{longmktitle}
{
\ifnum\theblind>0\relax
\LongMaketitleBox[blind]
\else
\LongMaketitleBox
\fi
\ProcessLongTitleBox
}
{
\ifnum\theblind>0\relax
\MaketitleBox[blind]
\else
\MaketitleBox
\fi
\printFirstPageNotes
}
\normalcolor \normalfont
\setcounter{footnote}{\int_use:N \g_stm_fnote_int}
\renewcommand\thefootnote{\arabic{footnote}}
\gdef\@pdfauthor{\infoauthors}
\gdef\@pdfsubject{Complex ~STM ~Content}
\ifbool{casreviewlayout}{\doublespacing}{}
}
%
% Fonts
%
\RequirePackage[T1]{fontenc}
\file_if_exist:nTF { stix.sty }
{
\file_if_exist:nTF { charis.sty }
{
\RequirePackage[notext]{stix}
\RequirePackage{charis}
}
{ \RequirePackage{stix} }
}
{
\iow_term:x { *********************************************************** }
\iow_term:x { ~Stix ~ and ~ Charis~ fonts ~ are ~ not ~ available ~ }
\iow_term:x { ~ in ~TeX~system.~Hence~CMR~ fonts~ are ~ used. }
\iow_term:x { *********************************************************** }
}
\file_if_exist:nTF { inconsolata }
{ \RequirePackage[scaled=.85]{inconsolata} }
{ \tex_gdef:D \ttdefault { cmtt } }
\ifbool{casreviewlayout}{\RequirePackage{setspace}}{}
\ExplSyntaxOff
%
% Page geometry
%
\usepackage[%
paperwidth=192mm,
paperheight=262mm,
% vmargin={12.4mm,11.5mm},
vmargin={19mm,19mm},
hmargin={13.7mm,13.7mm},
headsep=12pt,
footskip=12pt,
]{geometry}
\endinput
%
% End of class 'cas-sc'
%