在以下 MWE 中,我尝试使用该tabto
包来注释列表中的项目itemize
:
但我希望“章节”注释与第一的行,而不是最后一行。我该怎么做?
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
]{microtype}
\usepackage{enumitem}
\usepackage{tabto}
\newcommand{\mytab}{\tabto{5.0cm}}
\begin{document}
\begin{itemize}
\item{Fruits}
\begin{itemize}
\item{apples\\(crisp)}\mytab Chapter 1
\item{oranges\\(juicy)}\mytab Chapter 1
\end{itemize}
\item{Vegetables}
\begin{itemize}
\item{cucumbers\\(crunchy)}\mytab Chapter 2
\item{green beans\\(squishy)}\mytab Chapter 2
\end{itemize}
\end{itemize}
\end{document}
答案1
不要把\item
内容放在括号里。而是稍微重新定义\mytab
,但将其参数放在括号中和将其放置\mytab
在项目的开始处。
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
]{microtype}
\usepackage{enumitem}
\usepackage{tabto}
\newcommand\mytab[1]{\tabto{5.0cm}#1\tabto*{\TabPrevPos}}
\begin{document}
\begin{itemize}
\item{Fruits}
\begin{itemize}
\item\mytab{Chapter 1}apples\\(crisp)
\item\mytab{Chapter 1}oranges\\(juicy)
\end{itemize}
\item{Vegetables}
\begin{itemize}
\item\mytab{Chapter 2}cucumbers\\(crunchy)
\item\mytab{Chapter 2}green beans\\(squishy)
\end{itemize}
\end{itemize}
\end{document}
答案2
您可以按照以下方式模仿使用 a 嵌套 itemize 的外观tabular
:
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
]{microtype}
\usepackage{enumitem}
\begin{document}
\begin{itemize}
\item{Fruits}
\begin{tabular}{@{\quad}l@{\;}p{5cm}l}
-- & apples & Chapter 1\\
&(crisp) \\[5pt]
-- & oranges & Chapter 1 \\
& (juicy) \\
\end{tabular}
\item{Vegetables}
\begin{tabular}{@{\quad}l@{\;}p{5cm}l}
-- & cucumbers & Chapter 2 \\
&(cucumbers) \\[5pt]
-- & green beans & Chapter 2 \\
& (squishy) \\
\end{tabular}
\end{itemize}
\end{document}