我知道有一些解决方案可以解决此问题或类似问题。但我尽了最大努力,却一无所获。我想在表格单元格中添加项目符号。但我得到的却是水平线上的所有点。请检查图像和 latex 脚本。如果有人能解决这个问题,我将不胜感激。
附言:我正在使用 overleaf
\begin{table}[]
\caption{Table}
\label{tbl:artefact}
\resizebox{\textwidth}{!}{%
{\renewcommand{\arraystretch}{1}
\begin{tabular}{lll}
\hline
\textbf{ID} & \textbf{Some points} & \textbf{\#} \\ \hline
Info & \begin{tabular}[c]{@{}l@{}}
\begin{itemize}
\item 1
\item 2
\item 3
\item 4
\item 5
\item 6
\end{itemize}
\end{tabular} & x1 \\ \hline
TEXT 2 & SOME TEXT & X2 \\ \hline
Text3 & Some text & X3 \\ \hline
Text4 & Some text & X4 \\ \hline
Text5 & Some text & X5 \\ \hline Text6 & Some text & X6 \\ \hline
Some values & \begin{tabular}[c]{@{}l@{}}It is a table that shows XXXXXXXXXXXXXXX\\ XXXXXXXXXXXXXXX (\textbf{P5}). \end{tabular} & X7 \\ \hline
Intended XXX & A description XXXXXXX (\textbf{Px}). & X8 \\ \hline
\end{tabular}%
}\quad
}
\end{table}
答案1
列表应在段落框列类型中,如包中定义的p{<width>}
、……或X
及其衍生物tabularx
。
使用tabularx
、enumitem
和etoolbox
包:
\documentclass{article}
\usepackage[skip=1ex]{caption}
\usepackage{booktabs, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{%
\setlist[itemize]{nosep,
leftmargin=*,
label=\textbullet,
before=\begin{minipage}[t]{\linewidth}, % <---
after=\end{minipage}} % <---
}
\begin{document}
\begin{table}[ht]
\caption{Table}
\label{tbl:artefact}
\begin{tabularx}{\linewidth}{lXl}
\toprule
\textbf{ID}
& \textbf{Some points}
& \textbf{\#} \\
\midrule
Info & \begin{itemize}
\item 1
\item 2
\item 3
\item 4
\item 5
\item 6
\end{itemize}
& x1 \\
\midrule
TEXT 2 & SOME TEXT
& X2 \\
Text3 & Some text & X3 \\
Text4 & Some text & X4 \\
Text5 & Some text & X5 \\
Text6 & Some text & X6 \\
\midrule
Some values
& It is a table that shows XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX (\textbf{P5}).
& X7 \\
\midrule
Intended XXX
& A description XXXXXXX (\textbf{Px}).
& X8 \\
\bottomrule
\end{tabularx}%
\end{table}
\end{document}