我试图将一张图片及其标题拆分到两个小页面上,但标题却超出了页面的右边距:
\documentclass[a4paper, 12pt]{article}
\usepackage{ifpdf}
\usepackage[latin1]{inputenc}
\usepackage[margin=2cm, left=2cm, top = 2cm, bottom=2cm]{geometry}
\usepackage{amsmath, mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{epigraph}
\usepackage{wasysym}
\usepackage[none]{hyphenat}
\usepackage[super]{nth}
\usepackage{textcomp}
\usepackage[usenames]{xcolor}
\usepackage{hyperref}
\usepackage[authoryear]{natbib}
\usepackage{comment}
\usepackage{setspace}
\usepackage{float}
\usepackage{dcolumn}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{multicol}
%\usepackage[symbol]{footnotemisc}
\usepackage{siunitx}
\usepackage{dcolumn,booktabs}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\let\oldFootnote\footnote
\newcommand\nextToken\relax
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\renewcommand\footnote[1]{%
\oldFootnote{#1}\futurelet\nextToken\isFootnote}
\newcommand\isFootnote{%
\ifx\footnote\nextToken\textsuperscript{,}\fi}
\captionsetup{font={normalfont},labelfont=footnotesize, width=.6\textwidth}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\newcommand\cjaa{Chinese Journal of Astronomy \& Astrophysics}
\newcommand\pasp{Astronomical Society of the Pacific, Publications}
\newcommand\apj{The Astrophysical Journal}
\usepackage{setspace}
%\singlespacing
%\onehalfspacing
\doublespacing
%\setstretch{1.1}
\begin{document}
The original spectrum, taken by Green and Schmidt, is shown in Figure \ref{fig:3c273 spectrum}.\\
\begin{figure}[h!]
\begin{minipage}[c]{0.5\textwidth}
\includegraphics[width=0.9\textwidth]{"../3c273 spectrum"}
\end{minipage}\hfill
\begin{minipage}[c]{0.4\textwidth}
\caption[3C 273 spectrum]{Spectrum of the quasar 3C 273. Comparison spectrum is H + He + Ne. Redshifted emission lines of H and O\textsc{iii} are indicated.} \label{fig:3c273 spectrum}
\end{minipage}
\end{figure}
\\
Correcting for cosmological expansion yields a redshift for 3C 273 of 0.154, close to the
\end{document}
我根据以下答案编写了代码这个问题(“直接而稳健的方法”)。我喜欢这种方法,因为它很简单,所以如果可能的话,我只想稍微调整一下。
如何才能防止标题超出页边距?我尝试了 minipage 和 graphics 的几个不同值width
。
编辑:将可编译代码放入问题中。
答案1
您将标题宽度定义为小页面外的 0.6\textwidth。
\captionsetup{font={normalfont},labelfont=footnotesize, width=.6\textwidth}
如果删除宽度定义(width=.6\textwidth
),您将获得您想要的行为。