我在使用 elsevier 模板引用图形时遇到问题,当我引用图像时,我只得到了编号,但没有得到图 1。以下是代码:
\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}
\usepackage{lineno,hyperref}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath, nccmath}
\usepackage{cclicenses}
\usepackage{caption}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package
\makenomenclature
\setlength{\nomitemsep}{-\parskip} % Baseline skip between items
\modulolinenumbers[5]
\bibliographystyle{elsarticle-num}
\begin{document}
c
c
the \ref{fig:example} blabla
c
c
\begin{figure}[!ht]
\includegraphics[scale=0.21]{name of the figure}
\caption{the name of the figure}
\label{fig:example}
\end{figure}
\end{document}
我只得到了 1 个 blabla
正常情况下我应该得到图 1 blabla
答案1
默认情况下, 的输出\ref
不会产生figure
图形计数器标签。例如,可以使用cleveref
和\cref
或 的重新定义 来改进这一点。\p@figure
下面的解决方案分别展示了每种用法:
\documentclass[review,demo]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.jpg}
\usepackage{lineno}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath, nccmath}
\usepackage{cclicenses}
\usepackage{caption}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package
\usepackage{hyperref}
\usepackage[noabbrev,nameinlink]{cleveref}
\makenomenclature
\setlength{\nomitemsep}{-\parskip} % Baseline skip between items
\modulolinenumbers[5]
\bibliographystyle{elsarticle-num}
\begin{document}
the \ref{fig:example} or \cref{fig:example} blabla
\begin{figure}[!ht]
\includegraphics[scale=0.21]{name of the figure}
\caption{the name of the figure}
\label{fig:example}
\end{figure}
\end{document}
解决方案\p@figure
已更改:
\documentclass[review,demo]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.jpg}
\usepackage{lineno}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath, nccmath}
\usepackage{cclicenses}
\usepackage{caption}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package
\usepackage{hyperref}
\makeatletter
\renewcommand{\p@figure}{\lowercase{\figurename}\ }
\makeatother
\makenomenclature
\setlength{\nomitemsep}{-\parskip} % Baseline skip between items
\modulolinenumbers[5]
\bibliographystyle{elsarticle-num}
\begin{document}
the \ref{fig:example} blabla
\begin{figure}[!ht]
\includegraphics[scale=0.21]{name of the figure}
\caption{the name of the figure}
\label{fig:example}
\end{figure}
\end{document}