在横向页面上居中放置两个 tikzpicture 子浮点数
Center two tikzpicture subfloats on a landscape page
我想将两个 tikzpictures 放在横向页面上的自己的 subfloat 中。在我的示例代码中,第二个时间线的开始位置发生了偏移。您可以在 picture 中看到转变。我想让两条时间线的起点在同一条水平线上。
\documentclass[a4paper,11pt,smallchapters,blue,extramargin,lnum]{article}
\usepackage{lscape}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{landscape}
\vspace*{\fill}
\begin{figure}[h]
\begin{center}
\subfloat[Situation 1 \label{fig:situationen-2.impl-exp3:situation1}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (10,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\newline
\subfloat[Situation 2 \label{fig:situationen-2.impl-exp3:situation2}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (5,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (10,0) node[below=3pt] {$ 100s $} node[above=12pt] {Senderate} node[above=1pt] {kleiner};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\caption{Untersuchte Situationen in Experiment 3 der 2.Implementierung} \label{fig:situationen-2.impl-exp2}
\end{center}
\end{figure}
\vspace*{\fill}
\end{landscape}
\end{document}
问题是由居中文本和来自 \newline
的强制换行符的组合引起的。您可以通过简单地留下一个空行来开始一个新段落来避免这种情况:
\documentclass[a4paper,11pt,smallchapters,blue,extramargin,lnum]{article}
\usepackage{lscape}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{landscape}
\vspace*{\fill}
\begin{figure}[h]
\centering
% \begin{center}
\subfloat[Situation 1 \label{fig:situationen-2.impl-exp3:situation1}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (10,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\subfloat[Situation 2 \label{fig:situationen-2.impl-exp3:situation2}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (5,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (10,0) node[below=3pt] {$ 100s $} node[above=12pt] {Senderate} node[above=1pt] {kleiner};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\caption{Untersuchte Situationen in Experiment 3 der 2.Implementierung} \label{fig:situationen-2.impl-exp2}
% \end{center}
\end{figure}
\vspace*{\fill}
\end{landscape}
\end{document}
(我使用 \centering
而不是 center
环境来避免额外的垂直间距,但对于您的用例来说这并不重要)
我想将两个 tikzpictures 放在横向页面上的自己的 subfloat 中。在我的示例代码中,第二个时间线的开始位置发生了偏移。您可以在 picture 中看到转变。我想让两条时间线的起点在同一条水平线上。
\documentclass[a4paper,11pt,smallchapters,blue,extramargin,lnum]{article}
\usepackage{lscape}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{landscape}
\vspace*{\fill}
\begin{figure}[h]
\begin{center}
\subfloat[Situation 1 \label{fig:situationen-2.impl-exp3:situation1}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (10,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\newline
\subfloat[Situation 2 \label{fig:situationen-2.impl-exp3:situation2}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (5,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (10,0) node[below=3pt] {$ 100s $} node[above=12pt] {Senderate} node[above=1pt] {kleiner};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\caption{Untersuchte Situationen in Experiment 3 der 2.Implementierung} \label{fig:situationen-2.impl-exp2}
\end{center}
\end{figure}
\vspace*{\fill}
\end{landscape}
\end{document}
问题是由居中文本和来自 \newline
的强制换行符的组合引起的。您可以通过简单地留下一个空行来开始一个新段落来避免这种情况:
\documentclass[a4paper,11pt,smallchapters,blue,extramargin,lnum]{article}
\usepackage{lscape}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{landscape}
\vspace*{\fill}
\begin{figure}[h]
\centering
% \begin{center}
\subfloat[Situation 1 \label{fig:situationen-2.impl-exp3:situation1}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (10,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\subfloat[Situation 2 \label{fig:situationen-2.impl-exp3:situation2}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (5,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (10,0) node[below=3pt] {$ 100s $} node[above=12pt] {Senderate} node[above=1pt] {kleiner};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\caption{Untersuchte Situationen in Experiment 3 der 2.Implementierung} \label{fig:situationen-2.impl-exp2}
% \end{center}
\end{figure}
\vspace*{\fill}
\end{landscape}
\end{document}
(我使用 \centering
而不是 center
环境来避免额外的垂直间距,但对于您的用例来说这并不重要)