我正在使用该caption
包在我的图形下方创建标题和子标题(带有\caption*{}
)。我只是想将子标题的文本格式更改为斜体。我隐约觉得这应该可以通过\captionsetup{}
但我不知道如何实现。如果可能的话,我不想使用该subcaptions
包。
这是一个简单的例子:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage[demo]{graphicx} % demo is just for the example
\begin{document}
\begin{figure}[t]
\includegraphics[width=\textwidth,height=2cm]{x}
\caption{Test 1}
\caption*{This is the subtext to be placed below the caption of the figure. I want this to be in italic without having to type textit every time}
\label{fig:test1}
\end{figure}
\end{document}
答案1
看来该caption
包不提供仅针对命令更改样式的功能。我看到的最简单的方法是按以下方式\caption*
定义一个新命令:\subcaption
\newcommand{\subcaption}[1]{\caption*{\itshape #1}}
平均能量损失
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage[demo]{graphicx} % demo is just for the example
\newcommand{\subcaption}[1]{\caption*{\itshape #1}}
\begin{document}
\begin{figure}[t]
\includegraphics[width=\textwidth,height=2cm]{x}
\caption{Test 1}
\subcaption{This is the subtext to be placed below the caption of the figure. I want this to be in italic without having to type textit every time}
\label{fig:test1}
\end{figure}
\end{document}