我想使用wrapfigure
环境将文本环绕在图形周围,在环境adjustwidth
内的环境中proof
,但是以下代码
\begin{proof}
\begin{adjustwidth}{2em}{2em}
[...]
[...] arctan a = \frac{\pi}{2} \,$.
%
\begin{wrapfigure}{L}{0.5\textwidth}
\begin{tikzpicture}[scale=3]
[...]
\end{tikzpicture}
\caption{Angles $ \alpha,\beta,\gamma,\delta $} that correspond to $ a,b,c,d $ respectively.
\label{angles}
\end{wrapfigure}
If we try to ``escape'' the inequality by augmenting the difference between two angle [...]
将图放在最后一页:
知道为什么吗?这与环境有关吗adjustwidth
?
编辑:完整的 MWE
\documentclass[10pt,a4paper,usenames,dvipsnames]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage[labelfont=bf]{caption}
\usepackage{tikz}
\usepackage{changepage}
\usepackage{wrapfig}
\usepackage{siunitx}
\usepackage{calc}
\usepackage{array}
\usepackage{pythonhighlight}
\usepackage{multirow}
\usepackage{listings}
\usepackage{framed}
\usepackage[symbol, perpage]{footmisc}
\usepackage{lmodern}
\usepackage{hyperref}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
frame=single,
breaklines=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
}
\usepackage{float}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage{makecell}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{ragged2e}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{equation}{section}
\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}}
\usetikzlibrary{calc}
\usetikzlibrary{quotes, angles, arrows}
\newcommand{\degre}{\ensuremath{^\circ}}
\definecolor{dbwrru}{rgb}{0.8588235294117647,0.3803921568627451,0.0784313725490196}
\definecolor{dtsfsf}{rgb}{0.8274509803921568,0.1843137254901961,0.1843137254901961}
\definecolor{wrwrwr}{rgb}{0.3803921568627451,0.3803921568627451,0.3803921568627451}
\definecolor{rvwvcq}{rgb}{0.08235294117647059,0.396078431372549,0.7529411764705882}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\definecolor{dark blue}{HTML}{002663}
\definecolor{dark green}{HTML}{085e23}
\definecolor{plum}{HTML}{3d085e}
\hypersetup{
colorlinks=true,
linkcolor=dark blue,
filecolor=magenta,
urlcolor=cyan,
}
\begin{document}
If we now think of the elements in $ S $ as the \textit{angles} they map to (through the $ \arctan $ function), instead of their actual values, the inequality becomes intuitively evident.
\begin{proof} \ref{ineq}
\begin{adjustwidth}{2em}{2em}
\ \\
Let $ a $, $ b $, $ c $, $ d $ be elements in $ S $, where $ a>b>c>d $. Let $ \alpha \equiv \arctan a,\ \beta \equiv \arctan b,\ \gamma \equiv \arctan c,\ \delta \equiv \arctan d$ (and therefore let $ \alpha>\beta>\gamma>\delta $).
Since $ a,b,c,d $ are positive, the angles $ \alpha, \beta,\gamma,\delta $ belong to the first quadrant (or the third quadrant):
\begin{equation*}
\begin{gathered}
0 < \theta < \frac{\pi}{2} \quad \mod \pi\\
\forall \theta \in \{\alpha, \beta, \gamma, \delta\}\,.
\end{gathered}
\end{equation*}
Now let us visualize these angles in the first quadrant\footnote{I'm picking just the first quadrant because $\quad \tan (\theta + k\pi) = \tan \theta \ \ \forall k \in \mathbb{Z} \;$.}; see fig. \ref{angles}. If we pick a set $ \{a,b,c,d\} $ such that $ \alpha,\beta,\gamma,\delta $ are equally spaced, we can space them at most by $ \frac{\pi}{6} $, since there are $ 4-1=3 $ pairs of adjacent angles, and $ \frac{\pi}{2} \div 3 = \frac{\pi}{6}$. In fact, the difference between each adjacent angle can only be \textit{less} than $ \frac{\pi}{6} $, since there is no $ a\in \mathbb{R}^+ $ with finite value such that $\alpha = \arctan a = \frac{\pi}{2} \,$\footnote{Because $ \lim\limits_{\theta\rightarrow \frac{\pi}{2}\,^-} \tan \theta = \infty$.}.
%
\begin{wrapfigure}{L}{0.5\textwidth}
\begin{tikzpicture}[scale=3]
\coordinate (A) at (1,0);
\coordinate (B) at (0,0);
\coordinate (C) at ($ (0,0) +(30:1cm)$);
\coordinate (D) at ($ (0,0) +(60:1cm)$);
\coordinate (E) at ($ (0,0) +(90:1cm)$);
%
\draw (0,0) node [right=0.2cm, below=0.5mm] {\textcolor{blue}{$ \delta $}};
\draw (A) -- (B) -- (E)
pic [draw=red!50!black, fill=red!20, angle radius=2.4cm,
"\textcolor{red}{$\alpha$}", pic text options={left=5.5mm, above=.3cm}] {angle = A--B--E};
\draw (A) -- (B) -- (D)
pic [draw=green!50!black, fill=green!20, angle radius=1.7cm,
"\textcolor{dark green}{$\beta$}", pic text options={above=.1cm}] {angle = A--B--D};
\draw (A) -- (B) -- (C)
pic [draw=purple!50!black, fill=purple!20, angle radius=1cm,
"\textcolor{plum}{$\gamma$}", pic text options={right=.05mm}] {angle = A--B--C};
%
\clip (-0.2, -0.2) rectangle (1.2,1.2);
\draw (0,0) circle [radius=1cm];
\fill [white] (0.95, -0.1) rectangle (1.05, 0.1);
\draw (0, -0.2) -- (0,1.2);
\draw (-0.2, 0) -- (1.2,0);
\draw [thick] (A) -- +(90:0.5mm) -- +(270:0.5mm) node [below=.2mm, right=.1 mm] {$ 1 $};
\draw [very thick, blue] (0,0) -- +(0:1cm);
\draw [very thick, purple] (0,0) -- +(30:1cm);
\draw [very thick, green] (0,0) -- +(60:1cm);
\draw [very thick, red] (0,0) -- +(90:1cm);
\draw [thick, dark blue] (C) arc [start angle = 30, end angle = 60, radius = 1cm] node [midway, sloped, above] {\small $ <\frac{\pi}{6} $};
\end{tikzpicture}
\caption{Angles $ \alpha,\beta,\gamma,\delta $} that correspond to $ a,b,c,d $ respectively.
\label{angles}
\end{wrapfigure}
If we try to ``escape'' the inequality by augmenting the difference between two angles---say, for example, that we reduce $ \beta $ so that $ \alpha-\beta>\frac{\pi}{6} $---, we will be forcibly reducing the difference between another pair of adjacent angles---in our example, $ \beta-\gamma $ would be getting smaller---; so there will always be some pair of angles such that $ \theta_2 -\theta_1 < \frac{\pi}{6} $.
\end{adjustwidth}
\end{proof}
答案1
- 首先我从你的 mwe 中真正地认识到 mwe :-)(从序言中删除所有不相关的包,你真的需要它们全部吗?)
- 然后我稍微纠正一下你的
tikz
形象。最重要的是,它不包含空行。 - 插入图像
wrapfigure
可以使用tex
宏insbox
。其语法是:
\InsertBoxR{n}{< content>}[correction]
for box on the right side or
\InsertBoxL{b}{< content>}[correction]
where `n` is number of lines above box and `correction` number of lines needed for correction for box space (especial, when protrude into next paragraph).
用于文本左侧的框。
tikzpicture
与标题一起封装在minipage
环境中- 标题使用包
\captionof{figure}{...}
提供的宏caption
(也可以使用capt-of
包,但caption
提供设计标题的延伸功能) - 不幸的是,
\adjustwidth
来自包的宏changepage
不适用于insbox
(顺便说一句,该包的正确名称是changepage
,chngpage
它是弃用的名称)。插入的段落\InsertBoxR{n}{< content>}[correction]
不遵循文本宽度的变化。
完整 mwe:
\documentclass[10pt,a4paper,usenames,dvipsnames]{article}
\usepackage{graphicx}
\usepackage[skip=1ex, labelfont=bf, font=footnotesize]{caption}
\usepackage{amsmath, amssymb, amsthm}
\input{insbox}%%%%%%%%%%%%%% TeX macro,
\usepackage{tikz}
\usetikzlibrary{angles, arrows,
calc,
quotes,
}
\usepackage{siunitx} % to write units. also defines `\ degree`
%\newcommand{\degre}{\ensuremath{^\circ}} % beter use \si{\degree} or \SI{90}{\degree}
%\from defined colors are used only the following
\definecolor{dark blue}{HTML}{002663}
\definecolor{dark green}{HTML}{085e23}
\definecolor{plum}{HTML}{3d085e}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=dark blue,
filecolor=magenta,
urlcolor=cyan,
}
\begin{document}
If we now think of the elements in $ S $ as the \textit{angles} they map to (through the $ \arctan $ function), instead of their actual values, the inequality becomes intuitively evident.
\begin{proof} \label{ineq}% <--- \label{...} not \ref{ineq} ?!
Let $ a $, $ b $, $ c $, $ d $ be elements in $ S $, where $ a>b>c>d $. Let $ \alpha \equiv \arctan a,\ \beta \equiv \arctan b,\ \gamma \equiv \arctan c,\ \delta \equiv \arctan d$ (and therefore let $ \alpha>\beta>\gamma>\delta $).
Since $ a,b,c,d $ are positive, the angles $ \alpha, \beta,\gamma,\delta $ belong to the first quadrant (or the third quadrant):
\begin{gather*}
0 < \theta < \frac{\pi}{2} \quad \mod \pi\\
\forall \theta \in \{\alpha, \beta, \gamma, \delta\}\,.
\end{gather*}
\InsertBoxR{2}{\begin{minipage}{0.45\linewidth}\centering
\begin{tikzpicture}[scale=3]
\coordinate[label=below right:1] (A) at (1,0);
\coordinate[label=below right:
\textcolor{blue}{$\delta $}] (B) at (0,0);
\coordinate (C) at ($(B)+(30:1cm)$);
\coordinate (D) at ($(B)+(60:1cm)$);
\coordinate (E) at ($(B)+(90:1cm)$);
%
\draw (A) -- (B) -- (E)
pic [draw=red!50!black, fill=red!20, angle radius=2.4cm,
"\textcolor{red}{$\alpha$}",
pic text options={left=5.5mm, above=.3cm}] {angle = A--B--E};
\draw (A) -- (B) -- (D)
pic [draw=green!50!black, fill=green!20, angle radius=1.7cm,
"\textcolor{dark green}{$\beta$}",
pic text options={above=.1cm}] {angle = A--B--D};
\draw (A) -- (B) -- (C)
pic [draw=purple!50!black, fill=purple!20, angle radius=1cm,
"\textcolor{plum}{$\gamma$}",
pic text options={right=.05mm}] {angle = A--B--C};
%
\clip (-0.2, -0.2) rectangle (1.2,1.2);
\draw (B) circle [radius=1cm];
\fill [white] (0.95, -0.1) rectangle (1.05, 0.1);
\draw (0, -0.2) -- (0,1.2);
\draw (-0.2, 0) -- (1.2,0);
\draw [thick] (A) +(0,0.5mm) -- + (0,-0.5mm);
%
\draw [very thick, blue] (B) -- +(0:1cm);
\draw [very thick, purple] (B) -- +(30:1cm);
\draw [very thick, green] (B) -- +(60:1cm);
\draw [very thick, red] (B) -- +(90:1cm);
%
\draw [thick, dark blue] (C) arc (30:60:1cm) node [midway, sloped, above] {\small $ <\frac{\pi}{6} $};
\end{tikzpicture}
\captionof{figure}{Angles $\alpha,\beta,\gamma,\delta$ that correspond to $a,b,c,d$ respectively.}
\label{angles}
\end{minipage}%
}[5]
Now let us visualize these angles in the first quadrant\footnote{I'm picking just the first quadrant because $\quad \tan (\theta + k\pi) = \tan \theta \ \ \forall k \in \mathbb{Z} \;$.}; see fig. \ref{angles}. If we pick a set $ \{a,b,c,d\} $ such that $ \alpha,\beta,\gamma,\delta $ are equally spaced, we can space them at most by $ \frac{\pi}{6} $, since there are $ 4-1=3 $ pairs of adjacent angles, and $ \frac{\pi}{2} \div 3 = \frac{\pi}{6}$. In fact, the difference between each adjacent angle can only be \textit{less} than $ \frac{\pi}{6} $, since there is no $ a\in \mathbb{R}^+ $ with finite value such that $\alpha = \arctan a = \frac{\pi}{2} \,$\footnote{Because $ \lim\limits_{\theta\rightarrow \frac{\pi}{2}\,^-} \tan \theta = \infty$.}.
If we try to ``escape'' the inequality by augmenting the difference between two angles---say, for example, that we reduce $ \beta $ so that $ \alpha-\beta>\frac{\pi}{6} $---, we will be forcibly reducing the difference between another pair of adjacent angles---in our example, $ \beta-\gamma $ would be getting smaller---; so there will always be some pair of angles such that $ \theta_2 -\theta_1 < \frac{\pi}{6} $.
\end{proof}
\end{document}
注意:包hyperref
必须在序言中最后加载(很少有例外)。