宏的创建者Easylist
是@egreg (Easylist 里面的 adjustwidth)
\makeatletter
\newbox\Easylist@box
\newenvironment{Easylist}
{\par\xdef\Easylist@tpd{\the\prevdepth}%
\setbox\Easylist@box=\vbox\bgroup
\dimen@=\@totalleftmargin
\@parboxrestore
\leftskip=\dimen@
\prevdepth\Easylist@tpd
\begin{easylist}}
{\end{easylist}\xdef\Easylist@tpd{\the\prevdepth}\egroup
\unvbox\Easylist@box\par\medskip\prevdepth\Easylist@tpd}
\makeatother
宏的创建者myeasylist
是@Henri Menke (定义自定义命名的 easylist 样式)我已重命名宏;新名称为 Easylist
\def\defineEasylist#1#2{\expandafter\def\csname
Easylist@style@#1\endcsname{\NewList(#2)}}
\def\Easylist{\futurelet\next\doEasylist}
\def\doEasylist{\ifx[\next\expandafter\doEasylistone\else\expandafter
\doEasylistnop\fi}
\def\doEasylistone[#1]
{\begin{easylist}\if\relax\detokenize{#1}\relax\else\csname
Easylist@style@#1\endcsname\fi}
\def\doEasylistnop{\begin{easylist}\NewList}
\def\endEasylist{\end{easylist}}
我已经在 MWE 中使用了这两个宏,但效果不佳。我想adjustwidth
在整个文档中使用。@egreg 编写的宏用于easylist
与结合adjustwidth
。@Henri Menke 编写的宏用于创建自定义easylist
样式。
我的妈妈:
\documentclass{article}
\usepackage[ampersand]{easylist}
\usepackage{xcolor}
\usepackage{changepage}
\makeatletter
\newbox\Easylist@box
\newenvironment{Easylist}
{\par\xdef\Easylist@tpd{\the\prevdepth}%
\setbox\Easylist@box=\vbox\bgroup
\dimen@=\@totalleftmargin
\@parboxrestore
\leftskip=\dimen@
\prevdepth\Easylist@tpd
\begin{easylist}}
{\end{easylist}\xdef\Easylist@tpd{\the\prevdepth}\egroup
\unvbox\Easylist@box\par\medskip\prevdepth\Easylist@tpd}
\makeatother
\def\defineEasylist#1#2{\expandafter\def\csname
Easylist@style@#1\endcsname{\NewList(#2)}}
\def\Easylist{\futurelet\next\doEasylist}
\def\doEasylist{\ifx[\next\expandafter\doEasylistone\else\expandafter
\doEasylistnop\fi}
\def\doEasylistone[#1]
{\begin{easylist}\if\relax\detokenize{#1}\relax\else\csname
Easylist@style@#1\endcsname\fi}
\def\doEasylistnop{\begin{easylist}\NewList}
\def\endEasylist{\end{easylist}}
\defineEasylist{lowercasestyle}
{Numbers=l,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{uppercasestyle}
{Numbers=L,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{romanlowercasestyle}
{Numbers=r,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{romanuppercasestyle}
{Numbers=R,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{bullet}{Hide=100,Hang=true,FinalSpace=0.5cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm,
Style1*=\textbullet\hspace{0.25cm},Style2*=$\circ$\hspace{0.25cm},
Style3*=$\star$\hspace{0.25cm},Style4*=$\mp$\hspace{0.25cm}}
\begin{document}
\begin{adjustwidth}{2cm}{}
\begin{Easylist}[bullet]
& dog
&& cat
&&& rabbit
\end{Easylist}
\par\bigskip
\begin{Easylist}[lowercasestyle]
& dog
&& cat
&&& rabbit
\end{Easylist}
\par\bigskip
\begin{Easylist}[romanuppercasestyle]
& dog
&& cat
&&& rabbit
\end{Easylist}
\par\bigskip
\begin{Easylist}[romanlowercasestyle]
& dog
&& cat
&&& rabbit
\end{Easylist}
\end{adjustwidth}
\end{document}
答案1
在@cfr 的帮助下
\documentclass[a4paper,12pt]{article}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={3.5cm,1.5cm},vmargin={1cm,1cm}}
\geometry{includehead=true,headheight=3cm,headsep=1cm}
\geometry{includefoot=false}
\usepackage{changepage}
\usepackage{titlesec}
\usepackage{etoolbox}
\usepackage[ampersand]{easylist}
\usepackage{xcolor}
\titleformat{\section}{\Large\bfseries}{\parbox{2cm}{\thesection}}{-0.5pt}{}
\titleformat{\subsection}{\large\bfseries}{\parbox{2cm}{\thesubsection}}{-0.5pt}{}
\titleformat{\subsubsection}{\normalsize\bfseries}{\parbox{2cm}{\thesubsubsection}}{-0.5pt}{}
\titlespacing*{\section}{-2cm}{0.6cm}{0.6cm}
\titlespacing*{\subsection}{-2cm}{0.4cm}{0.4cm}
\titlespacing*{\subsubsection}{-2cm}{0.2cm}{0.2cm}
\def\defineEasylist#1#2{\expandafter\def\csname
Easylist@style@#1\endcsname{\NewList(#2)}}
\def\Easylist{\futurelet\next\doEasylist}
\def\doEasylist{\ifx[\next\expandafter\doEasylistone\else\expandafter
\doEasylistnop\fi}
\def\doEasylistone[#1]
{\begin{easylist}\if\relax\detokenize{#1}\relax\else\csname
Easylist@style@#1\endcsname\fi}
\def\doEasylistnop{\begin{easylist}\NewList}
\def\endEasylist{\end{easylist}}
\defineEasylist{lowercasestyle}
{Numbers=l,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{uppercasestyle}
{Numbers=L,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{romanlowercasestyle}
{Numbers=r,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{romanuppercasestyle}
{Numbers=R,Hang=true,FinalSpace=0.2cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}
\defineEasylist{bullet}{Hide=100,Hang=true,FinalSpace=0.5cm,Align=fixed,
Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm,
Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm,
Style1*=\textbullet\hspace{0.25cm},Style2*=$\circ$\hspace{0.25cm},
Style3*=$\star$\hspace{0.25cm},Style4*=$\mp$\hspace{0.25cm}}
\begin{document}
\section{Section Section Section Section Section Section Section Section Section}
\lipsum[1]
\begin{Easylist}[bullet]
& dog
&& cat
&&& rabbit
\end{Easylist}
\par\bigskip
\begin{Easylist}[lowercasestyle]
& dog
&& cat
&&& rabbit
\end{Easylist}
\par\bigskip
\begin{Easylist}[romanuppercasestyle]
& dog
&& cat
&&& rabbit
\end{Easylist}
\par\bigskip
\begin{Easylist}[romanlowercasestyle]
& dog
&& cat
&&& rabbit
\end{Easylist}
\subsection{Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section}
\lipsum[1]
\subsubsection{Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section}
\lipsum[1]
\end{document}