forked from moderncv/moderncv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tweaklist.sty
56 lines (54 loc) · 1.97 KB
/
tweaklist.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%% start of file `tweaklist.sty'.
%% Original by Jakob Schiotz, downloaded from http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/tweaklist.sty; not found on ctan.
%% Modified by Xavier Danaux ([email protected]), 2020-2022 moderncv maintainers (github.com/moderncv).
%
% The tweaklist.sty package redefines the itemize, enumerate and description packages, so that all parameters can be adjusted.
% This was done by copying the original definitions, and adding "hook commands" that are executed when entering the environment.
% The hook commands are initially empty, but can be redefined with \renewcommand.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
% hooks for the itemize environment
\def\itemhook{}
\def\itemhooki{}
\def\itemhookii{}
\def\itemhookiii{}
\def\itemhookiv{}
% hooks for the enumerate environment
\def\enumhook{}
\def\enumhooki{}
\def\enumhookii{}
\def\enumhookiii{}
\def\enumhookiv{}
% hook for the description environment
\def\deschook{}
% original environment definitions, with hooks added
\def\enumerate{%
\ifnum \@enumdepth >\thr@@\@toodeep\else
\advance\@enumdepth\@ne
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
\expandafter
\list
\csname label\@enumctr\endcsname
{%
\enumhook \csname enumhook\romannumeral\the\@enumdepth\endcsname%
\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}%
}%
\fi}
\def\itemize{%
\ifnum \@itemdepth >\thr@@\@toodeep\else
\advance\@itemdepth\@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\expandafter
\list
\csname\@itemitem\endcsname
{%
\itemhook \csname itemhook\romannumeral\the\@itemdepth\endcsname%
\def\makelabel##1{\hss\llap{##1}}%
}%
\fi}
\newenvironment{description}
{\list{}{\deschook\labelwidth\z@ \itemindent-\leftmargin
\let\makelabel\descriptionlabel}}
{\endlist}