在 tikz \subfloat 中对齐标题

在 tikz \subfloat 中对齐标题

我正在努力对齐子图,特别是标题,但找不到方法。

\documentclass[twocolumn]{article}
\usepackage{geometry}
\geometry{legalpaper, landscape, margin=2in}
\usepackage{tkz-graph}
\usepackage{subfig}

\begin{document}
\begin{figure*}
\centering
\subfloat[][]{
    \label{fig:ex1}
    \begin{tikzpicture}[baseline=(a1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw, minimum size=1em}]
    \node[main node] (a1) {\small $n_1$};
    \node[main node] (a2) [below left of=a1] {\small $n_2$};
    \node[main node] (a3) [below right of=a1] {\small $n_3$};
    \path (a1) edge [] node {} (a3)
    (a1) edge [] node {} (a2);
    \end{tikzpicture}
}
\quad
\centering
\subfloat[][]{
    \label{fig:ex2}
    \begin{tikzpicture}[baseline=(b1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (b1) {\small $n_1$};
    \node[main node] (b2) [below left of=b1] {\small $n_2$};
    \node[main node] (b3) [below right of=b1] {\small $n_3$};
    \path
    (b1) edge [] node {} (b3)
    (b1) edge [] node {} (b2)
    (b3) edge [in=45,out=315, looseness=1.5] node {} (b1);
    \end{tikzpicture}
}
\quad
\centering
\subfloat[][]{
    \label{fig:ex3}
    \begin{tikzpicture}[baseline=(c1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (c1) {\small $n_1$};
    \node[main node] (c2) [below left of=c1] {\small $n_2$};
    \node[main node] (c3) [below right of=c1] {\small $n_3$};
    \path
    (c1) edge [] node {} (c3)
    (c1) edge [] node {} (c2)
    (c3) edge [in=-45,out=315, looseness=1.5] node {} (c2);
    \end{tikzpicture}
}
\quad
\centering
\subfloat[][]{
    \label{fig:ex4}
    \begin{tikzpicture}[baseline=(d1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (d1) {\small $n_1$};
    \node[main node] (d2) [below left of=d1] {\small $n_2$};
    \node[main node] (d3) [below right of=d1] {\small $n_3$};
    \path
    (d1) edge [] node {} (d3)
    (d1) edge [] node {} (d2)
    (d3) edge [in=45,out=315,loop] node {} (d3);
    \end{tikzpicture}
}
\quad
\centering
\subfloat[][]{
    \label{fig:ex5}
    \begin{tikzpicture}[baseline=(e1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (e1) {\small $n_1$};
    \node[main node] (e2) [below left of=e1] {\small $n_2$};
    \node[main node] (e3) [below right of=e1] {\small $n_3$};
    \node[main node, dashed] (e4) [below right of=e3] {\small $n_4$};
    \path
    (e1) edge [] node {} (e3)
    (e1) edge [] node {} (e2)
    (e3) edge [in=135,out=315] node {} (e4);
    \end{tikzpicture}
}
\caption{Steps in Korat exploration to find an extendable candidate vector}
\end{figure*}

\end{document}

请帮我对齐(a)、(b)、(c)变电站。 在此处输入图片描述

答案1

您可以使用表格。注意:子标题不会显示在 \listoffigures 中。

我不确定你为什么要标签,但我还是把它们放进去了。坦率地说,记住 a、b、c... 比 \ref{fig:ex1} 等要容易得多。如果你最终计划添加 hyperref,你可以同样轻松地使用 \hyperlink 和 \hypertarget。

\documentclass[twocolumn]{article}
\usepackage{geometry}
\geometry{legalpaper, landscape, margin=2in,showframe}% added showframe
\usepackage{tkz-graph}
\usepackage{subfig}% not used here

\begin{document}
\begin{figure*}
\centering
\settowidth{\tabcolsep}{\quad}
\tabcolsep=0.5\tabcolsep
\begin{tabular}{ccccc}
  \expandafter\advance\csname c@figure\endcsname by 1
  \refstepcounter{subfigure}\label{fig:ex1}%
    \begin{tikzpicture}[baseline=(a1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw, minimum size=1em}]
    \node[main node] (a1) {\small $n_1$};
    \node[main node] (a2) [below left of=a1] {\small $n_2$};
    \node[main node] (a3) [below right of=a1] {\small $n_3$};
    \path (a1) edge [] node {} (a3)
    (a1) edge [] node {} (a2);
    \end{tikzpicture}
&
  \refstepcounter{subfigure}\label{fig:ex2}%
    \begin{tikzpicture}[baseline=(b1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (b1) {\small $n_1$};
    \node[main node] (b2) [below left of=b1] {\small $n_2$};
    \node[main node] (b3) [below right of=b1] {\small $n_3$};
    \path
    (b1) edge [] node {} (b3)
    (b1) edge [] node {} (b2)
    (b3) edge [in=45,out=315, looseness=1.5] node {} (b1);
    \end{tikzpicture}
&
  \refstepcounter{subfigure}\label{fig:ex3}%
    \begin{tikzpicture}[baseline=(c1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (c1) {\small $n_1$};
    \node[main node] (c2) [below left of=c1] {\small $n_2$};
    \node[main node] (c3) [below right of=c1] {\small $n_3$};
    \path
    (c1) edge [] node {} (c3)
    (c1) edge [] node {} (c2)
    (c3) edge [in=-45,out=315, looseness=1.5] node {} (c2);
    \end{tikzpicture}
&
  \refstepcounter{subfigure}\label{fig:ex4}%
    \begin{tikzpicture}[baseline=(d1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (d1) {\small $n_1$};
    \node[main node] (d2) [below left of=d1] {\small $n_2$};
    \node[main node] (d3) [below right of=d1] {\small $n_3$};
    \path
    (d1) edge [] node {} (d3)
    (d1) edge [] node {} (d2)
    (d3) edge [in=45,out=315,loop] node {} (d3);
    \end{tikzpicture}
&
  \refstepcounter{subfigure}\label{fig:ex5}%
    \begin{tikzpicture}[baseline=(e1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (e1) {\small $n_1$};
    \node[main node] (e2) [below left of=e1] {\small $n_2$};
    \node[main node] (e3) [below right of=e1] {\small $n_3$};
    \node[main node, dashed] (e4) [below right of=e3] {\small $n_4$};
    \path
    (e1) edge [] node {} (e3)
    (e1) edge [] node {} (e2)
    (e3) edge [in=135,out=315] node {} (e4);
    \end{tikzpicture}
\\
(a) & (b) & (c) & (d) & (e)
\end{tabular}
\caption{Steps in Korat exploration to find an extendable candidate vector}
\end{figure*}

\end{document}

答案2

您可以使用floatrow。但是,我现在尽可能避免使用这种方法,因为就软件包而言,它并不完全存在。但是,它可以优雅地处理这种情况。

希望有人能提供一个既优雅又不floatrow依赖的解决方案。否则,一点点黑客技术就能产生好的结果。例如,

\documentclass[twocolumn]{article}
\usepackage{geometry}
\geometry{legalpaper, landscape, margin=2in}
\usepackage{tkz-graph}
% \usepackage{subfig}
\usepackage{subcaption}

\begin{document}
\begin{figure*}
\centering
\subcaptionbox{\label{fig:ex1}}{%
  \begin{tikzpicture}[baseline=(a1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw, minimum size=1em}]
    \node[main node] (a1) {\small $n_1$};
    \node[main node] (a2) [below left of=a1] {\small $n_2$};
    \node[main node] (a3) [below right of=a1] {\small $n_3$};
    \node[main node, draw=none] (a4) [below right of=a2] {\phantom{\small $n_4$}};
    \path (a1) edge [] node {} (a3)
    (a1) edge [] node {} (a2);
  \end{tikzpicture}%
}\quad
\subcaptionbox{\label{fig:ex2}}{%
    \begin{tikzpicture}[baseline=(b1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (b1) {\small $n_1$};
    \node[main node] (b2) [below left of=b1] {\small $n_2$};
    \node[main node] (b3) [below right of=b1] {\small $n_3$};
    \node[main node, draw=none] (b4) [below right of=b2] {\phantom{\small $n_4$}};
    \path
    (b1) edge [] node {} (b3)
    (b1) edge [] node {} (b2)
    (b3) edge [in=45,out=315, looseness=1.5] node {} (b1);
    \end{tikzpicture}%
}\quad
\subcaptionbox{\label{fig:ex3}}{%
    \begin{tikzpicture}[baseline=(c1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (c1) {\small $n_1$};
    \node[main node] (c2) [below left of=c1] {\small $n_2$};
    \node[main node] (c3) [below right of=c1] {\small $n_3$};
    \node[main node, draw=none] (c4) [below right of=c2] {\phantom{\small $n_4$}};
    \path
    (c1) edge [] node {} (c3)
    (c1) edge [] node {} (c2)
    (c3) edge [in=-45,out=315, looseness=1.5] node {} (c2);
    \end{tikzpicture}%
}\quad
\subcaptionbox{\label{fig:ex4}}{%
    \begin{tikzpicture}[baseline=(d1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (d1) {\small $n_1$};
    \node[main node] (d2) [below left of=d1] {\small $n_2$};
    \node[main node] (d3) [below right of=d1] {\small $n_3$};
    \node[main node, draw=none] (d4) [below right of=d2] {\phantom{\small $n_4$}};
    \path
    (d1) edge [] node {} (d3)
    (d1) edge [] node {} (d2)
    (d3) edge [in=45,out=315,loop] node {} (d3);
    \end{tikzpicture}%
}\quad
\subcaptionbox{\label{fig:ex5}}{%
    \begin{tikzpicture}[baseline=(e1.base),->,>=stealth',shorten >=1pt,auto,node distance=1.24cm, main node/.style={circle,draw}]
    \node[main node] (e1) {\small $n_1$};
    \node[main node] (e2) [below left of=e1] {\small $n_2$};
    \node[main node] (e3) [below right of=e1] {\small $n_3$};
    \node[main node, dashed] (e4) [below right of=e3] {\small $n_4$};
    \path
    (e1) edge [] node {} (e3)
    (e1) edge [] node {} (e2)
    (e3) edge [in=135,out=315] node {} (e4);
    \end{tikzpicture}%
}
\caption{Steps in Korat exploration to find an extendable candidate vector}
\end{figure*}

\end{document}

对齐对齐

请注意,below right ofetc. 已弃用。但是,可能tkz-graph出于某些原因仍在使用它。

相关内容