1

Good morning,

I'm building a small table with a list. But the space above and to the left of the list is too big for me. I removed the space above the list with \vspace. But \hspace doesn't work there. Does anyone have an idea?

Best regards

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\begin{document}
\begin{tabular}{|p{5cm}|p{5cm}|}
    \hline
         & \begin{itemize} \item[...] g \end{itemize} \\
    \hline
         & \vspace{-5mm} \begin{itemize} \item[...] g \end{itemize} \\
    \hline
         & \vspace{-5mm} \hspace{-5mm} \begin{itemize} \item[...] g \end{itemize} \\\hline
\end{tabular}
\end{document}

1 Answer 1

1

I suggest you employ the enumitem package to create a bespoke itemize-like list environment that minimizes wasted space, both horizontally and vertically. On the subject of minimizing wasted horizontal space: You may want to choose a different label than what's produced by \dots. E.g., consider replacing label = \dots with label = \textbullet.

Naturally, you're free to choose a different name than myitemize...

enter image description here

\documentclass{article}
% 'utf8' is the default input encoding nowadays
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{array}
\usepackage{lipsum} % filler text

\usepackage{enumitem} % for \newlist and \setlist commands
\newlist{myitemize}{itemize}{1} % we need just 1 list level
\setlist[myitemize]{label  = \dots, left=0pt, nosep,
                    before = \begin{minipage}[t]{\linewidth},
                    after  = \end{minipage}}

\begin{document}

\begin{tabular}{|p{5cm}|p{5cm}|}
\hline
  & \begin{myitemize} 
      \item g 
      \item h
      \item \lipsum[1][1-3]
    \end{myitemize} \\
\hline
  & \begin{myitemize} 
      \item i 
      \item j
      \item k
    \end{myitemize} \\
\hline  
  & \begin{myitemize} 
      \item l 
      \item m
      \item n
    \end{myitemize} \\
\hline
\end{tabular}

\end{document}
3
  • Thank you so much
    – TheDice
    Jun 2, 2023 at 6:05
  • how do I change this if I want to have numbers not dots? 1) 2) 3)
    – TheDice
    Jun 2, 2023 at 6:13
  • @TheDice - change the list type from itemize to enumerate and label=\textbullet to label=\arabic*). It’s all explained well in the user guide of the enumitem package.
    – Mico
    Jun 2, 2023 at 6:18

You must log in to answer this question.

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