枚举中的间距很难。我有一个列表,其中有些项目会换行到第二行(但不是第二项)。但第二行与第一行不对齐。
我一直在使用 parsep、itemindent、labelindent 和其他带有 enumerate 的东西,但似乎无法让任何一个正常工作。
我有两个问题。
1) 商品标签忽略了我左侧的 1.5 英寸边距。
2) 第二行换行后不会缩进到与第一行相同的位置。我甚至可能希望它“挂”得更紧一些。
以下是我目前所拥有的 MWE
\documentclass[12pt]{report}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\usepackage{fontspec} % [T1]{fontenc} is used for others, lualatex says do fontspec
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[
SmallCapsFont={Tex Gyre Termes},
SmallCapsFeatures={Letters=SmallCaps},
]{Latin Modern Roman}
\usepackage{csquotes}
%
% Page Margins and Page Layout
%
\usepackage[letterpaper]{geometry}
% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}
% Define page geometry
\geometry{left=\pageMarginLeft}
\geometry{top=\pageMargin}
\geometry{right=\pageMargin}
\geometry{bottom=\pageMargin}
\geometry{includefoot} % This makes the page number and other footers, come in the margin as well.
% List layouts, enumerated lists, mainly for CV
\usepackage{enumitem}
\usepackage{setspace}
\doublespacing
%\onehalfspacing
\begin{document}
\begin{enumerate}[align=right,parsep=-0.05in]
\singlespacing
\item[Thing here] \hskip 0.5in Definition goes here
\item[Another thing here] \hskip 0.5in Another definition goes here
\item[A longer first item here] \hskip 0.5in And another definition to go with this one
\item[Another thing2 here] \hskip 0.5in Another definition2 goes here, but this time with a very long definition that will skip to a second line.
\item[Final] \hskip 0.5in And a final definition.
\end{enumerate}
\end{document}
这是一张图片,我希望它能清楚地表明我在寻找什么。
答案1
labelsep
设置左右列之间的间隙,leftmargin
设置为最宽标签的宽度加上\labelsep
。
\documentclass[12pt]{report}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\usepackage{fontspec} % [T1]{fontenc} is used for others, lualatex says do fontspec
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[
SmallCapsFont={Tex Gyre Termes},
SmallCapsFeatures={Letters=SmallCaps},
]{Latin Modern Roman}
\usepackage{csquotes}
%
% Page Margins and Page Layout
%
\usepackage[letterpaper]{geometry}
% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}
% Define page geometry
\geometry{left=\pageMarginLeft}
\geometry{top=\pageMargin}
\geometry{right=\pageMargin}
\geometry{bottom=\pageMargin}
\geometry{includefoot} % This makes the page number and other footers, come in the margin as well.
% List layouts, enumerated lists, mainly for CV
\usepackage{enumitem}
\usepackage{setspace}
\doublespacing
%\onehalfspacing
\begin{document}
\setbox0=\hbox{A longer first item here}
\begin{enumerate}[parsep=-0.05in,labelsep=.5in,
leftmargin=\dimexpr\wd0+\labelsep\relax]
\singlespacing
\item[Thing here] Definition goes here
\item[Another thing here] Another definition goes here
\item[A longer first item here] And another definition to go with this one
\item[Another thing2 here] Another definition2 goes here, but this time with a very long definition that will skip to a second line.
\item[Final] And a final definition.
\end{enumerate}
\noindent\hrulefill
\end{document}
答案2
您的问题是,您有一个\hskip
命令将在项目正文的开头执行。这意味着如果要插入换行符,则必须再次执行 \hskip 才能得到所需的输出...但 (Xe)LaTeX 无法知道这一点。
快速修复:
\documentclass[12pt]{report}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\usepackage{fontspec} % [T1]{fontenc} is used for others, lualatex says do fontspec
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Linux Libertine O}
\usepackage{csquotes}
%
% Page Margins and Page Layout
%
\usepackage[letterpaper]{geometry}
% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}
% Define page geometry
\geometry{left=\pageMarginLeft}
\geometry{top=\pageMargin}
\geometry{right=\pageMargin}
\geometry{bottom=\pageMargin}
\geometry{includefoot} % This makes the page number and other footers, come in the margin as well.
% List layouts, enumerated lists, mainly for CV
\usepackage{enumitem}
\usepackage{setspace}
\doublespacing
%\onehalfspacing
\begin{document}
\begin{enumerate}[align=right,parsep=-0.05in,]
\singlespacing
\item[Thing here] \hskip 0.5in Definition goes here
\item[Another thing here] \hskip 0.5in Another definition goes here
\item[A longer first item here] \hskip 0.5in And another definition to go with this one
\item[Another thing2 here] \hskip 0.5in \begin{minipage}[inner sep=0]{\dimexpr \linewidth-0.5in }Another definition2 goes here, but this time with a very long definition that will skip to a second line.\end{minipage}
\item[Final] \hskip 0.5in And a final definition.Big enought to compare with the previous line length and adjust
\end{enumerate}
\end{document}
如果你愿意,你也可以创建一种新的列表,像这样:
\documentclass[12pt]{report}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\usepackage{fontspec} % [T1]{fontenc} is used for others, lualatex says do fontspec
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Linux Libertine O}
\usepackage{csquotes}
%
% Page Margins and Page Layout
%
\usepackage[letterpaper]{geometry}
% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}
% Define page geometry
\geometry{left=\pageMarginLeft}
\geometry{top=\pageMargin}
\geometry{right=\pageMargin}
\geometry{bottom=\pageMargin}
\geometry{includefoot} % This makes the page number and other footers, come in the margin as well.
% List layouts, enumerated lists, mainly for CV
\usepackage{enumitem}
\usepackage{setspace}
\doublespacing
%\onehalfspacing
\def\myitem#1#2{\olditem[#1]\hspace{0.5in}\begin{minipage}[inner sep=0]{\dimexpr\linewidth-0.5in}#2\end{minipage}}
\newlist{mylist}{enumerate}{1}
\setlist[mylist,1]{align=right,parsep=-0.05in,before={\let\olditem\item\let\item\myitem}, after=\let\item\olditem}
\begin{document}
\begin{mylist}
\singlespacing
\item{Thing here}{Definition goes here}
\item{Another thing here}{Another definition goes here}
\item{A longer first item here}{And another definition to go with this one}
\item{Another thing2 here}{Another definition2 goes here, but this time with a very long definition that will skip to a second line.}
\item{Final}{And a final definition.Big enought to compare with the previous line length and adjust}
\end{mylist}
\end{document}
结果:
但格式要简单得多
对于顶部对齐,简单的解决方案是使用表格而不是小页面:
\documentclass[12pt]{report}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\usepackage{fontspec} % [T1]{fontenc} is used for others, lualatex says do fontspec
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Linux Libertine O}
\usepackage{csquotes}
%
% Page Margins and Page Layout
%
\usepackage[letterpaper]{geometry}
% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}
% Define page geometry
\geometry{left=\pageMarginLeft}
\geometry{top=\pageMargin}
\geometry{right=\pageMargin}
\geometry{bottom=\pageMargin}
\geometry{includefoot} % This makes the page number and other footers, come in the margin as well.
% List layouts, enumerated lists, mainly for CV
\usepackage{enumitem}
\usepackage{setspace}
\doublespacing
%\onehalfspacing
\def\myitem#1#2{\olditem[#1]\hspace{0.5in}\begin{tabular}[t]{p{\dimexpr\linewidth-0.5in}}#2\end{tabular}}
\newlist{mylist}{enumerate}{1}
\setlist[mylist,1]{align=right,parsep=-0.05in,before={\let\olditem\item\let\item\myitem}, after=\let\item\olditem}
\begin{document}
\begin{mylist}
\singlespacing
\item{Thing here}{Definition goes here}
\item{Another thing here}{Another definition goes here}
\item{A longer first item here}{And another definition to go with this one}
\item{Another thing2 here}{Another definition2 goes here, but this time with a very long definition that will skip to a second line.}
\item{Final}{And a final definition.Big enought to compare with the previous line length and adjust}
\end{mylist}
\end{document}
结果:
答案3
另一个解决方案是将值更改\leftmargin
为最长标签的长度 + 0.5 英寸:
\documentclass[12pt]{report}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\usepackage{fontspec} % [T1]{fontenc} is used for others, lualatex says do fontspec
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[
SmallCapsFont={Tex Gyre Termes},
SmallCapsFeatures={Letters=SmallCaps},
]{Latin Modern Roman}
\usepackage{csquotes}
%
% Page Margins and Page Layout
%
\usepackage[letterpaper, showframe]{geometry}
% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}
% Define page geometry
\geometry{left=\pageMarginLeft}
\geometry{top=\pageMargin}
\geometry{right=\pageMargin}
\geometry{bottom=\pageMargin}
\geometry{includefoot} % This makes the page number and other footers, come in the margin as well.
% List layouts, enumerated lists, mainly for CV
\usepackage{enumitem}
\usepackage{setspace}
\doublespacing
\usepackage{calc}
\begin{document}
\begin{enumerate}[align=right,parsep=-0.05in, labelsep = 0.5in, leftmargin = \widthof{A longer first item here\hskip\labelsep}]
\singlespacing
\item[Thing here] Definition goes here
\item[Another thing here] Another definition goes here
\item[A longer first item here] And another definition to go with this one
\item[Another thing2 here] Another definition2 goes here, but this time with a very long definition that will skip to a second line.
\item[Final] And a final definition.
\end{enumerate}
\end{document}