如何修改子圖中的標籤名稱?

如何修改子圖中的標籤名稱?

如何將副標題「圖1a」修改為「圖1(a)」?

\documentclass[12pt]{article}
\usepackage{blindtext}
\usepackage{graphicx,psfrag,epsf}
\usepackage{epstopdf}

\usepackage{float}
\usepackage[export]{adjustbox}
\usepackage{mathtools}
\usepackage{verbatim}

%\usepackage[subrefformat=parens,labelformat=parens, labelsep=quad]{subfig}
\usepackage{subfigure}
\usepackage{caption}
%\usepackage{subcaption}
\newcommand{\bs}{\boldsymbol}
\renewcommand\thesubfigure{\alph{subfigure}}

% correct bad hyphenation here

%\pdfminorversion=4
% NOTE: To produce blinded version, replace "0" with "1" below.
\newcommand{\blind}{0}

% DON'T change margins - should be 1 inch all around.
\addtolength{\oddsidemargin}{-.5in}%
\addtolength{\evensidemargin}{-.5in}%
\addtolength{\textwidth}{1in}%
\addtolength{\textheight}{-.3in}%
\addtolength{\topmargin}{-.8in}%

\begin{document}

The Figure~\ref{descriptive1} is composed by Figure~\ref{fig:hist_longair} and Figure~\ref{fig:curve_longair}.

\begin{figure}[H]
    \center
    \subfigure[Histogram]{\includegraphics[width = .42\linewidth]{hist_longair.eps} \label{fig:hist_longair}}%
    \quad%
    \subfigure[Contour curve]{\includegraphics[width = .42\linewidth]{curve_longair.eps}\label{fig:curve_longair}}%
    \caption{Histogram, contour curve and symbolic scatterplot of $\bs{Y}$} 
    \label{descriptive1}
\end{figure}
\end{document}

答案1

subfigure包已被棄用,並且caption與文件載入的包完全不相容。我建議您放棄加載該subfigure包,而是加載該subcaption包並利用其機器。 (該subcaption套件也會自動載入該caption套件。)

這種方法的另一個優點是它允許您使用cleveref套件及其“聰明”的交叉引用命令。下面的範例顯示了一個應用程式。

我將您的文章解釋為希望在圖形標籤和子圖形標籤之間有一些空格。這是透過在 的\,(重新)定義中包含 (thinspace)來實現的\thesubfigure。如果您希望擁有完整的詞間空格,只需替換\,~(不間斷空格)即可。不過,我不建議這樣做;事實上,如果這是我的文檔,我根本不會提供任何空間。

在此輸入影像描述

\documentclass[12pt]{article}
% I've tried to slim the preamble down to the essentials.
\usepackage{mathtools}
\let\bs\boldsymbol
\usepackage[demo]{graphicx} % remove 'demo' option in real document

\usepackage[labelformat=simple]{subcaption} % default is 'labelformat=parens'
\renewcommand\thesubfigure{\,(\alph{subfigure})} % thinspace before subfigure label

\usepackage[noabbrev]{cleveref} % just for this example

\begin{document}
Figure~\ref{descriptive1} consists of Figure~\ref{fig:hist_longair} and Figure~\ref{fig:curve_longair}.

\Cref{descriptive1} consists of \Cref{fig:hist_longair,fig:curve_longair}.

\begin{figure}[ht!]

\begin{subfigure}{.45\textwidth}
\includegraphics[width=\linewidth]{hist_longair.eps}
\caption{Histogram}\label{fig:hist_longair}
\end{subfigure}
\hfill % maximize the spread between the subfigures
\begin{subfigure}{.45\textwidth}
\includegraphics[width=\linewidth]{curve_longair.eps}
\caption{Contour curve}\label{fig:curve_longair}
\end{subfigure}

\caption{Histogram, contour curve and symbolic scatterplot of $\bs{Y}$} 
\label{descriptive1}
\end{figure}

\end{document}

相關內容