我在控制台中收到很多关于 Underfull \hbox(不好...)的警告,其中包含几个子图设置。以下是重现该问题的 MWE:
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[nomath]{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{microtype}
\usepackage{nccmath,amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfig}
\captionsetup{figurename=Figure,margin=1cm,format=hang,font=small,format=plain,labelfont={bf,up},textfont={it}}
\captionsetup[subfigure]{margin=0cm,font=small,format=plain,labelfont={bf,up},textfont={up}}
\begin{document}
\begin{figure}[H] % [ h ], [ b ], [ t ], [ p ]
\centering
\captionsetup[subfigure]{labelformat=empty,justification=Centering}
\subfloat[$\displaystyle{x = 5}$ ; $\displaystyle{y = 0,33}$. \newline \medskip $\displaystyle{x = 1}$ ; $\displaystyle{y \approx 0,87}$. \newline \medskip $\displaystyle{\mathcal{J} \approx 1,75}$ ; $\displaystyle{\mathcal{K} \approx 0,95}$.]{
\includegraphics[height=5cm]{example-image}
}
\qquad
\subfloat[$\displaystyle{x = 5}$ ; $\displaystyle{y = 0,40}$. \newline \medskip $\displaystyle{x \approx 14,6}$ ; $\displaystyle{y \approx 0,13}$. \newline \medskip $\displaystyle{\mathcal{J} \approx 2,18}$ ; $\displaystyle{\mathcal{K} \approx 0,98}$.]{
\includegraphics[height=5cm]{example-image}
}
\newline
\subfloat[$\displaystyle{x = 60}$ ; $\displaystyle{y = 0,036642}$. \newline \medskip $\displaystyle{x \approx 3,78}$ ; $\displaystyle{y \approx 0,50}$. \newline \medskip $\displaystyle{\mathcal{J} \approx 2,20}$ ; $\displaystyle{\mathcal{K} \approx 0,99}$.]{
\includegraphics[height=5cm]{example-image}
}
\qquad
\subfloat[$\displaystyle{x = 60}$ ; $\displaystyle{y = 0,04}$. \newline \medskip $\displaystyle{x \approx 4,99}$ ; $\displaystyle{y \approx 0,43}$. \newline \medskip $\displaystyle{\mathcal{J} \approx 2,40}$ ; $\displaystyle{\mathcal{K} \approx 0,99}$.]{
\includegraphics[height=5cm]{example-image}
}
\caption[Blabla]{Some description.}
\end{figure}
\end{document}
预览:
这段代码我哪里做错了?我该如何解决这些错误?
另外,我怎样才能提高一点垂直空间两个向上的数字和两个向下的数字之间?
答案1
就我个人而言,我会使用完全不同的方法来定位图像及其下方的方程式。在下面的例子中,我minipages
结合使用了 和 ,以便将和alinged
对齐到图像下方。=
\approx
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[nomath]{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{microtype}
\usepackage{nccmath,amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfig}
\captionsetup{figurename=Figure,margin=1cm,format=hang,font=small,format=plain,labelfont={bf,up},textfont={it}}
\captionsetup[subfigure]{margin=0cm,font=small,format=plain,labelfont={bf,up},textfont={up}}
\begin{document}
\begin{figure}[H] % [ h ], [ b ], [ t ], [ p ]
\begin{minipage}{0.45\textwidth}
\includegraphics[height=5cm]{example-image-a}
\[\begin{aligned}
x &= 5 &&; &y &= 0,33 \\
x &= 1 &&; &y &\approx 0,87 \\
\mathcal{J} &\approx 1,75 &&; &\mathcal{K} &\approx 0,95
\end{aligned}\]
\end{minipage}
\quad
\begin{minipage}{0.45\textwidth}
\includegraphics[height=5cm]{example-image-b}
\[\begin{aligned}
x &= 5 &&; &y &= 0,33 \\
x &= 1 &&; &y &\approx 0,87 \\
\mathcal{J} &\approx 1,75 &&; &\mathcal{K} &\approx 0,95
\end{aligned}\]
\end{minipage}
\medskip\medskip
\begin{minipage}{0.45\textwidth}
\includegraphics[height=5cm]{example-image-c}
\[\begin{aligned}
x &= 5 &&; &y &= 0,33 \\
x &= 1 &&; &y &\approx 0,87 \\
\mathcal{J} &\approx 1,75 &&; &\mathcal{K} &\approx 0,95
\end{aligned}\]
\end{minipage}
\quad
\begin{minipage}{0.45\textwidth}
\includegraphics[height=5cm]{example-image}
\[\begin{aligned}
x &= 5 &&; &y &= 0,33 \\
x &= 1 &&; &y &\approx 0,87 \\
\mathcal{J} &\approx 1,75 &&; &\mathcal{K} &\approx 0,95
\end{aligned}\]
\end{minipage}
\caption[Blabla]{Some description.}
\end{figure}
\end{document}
答案2
当我运行您的代码时,我收到由包发出的以下错误消息caption
:
./main.tex:21: Package caption Error: Option `justification=Centering' requires
the `ragged2e' package.
See the caption package documentation for explanation.
Type H <return> for immediate help.
...
l.21 ...labelformat=empty,justification=Centering}
您有两个选择:
ragged2e
如果你想继续使用,请加载软件包justification=Centering
改成
justification=Centering
justification=centering
无论哪种调整,您的代码都能够编译。
顺便说一下,\displaystyle
是一个开关,也就是说,它不是提出论点。