如何使用 parskip 布局左边距和项目符号

如何使用 parskip 布局左边距和项目符号

技术手册中有一个相当典型的布局样式,其中标题是编号的并且左对齐。然后文本缩进约 1cm,这样看起来好像有一个较大的左边距,并且标题中的数字延伸到这个边距。我从一个名为的软件包获得了基本支持,parskip它让我完成了 95% 的工作。

我使用\setlength{\leftskip}{1cm}

我想要有项目符号,这就是挑战。项目符号应该比段落稍微缩进一点。我通过以下左边距设置成功实现了这一点(请注意,顶层有额外的 1cm 以使其位于段落下方):

\usepackage{enumitem}
\setlist[itemize,1]{leftmargin=1.4cm}
\setlist[itemize,2]{leftmargin=0.5cm}
\setlist[itemize,3]{leftmargin=0.5cm}

看起来像这样:

在此处输入图片描述

问题是我还有一些称为“注释”的框,其中包含文本,也包含项目符号。在注释中使用时,我不希望额外移动 1 厘米。请注意此示例中项目符号的缩进程度过大:

在此处输入图片描述

我需要以某种方式定义项目符号,使它们既可以在正文中起作用,也可以在注释框中起作用。

我认为可能有更好的方法可以做到这一点:将左右边距定义为文本区域的边缘,并将标题更改为“减少缩进”到文本区域之外的空间。我担心我对各种尺寸如何影响其他尺寸的掌握还不够好,无法弄清楚如何做到这一点,甚至不知道这是否是一种好的方法。有什么建议吗?

下面我提供了一个完整的示例,其中包含几个部分、文本和项目符号部分:

\documentclass[letterpaper,11pt,pagesize=pdftex,openright,headings=twolinechapter,chapterprefix=true]{scrbook}

\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[table]{xcolor}
\usepackage{makeidx}
\usepackage{fontspec}
\usepackage{longtable}
\usepackage{nameref}


\setmainfont[Ligatures={Common,TeX}, Numbers={OldStyle}]{Arial}
\addtokomafont{footnote}{\footnotesize\fontspec[Ligatures=TeX]{Arial}}
\deffootnote{1.5em}{1em}{% modified example from page 83
  \makebox[1.5em][l]{\textsuperscript{\thefootnotemark}}}


\makeindex

\usepackage[inner=1in,outer=1in,top=1.0in, bottom=1.0in, footnotesep=.4in]{geometry}


%Page size settings
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight

%parskip gives us outdented headers with numbers, no indent on paragraphs
%and a little vertical space between paragraphs.
\usepackage{parskip}
\setlength{\leftskip}{1cm}

\setlength{\emergencystretch}{15pt}


%control whether extra vertical space is distributed between paragraphs
%either raggedbottom or flushbottom
\raggedbottom

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=purple,
    urlcolor=black
}

\usepackage{scrhack}
\usepackage{lineno}
\usepackage{listings}


%TABLES
%make more space between lines
\renewcommand{\arraystretch}{1.3}

\renewcommand{\labelitemi}{\textbullet}
\renewcommand{\labelitemii}{\textbullet}
\renewcommand{\labelitemiii}{\textbullet}

\usepackage{enumitem}
\setlist[itemize,1]{leftmargin=1.4cm}
\setlist[itemize,2]{leftmargin=0.5cm}
\setlist[itemize,3]{leftmargin=0.5cm}
\setlist[enumerate,1]{leftmargin=1.4cm}
\setlist[enumerate,2]{leftmargin=0.5cm}
\setlist[enumerate,3]{leftmargin=0.5cm}



\usepackage{tcolorbox}   
\colorlet{notecolor}{gray!25}

\newenvironment{note}%
   {\begin{tcolorbox}[colframe=notecolor,width=0.94\textwidth,left=1pt,right=1pt] Note: }%
   {\end{tcolorbox}} 


\begin{document}

\frontmatter

\mainmatter

\chapter{This is a chapter heading}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\section{Section Heading}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.


\subsection{Subsection Heading}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\begin{itemize}

\item first item

\item second item

\begin{itemize}

\item first nested

\item second nested

\end{itemize}

\item third item

\end{itemize}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\subsection{This is the second subsection}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\begin{note}

This is a note and below some bullets

\begin{itemize}

\item first item

\item second item

\begin{itemize}

\item first nested

\item second nested

\end{itemize}

\item third item

\end{itemize}

\end{note}


This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\end{document}

答案1

您可以在定义内部局部设置 itemize 的缩进note

\documentclass[letterpaper,11pt,pagesize=pdftex,openright,headings=twolinechapter,chapterprefix=true]{scrbook}

\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[table]{xcolor}
\usepackage{makeidx}
\usepackage{fontspec}
\usepackage{longtable}
\usepackage{nameref}


\setmainfont[Ligatures={Common,TeX}, Numbers={OldStyle}]{Arial}
\addtokomafont{footnote}{\footnotesize\fontspec[Ligatures=TeX]{Arial}}
\deffootnote{1.5em}{1em}{% modified example from page 83
  \makebox[1.5em][l]{\textsuperscript{\thefootnotemark}}}


\makeindex

\usepackage[inner=1in,outer=1in,top=1.0in, bottom=1.0in, footnotesep=.4in]{geometry}


%Page size settings
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight

%parskip gives us outdented headers with numbers, no indent on paragraphs
%and a little vertical space between paragraphs.
\usepackage{parskip}
\setlength{\leftskip}{1cm}

\setlength{\emergencystretch}{15pt}


%control whether extra vertical space is distributed between paragraphs
%either raggedbottom or flushbottom
\raggedbottom

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=purple,
    urlcolor=black
}

\usepackage{scrhack}
\usepackage{lineno}
\usepackage{listings}


%TABLES
%make more space between lines
\renewcommand{\arraystretch}{1.3}

\renewcommand{\labelitemi}{\textbullet}
\renewcommand{\labelitemii}{\textbullet}
\renewcommand{\labelitemiii}{\textbullet}

\usepackage{enumitem}
\setlist[itemize,1]{leftmargin=1.4cm}
\setlist[itemize,2]{leftmargin=0.5cm}
\setlist[itemize,3]{leftmargin=0.5cm}
\setlist[enumerate,1]{leftmargin=1.4cm}
\setlist[enumerate,2]{leftmargin=0.5cm}
\setlist[enumerate,3]{leftmargin=0.5cm}



\usepackage{tcolorbox}
\colorlet{notecolor}{gray!25}

\newenvironment{note}%
   {\begin{tcolorbox}[colframe=notecolor,width=0.94\textwidth,left=1pt,right=1pt]%
    \setlist[itemize,1]{leftmargin=.4cm}% <-- HERE
     Note: }%
   {\end{tcolorbox}}


\begin{document}

\frontmatter

\mainmatter

\chapter{This is a chapter heading}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\section{Section Heading}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.


\subsection{Subsection Heading}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\begin{itemize}

\item first item

\item second item

\begin{itemize}

\item first nested

\item second nested

\end{itemize}

\item third item

\end{itemize}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\subsection{This is the second subsection}

This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\begin{note}

This is a note and below some bullets

\begin{itemize}

\item first item

\item second item

\begin{itemize}

\item first nested

\item second nested

\end{itemize}

\item third item

\end{itemize}

\end{note}


This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.  This is a block of normal text long enough to wrap a couple of times in the output.

\begin{itemize}

\item first item

\item second item

\begin{itemize}

\item first nested

\item second nested

\end{itemize}

\item third item

\end{itemize}

\end{document}

在此处输入图片描述

相关内容