使用 minipage 的垂直时间轴

使用 minipage 的垂直时间轴

我正在尝试使用两个 s 来制作垂直时间轴,minipage以便为每个部分设置不同的样式。这是我目前所做的。

\RequirePackage{fix-cm}
\documentclass{article}

%% Main Packages %%
\usepackage[margin=0pt]{geometry}
\usepackage{enumitem}
\usepackage{parskip}
\usepackage{framed}

%% Graphics Packages %%
\usepackage{tikz}
\usepackage{xcolor}

%% Custom Commands %%

\definecolor{verylightgrey}{rgb}{0.85,0.85,0.85}
\definecolor{lightgrey}{rgb}{0.5,0.5,0.5}
\definecolor{darkgrey}{rgb}{0.3,0.3,0.3}

\newcommand\timelineitem[3]{
    \noindent
    \begin{minipage}[t]{0.3\textwidth}
        \begin{center}
            \color{lightgrey}\large{#1}
        \end{center}
    \end{minipage}
    \begin{minipage}[t]{0.7\textwidth}
        \color{darkgrey} \large \noindent #2
        \color{black} \normalsize \par $\bullet$ #3
    \end{minipage}
}

%% Document %%

\begin{document}
    \vspace*{-26.4pt}
    \noindent\fcolorbox{black}{black}{
        \color{white}
        \noindent\hspace*{0.02\textwidth}%
        \begin{minipage}[t][\textheight]{0.40\textwidth}
            \vspace*{15pt}
            \centering
            \fontsize{25pt}{20pt}\selectfont Name\\
            \fontsize{15pt}{20pt}\selectfont Field
            \vspace*{20pt}
            
            \fontsize{11pt}{10pt}\selectfont
            \begin{description}
                \itemsep 0pt
                \item [Mobile Number:] (+00) 00 00 0000
                \item [Email:] [email protected]
            \end{description}
            
            \vspace*{\fill}
            
        \end{minipage}
    }%
    \noindent\hspace{0.025\textwidth}%
    \begin{minipage}[t][\textheight]{0.50\textwidth}%   
        \parbox[t]{\textwidth}{
            \vspace*{0.2cm}
            \timelineitem{1800}{School A}{
                Achieved at school A
            }
            \timelineitem{1801}{School B}{
                Achieved at school B
            }
            \timelineitem{1802}{School C}{
                Achieved at school C
            }
            \vspace*{0.2cm}
        }
    \end{minipage}
    
\end{document}

像下面这样的东西就太棒了。

在此处输入图片描述

如果您能告诉我为什么需要这条线\vspace*{-26.4pt}来防止在暗条上方产生白色空间,则可以获得加分。

答案1

这个页面看起来更容易画:

\RequirePackage{fix-cm}
\documentclass{article}

%% Main Packages %%
\usepackage[margin=0pt]{geometry}
\usepackage{enumitem}
\newlist{tikzitem}{itemize}{1}% <-- defined new list
\setlist[tikzitem]{nosep,     % <-- new list setup
                   leftmargin=*,
                   label=\textbullet}

%% Graphics Packages %%
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                calc,
                chains,
                positioning}
%% colors
\definecolor{verylightgrey}{rgb}{0.85,0.85,0.85}
\definecolor{lightgrey}{rgb}{0.5,0.5,0.5}
\definecolor{darkgrey}{rgb}{0.3,0.3,0.3}
%% Graphics Path 
\graphicspath{{../Pictures/}}
%% Custom Command 
\newcommand\timlineitem[2]{
            \textcolor{lightgrey}{\large #1}\\
            \begin{tikzitem}
            \item \textcolor{darkgrey}{#2}
            \end{tikzitem}}

%% Document %%

\begin{document}
\noindent\begin{tikzpicture}[remember picture,overlay,
            every label/.style = {text width=0.4\textwidth,
                                  anchor=north, text=white}
                            ]
\node[fill, 
      minimum height=\textheight, text width=0.4\textwidth,
      below right,
      label=north:{
                \begin{center}
        \fontsize{24pt}{32pt}\selectfont Name\\
        \vspace{5pt}
        \fontsize{16pt}{20pt}\selectfont Field
                \end{center}
        \vspace*{20pt}
        \fontsize{11pt}{12pt}\selectfont
         \textbf{Mobile Number:}    \quad(+00) 00 00 0000\\
         \textbf{Email:}            \quad   [email protected]
                 }% end of label 
    ] 
    at (current page.north west) {};
\end{tikzpicture}% 
%
\hfill\begin{minipage}[t][\textheight]{0.50\textwidth}%
    \begin{tikzpicture}[
node distance = 1mm,
  start chain= going below,
arr/.style = {draw=gray, ultra thick, -{stealth[scale=0.8]}},
box/.style = {inner xsep=2mm, text width=0.6\linewidth, align=left,
              on chain},
every label/.append style = {label distance=5mm,
                             inner xsep=2mm, inner ysep=1pt,
                             text=gray, anchor=south east}
                        ]
\node (n1) [box, label={[name=l1]left:1800}]
    {\timlineitem{School A}{Achieved at school A}};
\node (n2) [box, label={[name=l2]left:1801}]
    {\timlineitem{School B}{Achieved at school B}};
\node (n3) [box, label={[name=l3]left:1802}]
    {\timlineitem{School C}{Achieved at school C}};
%
\foreach \i in {1,2,3}
    \draw (l\i) -- (l\i -| n\i.west);
\path ($(n3.west)!0.5!(l3.east)$) coordinate (aux);
\draw[arr]  (n3.south -| aux) -- (aux |- n1.north);
    \end{tikzpicture}
\end{minipage}

\end{document}

在此处输入图片描述

相关内容