diff options
author | Karl Berry <karl@freefriends.org> | 2011-07-26 23:25:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-07-26 23:25:26 +0000 |
commit | fdc5e9c25570d64b606c141c6efd67c6ec046316 (patch) | |
tree | 09e404c2d6c67cdd139b0ec88f8a812fc1938a66 /Master/texmf-dist/doc/latex/moreenum | |
parent | e9b5b96e62aa1a8333723a208b797d430da33190 (diff) |
new latex package moreenum (16jul11)
git-svn-id: svn://tug.org/texlive/trunk@23239 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/moreenum')
-rw-r--r-- | Master/texmf-dist/doc/latex/moreenum/README | 64 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.pdf | bin | 0 -> 147300 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.tex | 184 |
3 files changed, 248 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/moreenum/README b/Master/texmf-dist/doc/latex/moreenum/README new file mode 100644 index 00000000000..d5ee9956e52 --- /dev/null +++ b/Master/texmf-dist/doc/latex/moreenum/README @@ -0,0 +1,64 @@ +This is the README for moreenum.sty +The author/maintainer of this work is Seamus Bradley. +tex@seamusbradley.net + +This provides the following new enumerate styles. + + - \greek for lowercase Greek letters + - \Greek for uppercase Greek letters + - \enumHex for uppercase hexadecimal enumeration + - \enumhex for lowercase hexadecimal enumeration + - \enumbinary for binary enumeration + - \enumoctal for octal enumeration + - \raisenth for 1st, 2nd, 3rd etc with raised "th"s + - \levelnth for 1st, 2nd 3rd with level "th"s + - \Nthwords for "First", "Second", "Third" etc + - \nthwords for "first", "second", "third" etc + - \NTHWORDS for "FIRST", "SECOND", "THIRD" etc + - \Nwords for "One", "Two", "Three" etc + - \nwords for "one", "two", "three" etc + - \NWORDS for "ONE", "TWO", "THREE" etc + +Each of these works with enumitem's "starred variant" feature. +So \begin{enumerate}[label=\Hex*] will output a hex enumerated list. +Enumitem provides a start=0 option for starting your enumerations at +0. +A binzero environment is provided for binary starting at zero enumeration. +Likewise enumoctzero, enumHexzero and enumhexzero for the hex enumerations. + +Currently requires amsmath, alphalph, enumitem and fmtcount +all of which should be part of any modern TeX distribution. + +This isn't so much a package designed for use as a list of recipes for +creating your own new kinds of enumeration. +All of the work is really done by the various packages loaded. + +TWO WARNINGS: + + - You probably don't want to use uppercase greek numbering. Ever. + - Be careful with uppercase Hex numbering for sections if you also + have appendices. + - (A more general version of the last point) Don't mix \Alph and + \enumHex, or \alph and \enumhex + +TO DO: + + - Properly namespace the internal macros. + - Make consistent the way the macros for counters and numbers are + treated. + - Test spacing of enumerations. + + +CHANGELOG +See https://github.com/scmbradley/moreenum for a full changelog + +v1.0 + levelnth and raisenth work with fmtcount + fmtcount also replaces binhex.tex + fmtcount also replaces numname +v0.95 + levelnth and raisenth work through environments with engord's switch + numname used for nwords and nthwords +v0.9 + Initial version + diff --git a/Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.pdf b/Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.pdf Binary files differnew file mode 100644 index 00000000000..0844f550378 --- /dev/null +++ b/Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.pdf diff --git a/Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.tex b/Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.tex new file mode 100644 index 00000000000..5009a24de6a --- /dev/null +++ b/Master/texmf-dist/doc/latex/moreenum/testcase-moreenum.tex @@ -0,0 +1,184 @@ +\documentclass[paper=A4,fontsize=12]{scrartcl} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{url} +\usepackage{etoolbox} +\usepackage{multicol} +\usepackage{listings} +\lstloadlanguages{[LaTeX]TeX} % I need to tell listings how I want code typeset. Here come some options: +\lstset{% + basicstyle=\ttfamily\small, + commentstyle=\itshape\ttfamily\small, + showspaces=false, + showstringspaces=false, + breaklines=true, + breakautoindent=true, + captionpos=t, + frame=single, + escapeinside={(*}{*)}, +} +\catcode`|=\active +\def|{\lstinline|} + +\usepackage{moreenum} +\usepackage{etoolbox} +\author{Seamus Bradley} +\title{\texttt{moreenum}} +\usepackage{tgpagella} +\usepackage{tgheros} +%\usepackage{tgcursor} +\usepackage[ocr-a]{ocr} + +\newcommand\testenumerate[1]{% + \bigskip + \begin{minipage}{0.4\linewidth} + {\qquad\Large\texttt{\textbackslash #1}} + \begin{enumerate}[label=\csname #1\endcsname*] + \item Liberty + \item Equality + \item Fraternity\setcounter{enumi}{41} + \item Meaning of life + \end{enumerate} + \end{minipage} +} +\newcommand\dotest[1]{% + \let\do\testenumerate + \docsvlist} + +\begin{document} +\maketitle + + +\section{Basic procedure} + +At the heart of each new enumeration is the following procedure: + +\begin{lstlisting} + \newcommand*{\macro}[1]{% + \expandafter\@macro\csname c@#1\endcsname} + \newcommand*{\@macro}[1]{% + \translate{#1}} + \AddEnumerateCounter{\macro}{\@macro}{distance} +\end{lstlisting} + +From a user perspective, \lstinline+\macro+ takes a counter as its +argument and outputs, say, a +binary number or whatever you want. +Actually, what it really does is turn a counter into a number and pass +the number to \lstinline+\@macro+ which does the real work. +It takes a number and translates it into the final representation. + +Most of the cleverness is done by \lstinline+\translate+ and these are +mostly macros I've borrowed from other packages. + +The |distance| is the widest entry in the enumeration. +|moreenum| hasn't been tested much with this parameter: +I've just guessed a bit at what's the widest enumerations are likely +to get. +Enumerations can \emph{theoretically} get up to 2147483647 items long. +Which would be rather a long number.\footnote{% + |fmcount| doesn't seem to work with numbers that big, actually. + But even 131071 is \binarynum{131071}} + +The |\greek| macro is a little more involved because it involves first +defining a macro that turns numbers into Greek letters. + +\begin{lstlisting} +\newcommand*{\single@greek}[1]{% + \expandafter\@single@greek\csname c@#1\endcsname +} +\newcommand*{\@single@greek}[1]{% + $\ifcase#1\or\alpha\or\beta\or\gamma\or\delta\or\varepsilon + \or\zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda + \or\mu\or\nu\or\xi\or o\or\pi\or\varrho\or\sigma + \or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega + \else\@ctrerr\fi$ +} +\end{lstlisting} + +Then you need to define what to do when you run out of letters. +You start again at $\alpha\alpha$. +The clever work there is done by the |alphalph| package. + +\begin{lstlisting} +\newalphalph{\@greek}[alph]{\@single@greek}{24} +\newcommand*{\greek}[1]{% + \expandafter\@greek\csname c@#1\endcsname +} + +\AddEnumerateCounter{\greek}{\@greek}{$\omega$} +\end{lstlisting} + +Some sophistication is required to get the |\translate|-style macros +to play nice with |\label| and |\ref| facilities. +This can be seen in the following example. + +\begin{lstlisting} +\newcommand*{\enumHex}[1]{% + \expandafter\@enumHex\csname c@#1\endcsname} +\newcommand*{\@enumHex}[1]{% + \protect\Hexadecimalnum{\number#1}} +\AddEnumerateCounter{\enumHex}{\@enumHex}{AAAA} +\end{lstlisting} + +The |\protect| makes sure the |\Hexadecimalnum| get written to the +|.aux| file, rather than expanded first. +The |\number| makes sure the number \emph{is} written to the |.aux| +file.\footnote{I'm actually guessing here. + I have no idea. + I got the clue from |egreg| here: + \url{http://tex.stackexchange.com/q/22234/215}} + +\section{Limitations} + +The biggest number TeX can handle is 2147483647. +I can't imagine this ever being a serious limitation to your +enumerating. + +There are, however, some further limitations. +Certain |fmtcount| macros seem to break before they hit this +fundamental limit. +In brackets are the |moreenum|-defined enumerations affected. +\begin{itemize} +\item |\binary| and friends break at 131072 [|\enumbinary|] +\item |\hexadecimal| and friends break at 1048576 [|\enumhex| and |\enumHex|] +\item |\numberstring| and friends break at 100000 [|\nwords| and |\nthwords|] +\end{itemize} + +None of these is a serious limitation. +If you desperately need bigger enumerations, they are fairly +straightforward to define yourself using |binhex| for the numbers and +|numname| for the words: these packages don't have these +limitations.\footnote{% + Why don't I just use those packages instead? + Because having |fmtcount| do most of the work means only loading one + package instead of 3 (|numname|, |binhex| and |nth| or |engord|).} + + +\section{Examples of the enumerations} +Here are examples of all the kinds of enumeration that the package defines: +% \dotest{greek,Greek,enumHex,enumhex,enumbinary,raisenth,levelnth,nthwords,nwords} + +\small\noindent +\testenumerate{greek}\hfil +\testenumerate{Greek} +\testenumerate{enumHex}\hfil +\testenumerate{enumhex} +\testenumerate{enumbinary}\hfil +\testenumerate{enumoctal} +\testenumerate{raisenth}\hfil +\testenumerate{levelnth} +\testenumerate{Nthwords}\hfil +\testenumerate{Nwords} +\testenumerate{NTHWORDS}\hfil +\testenumerate{NWORDS} +\testenumerate{nthwords}\hfil +\testenumerate{nwords} + + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: |