这是我的代码:
\begin{document}
Formally, a streaming string transducer is a 8-tuple $(Q,\Sigma_1,\Sigma_2,X,F,\delta,\gamma,q_0)$ machine, where
$Q$ is a finite set of states, $\Sigma_1$ is a finite set of input symbols, $\Sigma_2$ is a finite set of output symbols,
$X$ is a finite set of string variables, $F$ is a partial output function from $Q$ to $(\Sigma_2 \cup X)^*$ with constraint of copyless assignment,
$\delta$ is a state transition function from $(Q \times \Sigma_1)$ to $Q$,
$\gamma$ is a variable update function from $(Q \times \Sigma_1 \times X)$ to $(\Sigma_2 \cup X)^*$ using copyless assignments and $q_0 \in Q$ is an initial state.
\begin{figure}
\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=5 cm, scale = 0.5, transform shape]
% \tikzstyle{every state}=[fill=white,draw=none,text=black]
\node[initial,state] (A) {$s_0$};
\node[state] (B) [right of=A] {$s_1$};
\path[->] (A) edge [bend left] node [align=center] {$a \rightarrow$ $[x = x.a, y = a.y]$\\$b \rightarrow$ $[x = x.b, y = b.y]$} (B)
(B) edge [bend left] node [align=center] {$a \rightarrow$ $[x = x.a, y = a.y]$\\$b \rightarrow$ $[x = x.b, y = b.y]$} (A);
\end{tikzpicture}
\caption{An example of SST}
\end{figure}
\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=5 cm, scale = 0.5, transform shape]
% \tikzstyle{every state}=[fill=white,draw=none,text=black]
\node[initial,state] (A) {$s_0$};
\node[state] (B) [right of=A] {$s_1$};
\path[->] (A) edge [bend left] node [align=center] {$a \rightarrow$ $[x = x.a, y = a.y]$\\$b \rightarrow$ $[x = x.b, y = b.y]$} (B)
(B) edge [bend left] node [align=center] {$a \rightarrow$ $[x = x.a, y = a.y]$\\$b \rightarrow$ $[x = x.b, y = b.y]$} (A);
\end{tikzpicture}
The semantics of a DSST is defined in terms of the summary of a computation of a DSST. Summaries are of the form
$(q, s)$ where $q$ is a state and $s$ is valuation from $X$ to $\Sigma_2^*$ that can be extended to a valuation from $(\Sigma_2 \cup X)^*$ to
$\Sigma_2^*$. Initially each variable maps to the empty string. The transition function is defined by
$\psi((q,s),a) = (\delta(q,a), s')$ and for each variable $x$, $s'(x)$ = $s(\gamma(q,a,x))$. For an input
string $w \in \Sigma_1^*$, if $\psi^*((q_0,s_0),w) = (q, s)$, then if $F(q)$ is defined then output string will
be $s(F(q))$ otherwise it will be undefined.
\end{document}
那么我该如何将内容放在 tikzpicture 旁边呢?
答案1
我不确定你想要什么。所以我给出了两个解决方案……
文本围绕图像流动
使用wrapfig
包使普通文本围绕图像流动。使用环境{wrapfig}
而不是{figure}
。它需要两个参数,第一个是垂直位置,可以是l
eft、r
ight、i
nner 或o
uter。第二个给出图像的宽度。
\documentclass[english]{scrartcl}
\usepackage{tikz}
\usepackage{wrapfig}
% demo
\usepackage{babel}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{wrapfigure}{l}{6cm}
\begin{tikzpicture}
\fill [blue] (0,0) rectangle (6,4);
\end{tikzpicture}
\caption{Your image}
\end{wrapfigure}
\blindtext[2]
\end{document}
图片旁边的文字
要将文本放置在图像旁边,请使用{minipage}
来对齐它。为此,您必须{minipage}
在 中放置两个{figure}
。环境采用设置宽度的参数。calc
使用包,您可以使用诸如\textwidth-7cm
等操作。此外,您可以使用可选参数(t
op、c
entered 或b
ottom)来确定相对于基线的水平位置。
\documentclass[english]{scrartcl}
\usepackage{tikz}
\usepackage{calc}
% demo
\usepackage{babel}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{figure}
\begin{minipage}[c]{7cm}
\begin{tikzpicture}
\fill [blue] (0,0) rectangle (6,4);
\end{tikzpicture}
\end{minipage}%
\begin{minipage}[c]{\textwidth-7cm}
Some text describing the image.
Some text describing the image.
Some text describing the image.
\end{minipage}
\caption{Your image}
\end{figure}
\blindtext[2]
\end{document}
答案2
picins 是另一种解决方案。你可以在这里找到该软件包:ctan 上的 picins。它不在 texlive 上(我想是许可证问题)。这是一个旧软件包,但它是一个非常好的软件包。它在 latex Companion 中有很好的文档。
\documentclass{article}
\usepackage{tikz,picins}
\usepackage{lipsum,fancyvrb}
\DefineShortVerb{\|}
\begin{document}
{\bfseries An attempt with the macro |\parpic| of the package |picins| }
\lipsum[1]
\parpic{\tikz \draw (0,0) -- (5,5);}
\lipsum[1]
\end{document}