Text FormattingTable with itemized contents

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
faizlo
Posts: 4
Joined: Thu Apr 11, 2013 7:32 pm

Table with itemized contents

Post by faizlo »

I am trying to produce the text in the picture. I am not sure if I should use latbular or tabularx or something else. I am not sure how to produce it. I also want space between bullets and text to be minimum and also if one of the columns has one more row than the second column (say the first column has 6 rows while the second has only 5 rows) then a bullet should not appear, just as in the picture.
Can you please help me achieve this goal as I have spent long hours trying?
Screenshot from 2022-12-16 10-48-19.png
Screenshot from 2022-12-16 10-48-19.png (32.72 KiB) Viewed 4992 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Table with itemized contents

Post by Bartman »

It'd have been useful if you had shown at least one of your experiments. Sometimes you can make something out of it.

A suggestion:

Code: Select all

\documentclass{article}
\usepackage{multicol}
\usepackage{parskip}
\usepackage{calc}
\usepackage{enumitem}
\usepackage[hmargin=2.5cm,showframe]{geometry}

\newlist{twoColumnItemize}{itemize}{1}
\setlist[twoColumnItemize]{
  label=\textbullet, 
  labelsep=.25\labelsep,
  nosep,  
  before=\begin{multicols}{2},
  after=\end{multicols}
}

\newcommand{\unitOfTime}{}

% two column item
\newcommand{\tcItem}[2]{
  \ifnum\pdfstrcmp{1}{#2}=0
    \renewcommand{\unitOfTime}{yr}
  \else
    \renewcommand{\unitOfTime}{yrs}
  \fi
  \item #1\dotfill\makebox[\widthof{0--0 yrs}][l]{#2 \unitOfTime}%
}

\begin{document}
\textbf{Skills:}%
\rule[\heightof{:}/2]
  {\linewidth-\widthof{\textbf{Skills:}}}
  {3\arrayrulewidth}

\begin{twoColumnItemize}
  \tcItem{R, Matlab, Python}{3--4}
  \tcItem{Microsoft, Excel, Access, SQL}{1--2}
  \tcItem{Text}{1}
  \tcItem{Text}{4--5}
  \tcItem{Text}{1}
  \tcItem{Text}{1}%
%  \columnbreak
  \tcItem{Text}{3--4}
  \tcItem{Text}{4--5}
  \tcItem{Text}{1}
\end{twoColumnItemize}
\end{document}
faizlo
Posts: 4
Joined: Thu Apr 11, 2013 7:32 pm

Table with itemized contents

Post by faizlo »

Thank you for your answer, and I really apologize for not posting my work. (I am posting it below).
Your answer is as good as I want, but it added unwanted vertical and horizontal lines around the documents (frames) and removed the showframe option from your answer. Thank you again. One last question:
If I try to increase the bullet size (I used huge to get the appearance I want) the text next to each bullet got lower than it should. That is, the bullet is not at the center of the text next to it. Is there a fix? (I have not edited anything in your answer, so you can still use your code.)

Here is my solution that does not allow me to have a missed row in the second column without adding an unnecessary bullet.

Code: Select all

\begin{tabularx}{\linewidth}{@{{\large$\bullet$}\hspace{0.5em}}X@{\,}l@{\qquad{\large$\bullet$}\hspace{0.5em}}X@{\,}l}
 R, Matlab, Python\dotfill & 3+ yrs & Text\dotfill& 12+ yr \\
 Text\dotfill & 4+ yrs & Text \dotfill& 8+ yr \\
 Text\dotfill & 4+ yrs & Text\dotfill & 15+ yr \\
 Text\dotfill & 5+ yrs & Text\dotfill & 3+ yr \\
 Text\dotfill & 1--2 yrs & Text\dotfill & 2+ yrs\\
 Text\dotfill & 8+ yr & & &
\end{tabularx}
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Table with itemized contents

Post by Bartman »

Add the following changes to the options list of my created itemization to set bullet size and vertical alignment.

Code: Select all

\setlist[twoColumnItemize]{
  label=\raisebox{-0.2ex}{\textbullet},% changed
  labelsep=.25\labelsep,
  nosep,  
  font=\huge,% added
  before=\begin{multicols}{2},
  after=\end{multicols}
}
You can avoid adding the bullet point before the second column by using the \multicolumn command.

Code: Select all

\documentclass{article}
\usepackage{tabularx}
\usepackage{showframe}

\begin{document}
\begin{center}
\begin{tabularx}{\linewidth}{
  @{{\large$\bullet$}\hspace{0.5em}}
  X
  @{\,}
  l
  @{\qquad{\large$\bullet$}\hspace{0.5em}}
  X
  @{\,}
  l
}
 R, Matlab, Python\dotfill & 3+ yrs & Text\dotfill& 12+ yr \\
 Text\dotfill & 4+ yrs & Text \dotfill& 8+ yr \\
 Text\dotfill & 4+ yrs & Text\dotfill & 15+ yr \\
 Text\dotfill & 5+ yrs & Text\dotfill & 3+ yr \\
 Text\dotfill & 1--2 yrs & Text\dotfill & 2+ yrs\\
 Text\dotfill & \multicolumn{1}{@{}l}{8+ yr}
\end{tabularx}
\end{center}
\end{document}
Unfortunately, I didn't succeed in moving the bullet points vertically with the \raisebox command in your example, so I left out the attempt.
faizlo
Posts: 4
Joined: Thu Apr 11, 2013 7:32 pm

Table with itemized contents

Post by faizlo »

Thank you so much. This is exactly what I was looking for.
Thank you again.
Post Reply