我在用背面并使用 LuaLaTex 作为编译器,我使用 subfloat 来排列我的图像,但我想将标题样式从图 5 更改为图 5(a) 和图 5(b)。当我只使用 subfigure 时,设置很顺利。但当我使用 subfloat 时,它不起作用。这是我的代码。我想知道如何纠正这个问题,谢谢!
\documentclass[letterpaper,twocolumn,12pt]{article}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,chains}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfigure}
\usepackage{fontspec}
\usepackage{underscore}
\usepackage{ragged2e}
\usepackage{geometry}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{indentfirst}
\setlength{\parindent}{2em}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[font=footnotesize,labelfont=bf]{caption}
%\usepackage{subcaption}
\geometry{centering,textwidth=0.887589cm,columnsep=.81cm,left=1.6cm,right=1.6cm,top=1.91cm,bottom=2.54cm}
\pagenumbering{gobble}
\usepackage{verbatim}
\newtheorem{definition}{Definition}
\usepackage{titlesec}
%\usepackage[]{caption2}
\renewcommand{\figurename}{Fig.}
%\renewcommand{\captionlabeldelim}{.~}
\renewcommand{\thesubfigure}{Fig.\arabic{figure}(\alph{subfigure})}
\makeatletter \renewcommand{\@thesubfigure}{\thesubfigure\space}
\renewcommand{\p@subfigure}{} \makeatother
\titleformat*{\section}{\normalsize\centering\bfseries}
\titleformat*{\subsection}{\indent\small\bfseries\hspace{0.4cm}}
\renewcommand\thesection{\Roman{section}.}
\renewcommand\thesubsection{\arabic{subsection}.}
\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}}
\newcommand{\tnewroman}{\fontspec{Times New Roman}}
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
\providecommand{\keywords}[1]
{
\footnotesize
\textbf{Key words --} #1
}
\providecommand{\abstrct}[1]
{
\footnotesize
\textbf{Abstract --} #1
}
\setlength{\parskip}{0.5\baselineskip}
%set font style
\setmainfont{Times New Roman}
\begin{document}
\begin{figure}[H]
\centering
\subfloat{\label{fig:1}\includegraphics[width=0.4\textwidth]{example-image-a}}
\qquad
\caption{subfloat don't work, i want it to be Fig.1(a)}
\label{fig:cont}
\end{figure}
\vspace{-1cm}
\begin{figure}[H]
\ContinuedFloat
\centering
\subfloat{\label{fig:2}\includegraphics[width=0.4\textwidth]{example-image-a}}
\caption{subfloat don't work, i want it to be Fig.1(b)}
\label{fig:cont}
\end{figure}
\begin{figure}[H]
\centering
\subfigure[subfigure work well\label{a}]{\includegraphics[width=.4\textwidth]{example-image-a}} \quad
\subfigure[subfigure work well\label{b}]{\includegraphics[width=.4\textwidth]{example-image-a}}
\caption{}
\label{f8}
\end{figure}
\end{document}
答案1
在以下 MWE 中,我用该subfigure
包替换了已弃用的包subcaption
,并相应地调整了命令的使用\subfloat
:
\documentclass[letterpaper,twocolumn,12pt]{article}
\usepackage{graphicx}
\usepackage{float}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage[labelformat=simple]{subcaption}
\renewcommand{\figurename}{Fig.}
\renewcommand\thesubfigure{\figurename\thefigure(\alph{subfigure})}
\begin{document}
\begin{figure}[H]
\centering
\subfloat[subfloat don't work, i want it to be Fig.1(a)]{\label{fig:1}\includegraphics[width=0.4\textwidth]{example-image-a}}
\end{figure}
\begin{figure}[H]
\ContinuedFloat
\centering
\subfloat[subfloat don't work, i want it to be Fig.1(b)]{\label{fig:2}\includegraphics[width=0.4\textwidth]{example-image-a}}
\end{figure}
\end{document}