這是我第一次在這個論壇提問。我是乳膠新手。
我知道我的問題看起來與表格儲存格內的編號列表,但我的目標是做這樣的事情:
到目前為止,使用這段程式碼:
\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=*。