子图本身的标题索引

子图本身的标题索引

我正在使用 \subfigure 包和一些类似这样的代码:

\begin{figure}
     \centering
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{graph1}
         \caption{$y=x$}
         \label{fig:y equals x}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{graph2}
         \caption{$y=3sinx$}
         \label{fig:three sin x}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{graph3}
         \caption{$y=5/x$}
         \label{fig:five over x}
     \end{subfigure}
        \caption{Three simple graphs}
        \label{fig:three graphs}
\end{figure}

我想在图像本身上找到标题枚举器,例如: 在此处输入图片描述

具有以下参数:粗体、大写字母(例如 sc,我找不到将 sc 和 bf 合并在一起的好方法)和方括号。

知道如何定义这样的事物吗?

谢谢你!

答案1

垂直叠加某些内容的最简单方法是使用\raisebox,同时更改基线和\smash高度。但是,\caption必须进入minipage\parbox\vbox

\documentclass{article}

\usepackage{graphicx}
\usepackage{subcaption}

\renewcommand{\thesubfigure}{\Alph{subfigure}}
\DeclareCaptionLabelFormat{weird}{\textbf{[#2]}}
\captionsetup[subfigure]{labelformat=weird, labelsep=quad}

\begin{document}

\begin{figure}
    \captionsetup[subfigure]{singlelinecheck=false}
     \centering
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{example-image-a}
         \raisebox{\baselineskip}[0pt][0pt]{\begin{minipage}[b]{\dimexpr \linewidth-1em}
           \caption{$y=x$}
           \label{fig:y equals x}
         \end{minipage}}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{example-image-b}
         \raisebox{\baselineskip}[0pt][0pt]{\parbox[b]{\dimexpr \linewidth-1em}{%
           \caption{$y=3\sin x$}
           \label{fig:three sin x}
         }}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{example-image-c}
         \raisebox{\baselineskip}[0pt][0pt]{\advance\hsize by -1em\vbox{%
           \caption{$y=5/x$}
           \label{fig:five over x}
         }}
     \end{subfigure}
        \caption{Three simple graphs}
        \label{fig:three graphs}
\end{figure}

\end{document}

另一种方法是使用负面\vspace

\documentclass{article}

\usepackage{graphicx}
\usepackage{subcaption}

\renewcommand{\thesubfigure}{\Alph{subfigure}}
\DeclareCaptionLabelFormat{brackets}{\textbf{[#2]}}
\captionsetup[subfigure]{labelformat=brackets, labelsep=quad}

\begin{document}

\begin{figure}
    \captionsetup[subfigure]{singlelinecheck=false}
     \centering
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{example-image-a}
         \vskip-\abovecaptionskip\vskip-\baselineskip
         \begin{minipage}[b]{\dimexpr \linewidth-1em}
           \caption{$y=x$}
           \label{fig:y equals x}
         \end{minipage}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{example-image-b}
         \vskip-\abovecaptionskip\vskip-\baselineskip
         \parbox[b]{\dimexpr \linewidth-1em}{%
           \caption{$y=3\sin x$}
           \label{fig:three sin x}
         }
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.3\textwidth}
         \centering
         \includegraphics[width=\textwidth]{example-image-c}
         \vskip-\abovecaptionskip\vskip-\baselineskip
         \makebox[\linewidth]{\advance\hsize by -1em\vbox{% \centering ineffective
           \caption{$y=5/x$}
           \label{fig:five over x}
         }}
     \end{subfigure}
        \caption{Three simple graphs}
        \label{fig:three graphs}
\end{figure}

\end{document}

相关内容