跳到正文

Scissor LaTeX 中的 float、wrapfig 和 rotating

float、wrapfig 和 rotating 宏包在 Scissor LaTeX 中部分可用:float 的 [H] 能让图准确地留在你写下它的位置,而 wrapfigure 和 wraptable 会变成普通的居中浮动体,文字不会环绕它们,sidewaysfigure 和 sidewaystable 不会旋转,\newfloat 和 \restylefloat 无法识别。

宏包的作用

  • float 增加了位置参数 [H](“就放在这里,不要移动”),以及用于自定义浮动体类型和样式的 \newfloat 和 \restylefloat。
  • wrapfig 增加了 wrapfigure 和 wraptable,它们位于正文一侧,段落文字环绕在周围。
  • rotating 增加了 sidewaysfigure 和 sidewaystable,它们会把浮动体旋转 90 度并单独放在一页上,还提供可用于任何内容的 turn 和 rotate 环境。

这里可用的功能

功能在 Scissor LaTeX 中说明
\begin{figure}[H]可用图留在它在正文中的位置。
\newfloat, \floatstyle, \restylefloat不支持会被跳过并在“问题”标签页中注明,它们的参数会作为文本输出。
wrapfigure, wraptable部分可用变成带标题的普通居中图或表。文字不会环绕,宽度被忽略。
sidewaysfigure, sidewaystable部分可用变成普通的图或表,不会旋转。
landscape(pdflscape、lscape)部分可用内容保留在普通页面上。
turn, rotate 环境不支持内容保留但不旋转,角度会作为文本输出。

示例

[H] 让图留在两段文字之间:

[H] 把图放在这里

LaTeX导言区: \usepackage{float}在编辑器中打开 (在新标签页中打开)
John Doe measured the length of 44 rods.
\begin{figure}[H]
  \centering
  \fbox{Histogram of the rod lengths}
  \caption{Rod lengths.}
\end{figure}
Most rods are close to the mean.
由 Scissor LaTeX 排版: [H] 把图放在这里

wrapfigure 变成普通的居中图,文字在它下方继续:

没有环绕效果的 wrapfigure

LaTeX导言区: \usepackage{wrapfig}在编辑器中打开 (在新标签页中打开)
\begin{wrapfigure}{r}{0.4\textwidth}
  \centering
  \fbox{Portrait}
  \caption{Erika Mustermann.}
\end{wrapfigure}
Erika Mustermann has led the lab since 2021. In a TeX installation
this paragraph would flow around the portrait on the right; here it
starts below the figure.
由 Scissor LaTeX 排版: 没有环绕效果的 wrapfigure

sidewaystable 保留其内容,但不旋转:

sidewaystable 不会旋转

LaTeX导言区: \usepackage{rotating}在编辑器中打开 (在新标签页中打开)
\begin{sidewaystable}
  \centering
  \caption{A wide table.}
  \begin{tabular}{lrrrr}
    Year & Q1 & Q2 & Q3 & Q4 \\
    2025 & 44 & 47 & 51 & 50 \\
  \end{tabular}
\end{sidewaystable}

兼容性

  • 从 TeX 发行版迁移到这里: 文档可以排版。文字环绕的图会显示为全宽的浮动体,旋转的浮动体会保持直立,所以很宽的表格可能会超出页边距。
  • 从这里迁移到 TeX 发行版: 文档无需修改即可在那里编译,环绕和旋转效果都会生效。

完整手册见 CTAN:ctan.org/pkg/float、ctan.org/pkg/wrapfig 和 ctan.org/pkg/rotating。关于位置的一般说明,请参阅浮动体:放置图和表。

另请参阅浮动体、图和图像和 caption、subcaption。

常见问题

如何防止图移动位置?

加载 float 并写 \begin{figure}[H]。在这里,使用 h 的位置参数同样能让图留在原处。

文字能环绕图像吗?

暂时还不能。wrapfigure 会显示为普通的图,位于后续文字的上方。

本页的每个示例都在构建网站时由 Scissor LaTeX 排版。 最后更新:2026-11-07