事实上,我有一个包含 2 张图片的图形。我想有一个好看的设计以供参考。以下是代码:
\immediate\write18{makeindex \jobname.nlo -s nomencl.ist -o \jobname.nls}
\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}
\usepackage{lineno}
\modulolinenumbers[5]
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{caption}
\usepackage[font=small,skip=0pt]{caption}
\usepackage[colorlinks]{hyperref}
\usepackage[nameinlink]{cleveref}
\journal{Journal of \LaTeX\ Templates}
\bibliographystyle{elsarticle-num}
\begin{document}
\begin{figure}[!ht]
\centering
\includegraphics[scale=0.182]{stack}
\vspace{0.5\baselineskip}\vspace{-\parskip}
\caption{(a) the letter a, the letter b}
\label{fig:letter}
\end{figure}\par
The \cref{fig:letter}a shows the letter a and \cref{fig:letter}b shows
the letter b
\end{document}
我希望图 1 旁边的 a 也像图 1 一样呈蓝色,图 2 b 也一样
答案1
您无需手动添加a
,b
只需标记子图,然后让 cleveref 完成其余工作。由于您的两个图似乎都在一个图形中,因此您可以使用\phantomsubcation
它们来创建标签。
\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}
\usepackage{lineno}
\modulolinenumbers[5]
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{caption}
\usepackage[font=small,skip=0pt]{caption}
\usepackage[colorlinks]{hyperref}
\usepackage[nameinlink]{cleveref}
\journal{Journal of \LaTeX\ Templates}
\bibliographystyle{elsarticle-num}
\begin{document}
\begin{figure}[!ht]
\centering
{
\phantomsubcaption\label{fig1a}
\phantomsubcaption\label{fig1b}
}
\includegraphics[scale=0.182]{example-image}
\vspace{0.5\baselineskip}\vspace{-\parskip}
\caption{(a) the letter a, the letter b}
\label{fig:letter}
\end{figure}\par
The \cref{fig1a} shows the letter a and \cref{fig1b} shows
the letter b
\end{document}