我正在写论文。子图的枚举有以下规则:
子图应通过在图名称中添加相应的小写字母来列举,例如图 3.8a
然而,我只能做到 3.8(a)
我正在使用的代码如下:
\begin{figure}[h]
\subfigure[]{\includegraphics[width=\textwidth]{2016.png}
\label{2016}}
\subfigure[]{\includegraphics[width=\textwidth]{2017.png}
\label{2017}}
\caption{Graphs of daily averages of Turkish hourly electricity consumption values in \subref{2016} 2016
\subref{2017} 2017.}
\label{consumptions}
\end{figure}
论文规则告诉我们使用 subfigure 包。我怎样才能得到 3.8a 而不是 3.8(a)?谢谢!
答案1
正如@Zarko 在评论中指出的那样,子图已弃用,现在由子图或者副标题。
为了实现您想要的效果,subcaption
我们将通过添加以下内容来更改默认设置:
\usepackage[labelformat=simple]{subcaption} %%default is [labelformat=parens]
%%Setup for captions
%%If you want figure numbering as 'figure 3.8'
\renewcommand{\thefigure}{\thechapter.\arabic{figure}}
%%if you want 3.8a for subfigure
\renewcommand{\thesubfigure}{\normalsize\thefigure.\alph{subfigure}:}
%%if you want figure 3.8a for subfigure
\renewcommand{\thesubfigure}{\normalsize figure \thefigure.\alph{subfigure}:}
以下是完整的测试代码:
\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[labelformat=simple]{subcaption} %%default is [labelformat=parens]
%%If you want figure numbering as 'figure 3.8'
\renewcommand{\thefigure}{\thechapter.\arabic{figure}}
%%if you want 3.8a
%\renewcommand{\thesubfigure}{\normalsize\thefigure.\alph{subfigure}:}
%%if you want figure 3.8a
\renewcommand{\thesubfigure}{\normalsize figure \thefigure.\alph{subfigure}:}
\begin{document}
\chapter{fist chapter}
\begin{figure}
\centering
\begin{subfigure}{0.45\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{Test}
\end{subfigure}\hfill
\begin{subfigure}{0.45\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image-b}
\caption{Test}
\end{subfigure}
\caption{Total}
\end{figure}
\end{document}
谁产生了以下输出: