1

I'm new to LaTeX and looking for help to produce an output like below: bulletedlist

While searching I found a package called framed framed-ctan. While it adds the vertical line on the left, I couldnt figure out how I could add a label (2021 in the example) to it.

Thanks in advance.

2
  • 2
    The framed package provides a way (leftbar) to draw a vertical line beside its content, however the picture you post shows that the line is much longer than the text. How should the line length be determined?
    – campa
    Jul 27, 2021 at 7:54
  • Line length can match the text on right. It need not be longer. It was a mistake in the picture I shared. Sorry for the confusion Jul 27, 2021 at 16:50

1 Answer 1

2

You haven't exactly give some detailed specs, so here just a general idea.

\documentclass{article}

\usepackage{graphicx}
\usepackage{lipsum}% for dummy text

\makeatletter

\newenvironment{foobox}[1]{%
   \setbox0=\hbox{\space\ignorespaces\strut#1\unskip\space}%
   \setbox1=\hbox\bgroup\minipage[b]{.9\linewidth}%
  }{%
   \endminipage\egroup
   \dimen@\dimexpr\wd0+2em\relax
   \ifdim\dimen@<\ht1\dimen@\ht1\fi
   \par\medskip\noindent
   \hbox to .1\linewidth{%
      \m@th
      \hfil$
      \vcenter to \dimen@{\leaders\vrule\vfill\hbox{\kern\dimexpr.5ex-\ht0\relax\rotatebox{90}{\box0}}\leaders\vrule\vfill}
      $\hfil
   }%
   $\m@th\vcenter{\box1}$%
   \par\medskip\noindent
   \ignorespacesafterend
}

\makeatother

\begin{document}

\lipsum[66]
\begin{foobox}{2021}
Bla bla bla
\end{foobox}
\lipsum[75]
\begin{foobox}{Whatever}
Some text here
\begin{itemize}
\item foo
\item bar
\item baz
\end{itemize}
and some text there
\end{foobox}
or an example with only a list
\begin{foobox}{A}
\begin{itemize}
\item foo
\item bar
\item baz
\end{itemize}
\end{foobox}

\end{document}

The construct is not breakable across pages. The minimal height is given by the width of the "label" plus two spaces plus a line of 1em on each side.

enter image description here

1
  • This is exactly what I was looking for. Thanks Jul 28, 2021 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .