我有一条长达 49 年的时间线(实际上是 49 年,而不是 50 年,因为我想在 x 方向上稍微重叠)。
我如何最好地调整网格,换句话说,调整列或列宽?
我应该设置 49 列吗?或者我也可以将列设置为 1798-1810、1810-1820、1820-1830,...?
注 1:我通常只显示整个十年(1800 年、1810 年、1820 年……);为了更好地概览,这里显示所有年份。
注2:“事件1813”的连接线目前不太好看……
\documentclass{article}
\usepackage[margin=2cm,
showframe=true]{geometry}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\begin{document}
\noindent\begin{tcbposter}[
poster = {showframe=true,
height=3cm, spacing=0mm, rows=3, columns=5, height=6cm,
},
boxes = {beamer, colframe=blue!50!black, colback=blue!50, colupper=yellow!50,
sharp corners
},
]
\pgfmathsetlengthmacro\xShift{(\tcbposterwidth)/(50-1)}
\foreach[count=\n from 0,
evaluate={\x=int(mod(\n,50))},
evaluate={\T=int(mod(\t,10))},
] \t in {1798,...,1847}{%%
% Years, Coordinates
\draw[brown, xshift=\x*\xShift] circle(2pt) coordinate[label=] (y\t) node[font=\tiny, text=black, rotate=-45, anchor=north west]{ %t:\t, n:\n
\ifnum\T=0 \textbf{\color{red}\t} \else \t \fi%, n:\n
};
}%%
\posterbox{name=ev1813,row=2, column=2, span=0.5}{An event in 1813.}
\draw[blue,very thick,->] ([email protected]) -- +(5pt, 0) |- (y1813) circle (2pt);
\end{tcbposter}
\end{document}
答案1
我不知道您需要多少列,也不知道您是否需要tcbposter
。如果您知道时间线定义的网格,则可以将节点移动到您想要的任何位置。
在这种情况下,为了更好地了解(从我的角度来看)事件和时间参考之间的连接,我已经改变circles
它们node[circle]
并将它们用作文本节点的圆形箭头的参考。
\documentclass{article}
\usepackage[margin=2cm,
showframe=true]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage[most]{tcolorbox}
\begin{document}
\noindent\begin{tcbposter}[
poster = {showframe=true,
height=3cm, spacing=0mm, rows=3, columns=5, height=6cm,
},
boxes = {beamer, colframe=blue!50!black, colback=blue!50, colupper=yellow!50,
sharp corners
},
]
\pgfmathsetlengthmacro\xShift{(\tcbposterwidth)/(50-1)}
\foreach[count=\n from 0,
evaluate={\x=int(mod(\n,50))},
evaluate={\T=int(mod(\t,10))},
] \t in {1798,...,1847}{%%
% Years, Coordinates
%\draw[brown, xshift=\x*\xShift] circle(2pt) coordinate[label=] (y\t) node[font=\tiny, text=black, rotate=-45, anchor=north west]{ %t:\t, n:\n
%\ifnum\T=0 \textbf{\color{red}\t} \else \t \fi%, n:\n
%};
\path (\x*\xShift,0) node[draw, brown, circle, minimum size=4pt, inner sep=0pt] (y\t) {} node[font=\tiny, text=black, rotate=-45, anchor=north west]{ %t:\t, n:\n
\ifnum\T=0 \textbf{\color{red}\t} \else \t \fi%, n:\n
};
}%%
\posterbox{name=ev1813,row=2, column=2, span=0.5}{An event in 1813.}
\draw[blue,very thick,-{Circle[open, length=5pt]}] ([email protected]) -| ([yshift=-.5pt]y1813.south);
\end{tcbposter}
\end{document}