1

I want to reduce the whitespace width between table column line and bullet inside a table. I am using following code to generate the table.

\begin{table}[htb]
\centering
\caption{Table test}
\label{tab:test}
\begin{tabular}{|p{0.05\linewidth}|p{0.3\linewidth}|p{0.25\linewidth}|p{0.3\linewidth}|}
\hline
\textbf{T} & \textbf{Title 1} & \textbf{Title 2} & \textbf{Title 3} \\
\hline
T1 & Text 1 & Text 2 &
\begin{minipage}[t]{0.3\textwidth}
    \begin{itemize}
    \item Item 1
   \end{itemize}
  \end{minipage} \\
\hline
\end{tabular}
\end{table}

The output is as follows

enter image description here

I want to reduce the width highlighted in red line in the shown image. Does anyone know how to do this? Thank you

Zarko
  • 296,517
YatShan
  • 155
  • Please provide MWE! In preamble it should have to your problem relevant packages and commands definitions. This seems to be easy to reach by enumitem package and list option leftmargin=*. – Zarko May 28 '22 at 03:27

1 Answers1

3

Edit: Table is now inserted in table float environment, added are caption and label for referencing table. As request OP in his comment below:

By guessing what you have (or haven't) in your document preamble use one of my table test container for construct a MWE ...

With enumitem package and defining of new list ter use tabularray for table, a MWE with your table can be:

\documentclass{article}
\usepackage[skip=1ex, 
            font=small, labelfont=bf]{caption}
\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}% <-- defined new list
\setlist[tabitemize]{nosep,     % <-- new list setup
                     leftmargin = *          ,
                     label      = \textbullet,
                     after=\end{minipage},                  % <---
                     before=\begin{minipage}[t]{\linewidth} % <---
                     }
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\hsize=#1\hsize\linewidth=\hsize%
                       \raggedright\arraybackslash}X}

\begin{document} \begin{table}[ht] \caption{My table} \label{tab:mytble} \begin{tabularx}{\linewidth}{|l|L{1.1}|L{0.8}|L{1.1}|} \hline \textbf{T} & \textbf{Title 1} & \textbf{Title 2} & \textbf{Title 3} \ \hline T1 & Text 1 & Text 2 & \begin{tabitemize} \item Item 1 \item Item 2 \end{tabitemize} \ \hline \end{tabularx} \end{table} \end{document}

enter image description here

Zarko
  • 296,517
  • 1
    +1. On the off-chance that the "looks" of the document's text and math font families happen to be quite different, I'd replace label=$\bullet$ with label=\textbullet, though. – Mico May 28 '22 at 04:03
  • 2
    @Mico, you are right. I must correct my old "container" for table code testing from where come this discrepancy. Corrected now. – Zarko May 28 '22 at 04:05
  • @Zarko Thank you for your answer. I removed "after=\end{minipage}, before=\begin{minipage}[t]{\linewidth}" because they didn't compile. Also, with tabularx usage, I couldn't put \caption, \label commands to refer the table. – YatShan May 28 '22 at 07:20
  • @YatShan, my MWE perfectly compile, result is showed in answer. By removing this option your list become awful ... – Zarko May 28 '22 at 07:21
  • @Zarko When I added "\setlist[tabitemize]{nosep, leftmargin = *, label = \textbullet, after=\end{minipage}, before=\begin{minipage}[t]{\linewidth}}", it says "unclosed open group { found at \end{minipage} unexpected \end{minipage} unclosed \end{minipage}" – YatShan May 28 '22 at 07:29
  • @Zarko Also, do you know how to add caption and label to this table ? As I have refer this table in the text. – YatShan May 28 '22 at 07:29
  • 1
    @YatShan, answer follow what you say in question :-). See edited answer, will appear asap. – Zarko May 28 '22 at 08:49
  • 1
    @YatShan, does answer solve your problem? If yes, than you may consider to accept it (by clicking on check mark at top left side of answer. BTW, as >I see you so far not accept asny received answer. Why, Or no one fulfil your expectation? – Zarko May 28 '22 at 15:24
  • @Zarko, it worked well, thanks for your answer. – YatShan May 28 '22 at 19:56