tweaklist.sty 1.9 KB

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