这是我第一次在这个论坛提问。我是 Latex 的新手。
我知道我的问题似乎与表格单元格内的编号列表,但我的目标是做出这样的事情:
到目前为止,使用此代码:
\documentclass[a4paper, 11pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array, multirow, blindtext, booktabs}
\begin{document}
\begin{center}
\noindent
\title\large\textbf{TITLE HERE $($KAK$)$}
\noindent
\large\textbf{SUB TITLE HERE}\\
\end{center}
\noindent
\begin{tabular}{@{}llp{0.63\textwidth}}
Material one & : & Explanation One \\
Material two & : & Explanation two \\
Material three & : & Explanation three \\
Material four & : & \begin{enumerate}\item \blindtext \item some text here \end{enumerate} \\
\end{tabular}
\end{document}
但最终的结果是:
那么,我怎样才能使编号列表与前面的文本一致呢?
答案1
我建议您加载该enumitem
包来创建非常紧凑的自定义枚举环境。
\documentclass[a4paper,11pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array, blindtext, booktabs}
\usepackage{enumitem}
%% Create a very compact enumerated list environment
\newlist{myenum}{enumerate}{1}
\setlist[myenum]{label=\arabic*., nosep, wide,
leftmargin=*, % hanging indentation
before=\vspace{-0.57\baselineskip},
after =\vspace{-0.8\baselineskip}}
\begin{document}
\begin{center}
\large\textbf{TITLE HERE $($KAK$)$}\\
\large\textbf{SUB TITLE HERE}
\end{center}
\noindent
\begin{tabular}{@{} ll p{0.63\textwidth} @{}}
\toprule
Material one & : & Explanation One \\
Material two & : & Explanation two \\
Material three & : & Explanation three \\
Material four & : &
\begin{myenum}
\item \blindtext
\item Some more text here.
\end{myenum} \\
\bottomrule
\end{tabular}
\end{document}
答案2
与 Mico 的答案类似,通过应用大小来调整垂直间距\lineskip
,也包装在新enumerate
列表中。
此外,我还使用了
@{\hskip2\tabcolsep:\hskip2\tabcolsep}
作为第二列说明符的替代l
:它将:
以正确的间距插入2\tabcolsep
到左侧,并将正确的间距插入到右侧:
\documentclass[a4paper, 11pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{blindtext}
\newlist{insidetabenum}{enumerate}{1}
\setlist[insidetabenum,1]{wide,topsep=0pt,leftmargin=*,itemsep=0pt,before={\vspace{\dimexpr-\normalbaselineskip+3\lineskip}},label={\arabic*.}}
\begin{document}
\begin{center}
\noindent
\title\large\textbf{TITLE HERE $($KAK$)$}
\noindent
\large\textbf{SUB TITLE HERE}\\
\end{center}
\noindent
\begin{tabular}{@{}l@{\hskip2\tabcolsep:\hskip2\tabcolsep}p{0.63\textwidth}}
Material one & Explanation One \\
Material two & Explanation two \\
Material three & Explanation three \\
Material four &
\begin{insidetabenum}
\item
\blindtext[2]
\item some text here \end{insidetabenum}
\end{tabular}
\end{document}
答案3
您还可以使用更简单的代码来实现此布局:
\documentclass[a4paper, 11pt]{article}
\usepackage[margin=2cm, showframe]{geometry}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{blindtext}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\begin{document}
\begin{center}
\noindent
\title\large\textbf{TITLE HERE $($KAK$)$}
\noindent
\large\textbf{SUB TITLE HERE}\\
\end{center}
\noindent
\begin{tabular}{@{}l@{\,:\hskip2\tabcolsep} >{\arraybackslash\compress}p{0.63\textwidth}@{}}
Material one & Explanation One \\
Material two & Explanation two \\
Material three & Explanation three \\
Material four &
\begin{enumerate}[label=\arabic*., wide, itemsep=0pt]%
\item
\blindtext
\item some text here
\end{enumerate}
\end{tabular}
\end{document}
如果您希望项目主体与首字母(此处的 Lorem 中的 L)垂直对齐,请添加键 `leftmargin=*。