![围绕 align* 环境环绕文本](https://linux22.com/image/354514/%E5%9B%B4%E7%BB%95%20align*%20%E7%8E%AF%E5%A2%83%E7%8E%AF%E7%BB%95%E6%96%87%E6%9C%AC.png)
有没有办法让我在类似下面的环境中换行?我是 LaTeX 新手,我到处搜索,但找不到有关如何在数学环境中换行的帮助。
\begin{align*}
...
\end{align*}
答案1
您必须使用环境-ed
的变体amsmath
。但是,我认为简单的 TeX 宏包可以insbox
以简单的方式产生更好的结果,使用命令\InsertBoxR
,它接受两个强制参数:段落开头未触及的行数;及其内容。可选参数(作为最后的参数)是一个等于补充短行数量的整数,以防 TeX 无法正确计算短行数量。
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{wrapfig}
\usepackage{amsmath}
\usepackage{lipsum}
\input{insbox}
\makeatletter
\@InsertBoxMargin =1em
\makeatother
\begin{document}
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
\begin{wrapfigure}[5]{r}{0cm}
\fcolorbox{Tomato}{white}{$\begin{aligned}
x & = 2 \\
3y & = 4
\end{aligned}$}
\end{wrapfigure}
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
\InsertBoxR{2}{\fcolorbox{Tomato}{white}{$\begin{aligned}
x & = 2 \\
3 y& = 4
\end{aligned}$}}
\lipsum
\end{document}
答案2
您可以在问题中使用您提供的两个包作为标签!amsmath
和wrapfig
,例如如下:
\documentclass{article}
\usepackage{wrapfig}
\usepackage{amsmath}
\begin{document}
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
\begin{wrapfigure}[4]{r}{2cm}
\[
\begin{aligned}
1 & 2 \\
3 & 4
\end{aligned}
\]
\end{wrapfigure}
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
\end{document}
要探索更多选项,请查看每个选项的文档:
texdoc wrapfig
texdoc amsmath