2

I'm quite happy with the time line presented in Timeline that uses a longtable environment However, I'd like to skip some of the bullet points.

I tried using a boolean toggle, but it seems like the logic is not used inside the tabular environment.

Is there a way to get more control of when the bullet points appear?

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{etoolbox}
\usepackage{xtab}
\usepackage{array}
\definecolor{accentcolor}{RGB}{ 250, 150, 10 }

\newbool{time_bullet} \setbool{time_bullet}{true}

\newcommand{\foo}{\color{accentcolor!80}\makebox[0pt]{ \ifbool{time_bullet}{ \LARGE\textbullet\setbool{time_bullet}{false}} {\setbool{time_bullet}{true}} }\hskip-0.0pt\vrule width 1pt\hspace{\labelsep}\ifbool{time_bullet}{\setbool{time_bullet}{false}}{\setbool{time_bullet}{true}}}

\newcolumntype{F}{<{\hskip 2pt} !{\foo} >{\raggedright\arraybackslash}p{2cm}}

\begin{document}

\begin{tabular}{lF} 1 & Test\ 2 & Test \ 3 & Test \end{tabular} \foo{} \foo{} \foo{} \end{document}

enter image description here

Bernard
  • 271,350
dba
  • 516
  • 1
    It is not clear what the desired outcome is, But, I suspect it is a grouping issue: see if using \global\setbool instead of just \setbool does what you want. Also, you may need to replace thetwo insteances of { at the end of a line with {% so you don't end up with spurious spaces. – Peter Grill Oct 09 '20 at 16:27
  • Indeed, setting the bool values globally fixed the problem! This snippet was just supposed to help me understand how I can control those bullet points. – dba Oct 09 '20 at 18:20

1 Answers1

1

As @Peter Grill pointed out, the boolean values need to be set globally.

Thus using

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{etoolbox}
\usepackage{xtab}
\usepackage{array}
\definecolor{accentcolor}{RGB}{ 250, 150, 10 }

\newbool{time_bullet} \setbool{time_bullet}{true}

\newcommand{\foo}{\color{accentcolor!80}\makebox[0pt]{% \ifbool{time_bullet}{% \LARGE\textbullet\setbool{time_bullet}{false}} {\setbool{time_bullet}{true}} }\hskip-3.2pt\vrule width 1pt\hspace{\labelsep}\ifbool{time_bullet}{\global\setbool{time_bullet}{false}}{\global\setbool{time_bullet}{true}}}

\newcolumntype{F}{<{\hskip 2pt} !{\foo} >{\raggedright\arraybackslash}p{2cm}}

\begin{document}

\begin{tabular}{lF} 1 & Test\ 2 & Test \ 3 & Test \end{tabular} \foo{} \foo{} \foo{} \end{document}

works perfectly fine with the result

enter image description here

dba
  • 516