Minipage-Text läuft in den Rand

Minipage-Text läuft in den Rand

Ich versuche, ein Bild und seine Beschriftung auf zwei Miniseiten aufzuteilen, aber die Beschriftung reicht bis in den rechten Seitenrand:

\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}

Bildbeschreibung hier eingeben

Ich habe den Code auf einer Antwort vondiese Frage(die „direkte und robuste Methode“). Mir gefällt diese Methode wegen ihrer Einfachheit, daher möchte ich sie, wenn möglich, nur leicht anpassen.

Wie kann ich verhindern, dass die Überschrift in den Rand hineinragt? Ich habe verschiedene Werte für Minipage und Grafiken ausprobiert width.

BEARBEITEN: Fügen Sie kompilierbaren Code in die Frage ein.

Antwort1

Sie haben die Beschriftungsbreite auf 0,6\Textbreite außerhalb der Miniseite definiert.

\captionsetup{font={normalfont},labelfont=footnotesize, width=.6\textwidth}

Wenn Sie die Breitendefinition ( width=.6\textwidth) entfernen, erhalten Sie das gewünschte Verhalten.

verwandte Informationen