你好,我想在我的文档中包含以下两个 tikz 图形:
\documentclass{article}
\usepackage{tikz}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}[l]{.46\textwidth}
\centering
\resizebox{.8\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2,minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size = 0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\end{tikzpicture}%
}
\caption{Goldbeter-Koshland Loop.}
\end{subfigure}
\begin{subfigure}[r]{.46\textwidth}
\resizebox{.8\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-1.5,0) {$P$};
\node[protein] (ps) at (1.5,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2, minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size =0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\node[protein] (q) at (0 , -3) {$Q$};
\node[protein] (qs) at (3 , -3) {$Q^*$}
edge [towards, bend left] node[below=10pt,name=e3, minimum size =0mm] {$E_3$} (q)
edge [from,bend right] node[above=10pt,name=e4,minimum size =0mm] {} (q) ;
\draw[->] (ps) -- +(0pt,-50pt);
\draw[->] (e3) -- +(0pt,12pt);
\end{tikzpicture}%
}
\caption{Goldbeter-Koshland Cascade.}
\end{subfigure}
\end{figure}
\end{document}
除了两个子图中的标题没有对齐之外,一切都如我所愿。
谢谢您的帮助。
答案1
您可以让floatrow
软件包为您完成艰苦的工作:
\documentclass{article}
\usepackage{tikz}
\usepackage{subcaption}
\usepackage{floatrow}
\begin{document}
\begin{figure}
\ffigbox
{%
\begin{subfloatrow}
\ffigbox[\FBwidth][1.5\FBheight]
{\caption{Goldbeter-Koshland Loop.}}
{\resizebox{.4\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2,minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size = 0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\end{tikzpicture}%
}}%
\ffigbox[\FBwidth]
{\caption{Goldbeter-Koshland Cascade.}}
{\resizebox{.4\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-1.5,0) {$P$};
\node[protein] (ps) at (1.5,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2, minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size =0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\node[protein] (q) at (0 , -3) {$Q$};
\node[protein] (qs) at (3 , -3) {$Q^*$}
edge [towards, bend left] node[below=10pt,name=e3, minimum size =0mm] {$E_3$} (q)
edge [from,bend right] node[above=10pt,name=e4,minimum size =0mm] {} (q) ;
\draw[->] (ps) -- +(0pt,-50pt);
\draw[->] (e3) -- +(0pt,12pt);
\end{tikzpicture}%
}}%
\end{subfloatrow}}{}
\end{figure}
\end{document}
答案2
您可以使用
\begin{subfigure}[b]{.46\textwidth}
这使我们完成了部分工作,但还没有完成全部工作 - 我们还需要做一些工作!
我们理想情况下希望输入一些\vfill
命令,在较小的一个周围留出必要的空白subfigures
。为了成功做到这一点,我们需要测量较大的一个的尺寸subfigures
,这可以通过将其存储在盒子中来完成。
因此,下面的方法执行以下操作:
- 将第二张(最大)图片存储在一个
sbox
叫做\tempbox
- 测量的高度
\tempbox
,然后将必要的量应用\vfill
到第一个(较小)subfigure
\documentclass{article}
\usepackage{tikz}
\usepackage{subcaption}
\newsavebox{\tempbox}
\begin{document}
\begin{figure}
% store the bigger of the two pictures in a vbox
\sbox{\tempbox}{%
\resizebox{.368\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-1.5,0) {$P$};
\node[protein] (ps) at (1.5,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2, minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size =0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\node[protein] (q) at (0 , -3) {$Q$};
\node[protein] (qs) at (3 , -3) {$Q^*$}
edge [towards, bend left] node[below=10pt,name=e3, minimum size =0mm] {$E_3$} (q)
edge [from,bend right] node[above=10pt,name=e4,minimum size =0mm] {} (q) ;
\draw[->] (ps) -- +(0pt,-50pt);
\draw[->] (e3) -- +(0pt,12pt);
\end{tikzpicture}%
}
}
\begin{subfigure}[b]{.46\textwidth}
\centering
\vbox to\ht\tempbox{
\vfill
\resizebox{.8\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2,minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size = 0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\end{tikzpicture}%
}
\vfill
}
\caption{Goldbeter-Koshland Loop.}
\end{subfigure}
\begin{subfigure}[b]{.46\textwidth}
\usebox{\tempbox}
\caption{Goldbeter-Koshland Cascade.}
\end{subfigure}
\end{figure}
\end{document}