我怎样才能将方程式包裹在 TikZ 图片周围?

我怎样才能将方程式包裹在 TikZ 图片周围?

我正在尝试将图像排列在方程式的左侧,如果有人能给我指出正确的方向,我将不胜感激。我试过使用wrapfig,但我真的无法将它与方程式整合在一起,只能与文本整合在一起。

在此处输入图片描述

以下是相关代码:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm,top=3cm]{geometry}
\usepackage[nottoc,notlof,notlot]{tocbibind}
\usepackage[titles,subfigure]{tocloft}
 \usepackage{amssymb,amsmath,fancyhdr,graphicx,booktabs,array,paralist,verbatim,subfig,sectsty,mathtools,hyperref,tikz}
\usepackage[long]{datetime}
\usetikzlibrary{decorations.markings}
\geometry{a4paper}
\begin{document}

\begin{center}
\begin{tikzpicture}[arrowmark/.style 2 args={decoration={markings,mark=at     position #1 with \arrow{#2}}}] 
 \draw[-latex] (-0.5,0) -- (3,0)node[right]{$x$};
 \draw[-latex] (0,-0.5) -- (0,3)node[above]{$y$};
 \filldraw[fill=gray] ({0.4*sqrt(5)},{0.2*sqrt(5)}) arc [radius=1, start     angle=atan(0.5), delta angle=atan(2)-atan(0.5)]
                           -- ({0.4*sqrt(5)},{0.8*sqrt(5)}) arc [radius=2,     start angle=atan(2), delta angle=-atan(2)+atan(0.5)]
                           -- cycle;
 \draw[dashed] (0,0) -- (1.5,3)node[right] {$y=\frac{x}{a}$};
 \draw[dashed] (0,0) -- (3,1.5)node[right] {$y=ax$};
 \draw (1,0) arc (0:90:1cm); 
 \draw (2,0) arc (0:90:2cm); 
 \node [font=\small] [below] at (-0.1,1.24) {1};
 \node [font=\small] [below] at (-0.1,2.24) {2};
 \draw[<-,rotate=45] (2.1,0) -- +(0.5,0) node[anchor=west,pos=0.7,above right]    {$\partial S$};   
 \draw[thick,postaction={decorate}, arrowmark={0.09}{<},arrowmark={0.3}{<},     arrowmark={0.7}{<},arrowmark={0.5}{<},arrowmark={.875}{<}
    ]  ({0.4*sqrt(5)},{0.2*sqrt(5)}) arc [radius=1, start angle=atan(0.5),     delta angle=atan(2)-atan(0.5)]
                           -- ({0.4*sqrt(5)},{0.8*sqrt(5)}) arc [radius=2,     start angle=atan(2), delta angle=-atan(2)+atan(0.5)]
                  -- cycle;
\end{tikzpicture}
\end{center}
\begin{equation*}
\begin{aligned}[c]
\text{The lower line:}& ~~\textbf{r}_1(t)=(t,at) \text{ for } t \in     \bigg{[}\frac{1}{\sqrt{1+a^2}},\frac{2}{\sqrt{1+a^2}}\bigg{]}\\
\text{The outer circle:}& ~~\textbf{r}_2(t)=(2\cos t,2\sin t) \text{ for }  t     \in \bigg{[}\arctan{a},\arctan{\frac{1}{a}}\bigg{]}\\
\text{The upper line:}&~~\textbf{r}_3(t)=(at,t) \text{ for } t \in \bigg{[}\frac{1}{\sqrt{1+a^2}},\frac{2}{\sqrt{1+a^2}}\bigg{]}\\
\text{The inner circle:}&~~\textbf{r}_4(t)=(\cos t,-\sin t) \text{ for } t \in     \bigg{[}-\arctan{\frac{1}{a}},-\arctan{a}\bigg{]}
\end{aligned}
\end{equation*}
\end{document}

答案1

您可以使用minipage

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm,top=3cm]{geometry}
\usepackage[nottoc,notlof,notlot]{tocbibind}
\usepackage[titles,subfigure]{tocloft}
 \usepackage{showframe,amssymb,amsmath,fancyhdr,graphicx,booktabs,array,paralist,verbatim,subfig,sectsty,mathtools,hyperref,tikz}
\usepackage[long]{datetime}
\usetikzlibrary{decorations.markings}
\geometry{a4paper}
\begin{document}
\noindent
\begin{minipage}{0.3\textwidth}
\centering
\begin{tikzpicture}[arrowmark/.style 2 args={decoration={markings,mark=at     position #1 with \arrow{#2}}}]
 \draw[-latex] (-0.5,0) -- (3,0)node[right]{$x$};
 \draw[-latex] (0,-0.5) -- (0,3)node[above]{$y$};
 \filldraw[fill=gray] ({0.4*sqrt(5)},{0.2*sqrt(5)}) arc [radius=1, start     angle=atan(0.5), delta angle=atan(2)-atan(0.5)]
                           -- ({0.4*sqrt(5)},{0.8*sqrt(5)}) arc [radius=2,     start angle=atan(2), delta angle=-atan(2)+atan(0.5)]
                           -- cycle;
 \draw[dashed] (0,0) -- (1.5,3)node[right] {$y=\frac{x}{a}$};
 \draw[dashed] (0,0) -- (3,1.5)node[right] {$y=ax$};
 \draw (1,0) arc (0:90:1cm);
 \draw (2,0) arc (0:90:2cm);
 \node [font=\small] [below] at (-0.1,1.24) {1};
 \node [font=\small] [below] at (-0.1,2.24) {2};
 \draw[<-,rotate=45] (2.1,0) -- +(0.5,0) node[anchor=west,pos=0.7,above right]    {$\partial S$};
 \draw[thick,postaction={decorate}, arrowmark={0.09}{<},arrowmark={0.3}{<},     arrowmark={0.7}{<},arrowmark={0.5}{<},arrowmark={.875}{<}
    ]  ({0.4*sqrt(5)},{0.2*sqrt(5)}) arc [radius=1, start angle=atan(0.5),     delta angle=atan(2)-atan(0.5)]
                           -- ({0.4*sqrt(5)},{0.8*sqrt(5)}) arc [radius=2,     start angle=atan(2), delta angle=-atan(2)+atan(0.5)]
                  -- cycle;
\end{tikzpicture}
\end{minipage}%
\begin{minipage}{0.7\textwidth}
\begin{equation*}
\begin{aligned}[c]
\text{The lower line:}& ~~\textbf{r}_1(t)=(t,at) \text{ for } t \in     \bigg{[}\frac{1}{\sqrt{1+a^2}},\frac{2}{\sqrt{1+a^2}}\bigg{]}\\
\text{The outer circle:}& ~~\textbf{r}_2(t)=(2\cos t,2\sin t) \text{ for }  t     \in \bigg{[}\arctan{a},\arctan{\frac{1}{a}}\bigg{]}\\
\text{The upper line:}&~~\textbf{r}_3(t)=(at,t) \text{ for } t \in \bigg{[}\frac{1}{\sqrt{1+a^2}},\frac{2}{\sqrt{1+a^2}}\bigg{]}\\
\text{The inner circle:}&~~\textbf{r}_4(t)=(\cos t,-\sin t) \text{ for } t \in     \bigg{[}-\arctan{\frac{1}{a}},-\arctan{a}\bigg{]}
\end{aligned}
\end{equation*}
\end{minipage}
\end{document}

在此处输入图片描述

如果您不想自己找出宽度,请使用tabularx

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm,top=3cm]{geometry}
\usepackage[nottoc,notlof,notlot]{tocbibind}
\usepackage[titles,subfigure]{tocloft}
 \usepackage{showframe,amssymb,amsmath,fancyhdr,graphicx,booktabs,array,paralist,verbatim,subfig,sectsty,mathtools,hyperref,tikz}
\usepackage[long]{datetime}
\usetikzlibrary{decorations.markings}
\geometry{a4paper}
\usepackage{tabularx}
\def\tabularxcolumn#1{b{#1}}
\begin{document}
\begin{tabularx}{\textwidth}{@{}c@{}X@{}}
\begin{tikzpicture}[arrowmark/.style 2 args={decoration={markings,mark=at     position #1 with \arrow{#2}}}]
 \draw[-latex] (-0.5,0) -- (3,0)node[right]{$x$};
 \draw[-latex] (0,-0.5) -- (0,3)node[above]{$y$};
 \filldraw[fill=gray] ({0.4*sqrt(5)},{0.2*sqrt(5)}) arc [radius=1, start     angle=atan(0.5), delta angle=atan(2)-atan(0.5)]
                           -- ({0.4*sqrt(5)},{0.8*sqrt(5)}) arc [radius=2,     start angle=atan(2), delta angle=-atan(2)+atan(0.5)]
                           -- cycle;
 \draw[dashed] (0,0) -- (1.5,3)node[right] {$y=\frac{x}{a}$};
 \draw[dashed] (0,0) -- (3,1.5)node[right] {$y=ax$};
 \draw (1,0) arc (0:90:1cm);
 \draw (2,0) arc (0:90:2cm);
 \node [font=\small] [below] at (-0.1,1.24) {1};
 \node [font=\small] [below] at (-0.1,2.24) {2};
 \draw[<-,rotate=45] (2.1,0) -- +(0.5,0) node[anchor=west,pos=0.7,above right]    {$\partial S$};
 \draw[thick,postaction={decorate}, arrowmark={0.09}{<},arrowmark={0.3}{<},     arrowmark={0.7}{<},arrowmark={0.5}{<},arrowmark={.875}{<}
    ]  ({0.4*sqrt(5)},{0.2*sqrt(5)}) arc [radius=1, start angle=atan(0.5),     delta angle=atan(2)-atan(0.5)]
                           -- ({0.4*sqrt(5)},{0.8*sqrt(5)}) arc [radius=2,     start angle=atan(2), delta angle=-atan(2)+atan(0.5)]
                  -- cycle;
\end{tikzpicture}
&
\begin{equation*}
\begin{aligned}[c]
\text{The lower line:}& ~~\textbf{r}_1(t)=(t,at) \text{ for } t \in     \bigg{[}\frac{1}{\sqrt{1+a^2}},\frac{2}{\sqrt{1+a^2}}\bigg{]}\\
\text{The outer circle:}& ~~\textbf{r}_2(t)=(2\cos t,2\sin t) \text{ for }  t     \in \bigg{[}\arctan{a},\arctan{\frac{1}{a}}\bigg{]}\\
\text{The upper line:}&~~\textbf{r}_3(t)=(at,t) \text{ for } t \in \bigg{[}\frac{1}{\sqrt{1+a^2}},\frac{2}{\sqrt{1+a^2}}\bigg{]}\\
\text{The inner circle:}&~~\textbf{r}_4(t)=(\cos t,-\sin t) \text{ for } t \in     \bigg{[}-\arctan{\frac{1}{a}},-\arctan{a}\bigg{]}
\end{aligned}
\end{equation*}
\end{tabularx}
\end{document}

请注意,该showframe包仅用于演示。请勿在实际情况下使用它。

相关内容