我正在使用 Springer 的 latex 文件创建一本专著。模板可以在这里找到:
尝试使用子图时,文档按预期编译,但出现错误:环境子图未定义。这是我正在使用的代码(顺便说一下,在 Overleaf 中):
%%%%%%%%%%%%%%%%%%%% book.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% sample root file for the chapters of your "monograph"
%
% Use this file as a template for your own input.
%
%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%%
% RECOMMENDED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[graybox,envcountchap,sectrefs]{svmono}
% choose options for [] as required from the list
% in the Reference Guide
%\usepackage{mathptmx}
%\usepackage{helvet}
%\usepackage{courier}
%
\usepackage{type1cm}
\usepackage{makeidx} % allows index generation
\usepackage{graphicx} % standard LaTeX graphics tool
% when including figure files
\usepackage{multicol} % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{newtxtext} %
\usepackage[varvw]{newtxmath} % selects Times Roman as basic font
% see the list of further useful packages
% in the Reference Guide
\makeindex % used for the subject index
% please use the style svind.ist with
% your makeindex program
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{Chapter Heading}
\begin{figure}[!htb]
\begin{subfigure}
\includegraphics[width=.45\textwidth]{figure}
\end{subfigure}
\begin{subfigure}
\includegraphics[width=.45\textwidth]{figure}
\end{subfigure}
\caption{Some random caption}
\label{fig1}
\end{figure}
\end{document}
我尝试使用 subcaption 包,但这会删除所有图形标题的格式。有人可以提供一些如何解决这个问题的提示吗?
答案1
caption
和软件包subcaption
与 不兼容svmono
。但是subfig
,只要您使用caption=false
选项加载它,就可以。
%%%%%%%%%%%%%%%%%%%% book.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% sample root file for the chapters of your "monograph"
%
% Use this file as a template for your own input.
%
%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%%
% RECOMMENDED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[graybox,envcountchap,sectrefs]{svmono}
% choose options for [] as required from the list
% in the Reference Guide
%\usepackage{mathptmx}
%\usepackage{helvet}
%\usepackage{courier}
%
%\usepackage{type1cm} % don't use it
\usepackage[T1]{fontenc}
\usepackage{makeidx} % allows index generation
\usepackage{graphicx} % standard LaTeX graphics tool
% when including figure files
\usepackage{multicol} % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{newtxtext} %
\usepackage[varvw]{newtxmath} % selects Times Roman as basic font
% see the list of further useful packages
% in the Reference Guide
\usepackage[caption=false]{subfig}
\makeindex % used for the subject index
% please use the style svind.ist with
% your makeindex program
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{Chapter Heading}
\begin{figure}[!htbp]
\subfloat[Subcaption]{\includegraphics[width=.45\textwidth]{example-image}}
\quad
\subfloat[]{\includegraphics[width=.45\textwidth]{example-image}}
\caption{Some random caption}
\label{fig1}
\end{figure}
\end{document}
我添加了子标题(一个为空,仅作为示例。
如果您不需要副标题或者至少不需要字母,只需将图像放置在您想要的位置:
\begin{figure}[!htb]
\includegraphics[width=.45\textwidth]{example-image}\quad
\includegraphics[width=.45\textwidth]{example-image}
\caption{Some random caption}
\label{fig1}
\end{figure}