提问于:
浏览数:
5570
想在文本框中插图,却总是报错
\documentclass[11pt,a4paper]{ctexart}
\usepackage{graphicx}
\usepacage{subfigure}
\usepackage{float}
\usepackage{framed}
\begin{document}
\begin{framed}
\begin{figure}
\centering
\includegraphics[width=0.7\textwidth]{sw1.png}
\caption{}
\label{fig:srfc}
\end{figure}
\end{framed}
\end{document}
下面是报错内容:
Not in outer par mode. \centering
Undefined control sequence. \centering
Missing number, treated as zero. \centering
Font shape `U/rsfs/m/n' in size <15> not available(Font) size <14> substituted
Font shape `U/rsfs/m/n' in size <10> not available(Font) size <10> substituted
Font shape `U/rsfs/m/n' in size <7> not available(Font) size <7> substituted
Underfull \vbox (badness 10000) detected
Overfull \vbox (2.2258pt too high) detected
Underfull \vbox (badness 3679) detected
Underfull \vbox (badness 10000) detected
Overfull \vbox (2.2258pt too high) detected
Underfull \vbox (badness 10000) detected
Overfull \vbox (2.2258pt too high) detected
Underfull \vbox (badness 1005) detected
Size substitutions with differences(Font) up to 0.6pt have occurred.
3 回答
1
```tex
\documentclass[11pt,a4paper]{ctexart}
\usepackage{framed}
\usepackage{caption}
\usepackage{mwe}
\begin{document}
\begin{framed}
\centering
\includegraphics[width=0.7\textwidth]{example-image}
\captionof{figure}{实验图}
\end{framed}
\end{document}
```
-
回复 undefined :这是另一个问题。还想继续提问就再开个帖子 – 啸行 2019-11-13 16:39 回复
-
那么能不能加入并排图片呢 – Atletico 2019-11-13 15:08 回复
1
不可以在frame等静态环境中使用浮动体环境,但反过来是可以的,如:
```tex
\documentclass[11pt,a4paper]{ctexart}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{float}
\usepackage{framed}
\usepackage{mwe}
\begin{document}
\begin{figure}
\begin{framed}
\centering
\includegraphics[width=0.7\textwidth]{example-image-a}
\caption{test}
\label{fig:srfc}
\end{framed}
\end{figure}
\end{document}
```
另外,MWE中`\usepacage{subfigure}`是错误的,应该是`\usepackage{subfigure}`。
1
`frame` 里不用浮动体就行了。在那种环境里没法浮动。
你的回答
请登录后回答
你的回答将会帮助更多人,请务必认真回答问题。