| 1 |
% |
| 2 |
% Copyright (C) 2007 by Gustavo MEZZETTI <[email protected]>. |
| 3 |
% |
| 4 |
% This file is part of a work named "bullcntr package". |
| 5 |
% |
| 6 |
% The bullcntr package may be distributed and/or modified under the |
| 7 |
% conditions of the LaTeX Project Public License, either version 1.3 of |
| 8 |
% this license or (at your option) any later version. |
| 9 |
% The latest version of this license is in |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 12 |
% version 2005/12/01 or later. |
| 13 |
% |
| 14 |
% The bullcntr package has the LPPL maintenance status |
| 15 |
% "author-maintained". |
| 16 |
% |
| 17 |
% The file `manifest.txt' that comes along with this file specifies what |
| 18 |
% the bullcntr package consists of; more precisely, it explains how the |
| 19 |
% locutions "Work" and "Compiled Work", used in the LaTeX Project Public |
| 20 |
% License, are to be interpreted in the case of this work. |
| 21 |
% |
| 22 |
% Note that the distribution of this file alone is "distribution of only |
| 23 |
% part of the Work" in the sense of the LaTeX Project Public License, |
| 24 |
% and should be avoided (see the LaTeX Project Public Licence for |
| 25 |
% details). |
| 26 |
% |
| 27 |
\documentclass[a4paper]{article} |
| 28 |
% Non-metric paper sizes have no right to exist! (;-) |
| 29 |
\usepackage{bullcntr} |
| 30 |
% Of course, there is no need to load the hyperref package, but we |
| 31 |
% like to use it: |
| 32 |
\usepackage[bookmarksnumbered]{hyperref} |
| 33 |
|
| 34 |
\title{Using \tbull:\\an example} |
| 35 |
\author{G.~Mezzetti} |
| 36 |
\date{October~10, 2008} |
| 37 |
|
| 38 |
% The following command definitions has nothing to do with the |
| 39 |
% bullcntr package: you may ignore them. |
| 40 |
|
| 41 |
\DeclareRobustCommand*{\command}[1]{% |
| 42 |
{\texorpdfstring{\normalfont\ttfamily \char\escapechar}{\pdfbslash}#1}% |
| 43 |
} |
| 44 |
\DeclareRobustCommand*{\packlass}[1]{% |
| 45 |
{\texorpdfstring{\normalfont \sffamily}{}#1}% |
| 46 |
} |
| 47 |
\DeclareRobustCommand*{\meta}[1]{% |
| 48 |
\texorpdfstring |
| 49 |
{\mbox{\normalfont \(\langle\textit{#1}\rangle\)}}% |
| 50 |
{<#1>}% |
| 51 |
} |
| 52 |
\DeclareRobustCommand*{\filedir}[1]{{\normalfont\ttfamily #1}} |
| 53 |
\DeclareRobustCommand*{\cnt}[1]{\texttt{#1}} |
| 54 |
\newcommand*{\Bullcntr}{bullcntr} |
| 55 |
\newcommand*{\bull}{\packlass{\Bullcntr}} |
| 56 |
\newcommand*{\tbull}{the \bull\ package} |
| 57 |
\newcommand*{\Bullenum}{bullenum} |
| 58 |
\newcommand*{\benu}{\packlass{\Bullenum}} |
| 59 |
\newcommand*{\tbenu}{the \benu\ package} |
| 60 |
|
| 61 |
\newcommand*{\pdfbslash}{} |
| 62 |
{\catcode`\|=0 |catcode`|\=12 |gdef|pdfbslash{\\}} |
| 63 |
|
| 64 |
% End of command definitions. |
| 65 |
|
| 66 |
% The following is just a neurotic symptom of the author: |
| 67 |
\hfuzz = 0pt |
| 68 |
\vfuzz = 0pt |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
\begin{document} |
| 73 |
|
| 74 |
\maketitle |
| 75 |
|
| 76 |
\begin{abstract} |
| 77 |
This document illustrates, by means of practical examples, the use |
| 78 |
of \tbull. You should read the \LaTeX\ source of this document |
| 79 |
and compare it with the output it produces; you may also find it |
| 80 |
useful as a starting base for your own coding. |
| 81 |
\end{abstract} |
| 82 |
|
| 83 |
\tableofcontents |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
\setcounter{secnumdepth}{0} |
| 88 |
|
| 89 |
\section{Introduction} |
| 90 |
|
| 91 |
If you are reading this document, you will probably know what \tbull\ |
| 92 |
is and what purpose it fulfills. In the sequel, we shall assume no |
| 93 |
other knowledge about \tbull\ besides this; in particular, we assume |
| 94 |
that you did not bother reading the documentation, and prefer to learn |
| 95 |
how to use this package by looking at some sample code. We also take |
| 96 |
for granted that you are reading the \LaTeX\ source of this document, |
| 97 |
and comparing it with the output it produces. |
| 98 |
|
| 99 |
Actually, you might quite well avoid reading this document too: the |
| 100 |
typical user of \tbull\ just wishes to produce enumeration lists whose |
| 101 |
items are numbered with bullets, and in order to learn quickly how to |
| 102 |
do this, it suffices to look at the examples contained |
| 103 |
in~\cite{enum-sam}. |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
\setcounter{secnumdepth}{3} |
| 108 |
|
| 109 |
\section{Basic usage} |
| 110 |
|
| 111 |
\newcounter{mycntr} |
| 112 |
|
| 113 |
If you are reading the \LaTeX\ source, you will see that we have just |
| 114 |
defined a new counter named \cnt{mycntr}. We use this counter for |
| 115 |
the examples below. |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
\subsection{Using the \command{\Bullcntr} command directly} |
| 120 |
|
| 121 |
Since it has just been defined, the \cnt{mycntr} counter has presently |
| 122 |
the value~\arabic{mycntr}, which \tbull\footnote{More precisely, |
| 123 |
version 0.04\ (2007/04/02), or later, of \tbull: version 0.03 |
| 124 |
incorrectly displayed a spurious bullet in this case.} displays |
| 125 |
as~``\bullcntr{mycntr}'', that is, as nothing at all. |
| 126 |
\refstepcounter{mycntr}\label{mycntr-1}After a \verb|\refstepcounter|, |
| 127 |
the value has become~\arabic{mycntr}, which, in ``bulletted'' form, is |
| 128 |
shown as~``\bullcntr{mycntr}''. We may also refer to the |
| 129 |
value~\ref{mycntr-1} on page~\pageref{mycntr-1}: since we have not |
| 130 |
changed the definition of \verb|\themycntr|, the reference is printed |
| 131 |
as shown. |
| 132 |
|
| 133 |
Bear in mind that the \verb|\bullcntr| command works only if the value |
| 134 |
of the counter you want to display lies between 0 and~9 (inclusive); |
| 135 |
otherwise, an error is generated. |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
\subsection{Redefining the \command{the}\meta{ctr} command} |
| 140 |
|
| 141 |
\renewcommand*{\themycntr}{\bullcntr{mycntr}} |
| 142 |
|
| 143 |
After redefining \verb|\themycntr|, we may say that the value of the |
| 144 |
\cnt{mycntr} counter is~\themycntr. |
| 145 |
\refstepcounter{mycntr}\label{mycntr-2}As above, after a |
| 146 |
\verb|\refstepcounter|, the value has become~\themycntr, but this time |
| 147 |
a reference is typeset as~``\ref{mycntr-2}'' too (on |
| 148 |
page~\pageref{mycntr-2}, why not). |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
\subsection{Changing the bullet style} |
| 153 |
|
| 154 |
\heartctrbull |
| 155 |
|
| 156 |
Now the value of the counter is displayed as~``\themycntr'', but the |
| 157 |
previous reference is still typeset as~``\ref{mycntr-2}''. |
| 158 |
\refstepcounter{mycntr}\label{mycntr-3}You need another |
| 159 |
\verb|\refstepcounter|, issued after changing the style, to get a |
| 160 |
reference to the value~\ref{mycntr-3} on page~\pageref{mycntr-3}. |
| 161 |
This is in no way a bug, but really a feature! (Could it ever be the |
| 162 |
other way around?) |
| 163 |
|
| 164 |
\smartctrbull |
| 165 |
|
| 166 |
We have now reverted to the default style: indeed, the value of the |
| 167 |
counter is displayed as~``\themycntr'', but, of course, the reference |
| 168 |
is still to~\ref{mycntr-3}. |
| 169 |
|
| 170 |
\renewcommand*{\counterlargebullet}{$\scriptstyle \star$} |
| 171 |
|
| 172 |
You are not limited to the provided predefined bullet styles (there |
| 173 |
are four of them): you may pick any character you want---for example, |
| 174 |
a star---and use it in place of the default bullet, as |
| 175 |
in~``\themycntr''; but for this, you should better read the |
| 176 |
documentation\ldots |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
\section{Simple enumerations} |
| 181 |
|
| 182 |
It is possible to employ \tbull\ alone to produce lists whose items |
| 183 |
are numbered with bullets, in simple situations, although there is |
| 184 |
little point in doing this, since it is easier to use \tbenu\ |
| 185 |
(see~\cite{enum-sam}), which also works in more complex contexts. In |
| 186 |
any case, here are some examples. |
| 187 |
|
| 188 |
% Restore the default bullet style: |
| 189 |
\smartctrbull |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
\subsection{The default style} |
| 194 |
|
| 195 |
If you don't alter the bullet style, you will get an enumeration like |
| 196 |
the following: |
| 197 |
|
| 198 |
\begin{enumerate} |
| 199 |
\renewcommand*{\theenumi}{\bullcntr{enumi}} |
| 200 |
\renewcommand*{\labelenumi}{\theenumi} |
| 201 |
|
| 202 |
\item\label{enum-1} One bullet. |
| 203 |
\item\label{enum-2} Two bullets. |
| 204 |
\item\label{enum-3} Three bullets. |
| 205 |
\item\label{enum-4} Four bullets. |
| 206 |
\item\label{enum-5} Five bullets. |
| 207 |
\item\label{enum-6} Six bullets. From six bullets onward, |
| 208 |
the default settings provide that smaller bullets be used to |
| 209 |
make up the arrangement. |
| 210 |
\item\label{enum-7} Seven bullets. |
| 211 |
\item\label{enum-8} And so on\ldots |
| 212 |
\end{enumerate} |
| 213 |
|
| 214 |
The references are to items \ref{enum-1}, \ref{enum-2}, \ref{enum-3}, |
| 215 |
\ref{enum-4}, \ref{enum-5}, \ref{enum-6}, \ref{enum-7}, |
| 216 |
and~\ref{enum-8}. |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
\subsection{Larger bullets} |
| 221 |
|
| 222 |
You might prefer that the bullet size don't shrink when the value~6 |
| 223 |
is reached, as in the following example. |
| 224 |
|
| 225 |
\begin{enumerate} |
| 226 |
\renewcommand*{\theenumi}{\bullcntr{enumi}} |
| 227 |
\renewcommand*{\labelenumi}{\theenumi} |
| 228 |
\largectrbull |
| 229 |
|
| 230 |
\item One bullet. |
| 231 |
\item Two bullets. |
| 232 |
\item Three bullets. |
| 233 |
\item Four bullets. |
| 234 |
\item Five bullets. |
| 235 |
\item Six bullets. As you can see, the bullets have not shrunk. |
| 236 |
\item Seven bullets. |
| 237 |
\item And so on\ldots |
| 238 |
\end{enumerate} |
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
\subsection{Smaller bullets} |
| 243 |
|
| 244 |
Another possibility is to use small bullets since the beginning, as in |
| 245 |
the following example. |
| 246 |
|
| 247 |
\begin{enumerate} |
| 248 |
\renewcommand*{\theenumi}{\bullcntr{enumi}} |
| 249 |
\renewcommand*{\labelenumi}{\theenumi} |
| 250 |
\smallctrbull |
| 251 |
|
| 252 |
\item One bullet. As you can see, the bullet is already small. |
| 253 |
\item Two bullets. |
| 254 |
\item Three bullets. |
| 255 |
\item Four bullets. |
| 256 |
\item Five bullets. |
| 257 |
\item Six bullets. |
| 258 |
\item Seven bullets. |
| 259 |
\item And so on\ldots |
| 260 |
\end{enumerate} |
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
\subsection{Hearts} |
| 265 |
|
| 266 |
What the title states. |
| 267 |
|
| 268 |
\begin{enumerate} |
| 269 |
\renewcommand*{\theenumi}{\bullcntr{enumi}} |
| 270 |
\renewcommand*{\labelenumi}{\theenumi} |
| 271 |
\heartctrbull |
| 272 |
|
| 273 |
\item One heart. The size of the hearts does not change. |
| 274 |
\item Two hearts. |
| 275 |
\item Three hearts. |
| 276 |
\item Four hearts. |
| 277 |
\item Five hearts. |
| 278 |
\item Six hearts. |
| 279 |
\item Seven hearts. |
| 280 |
\item And so on\ldots |
| 281 |
\end{enumerate} |
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
\setcounter{secnumdepth}{0} |
| 286 |
\providecommand*\bysame{\leavevmode\hbox to3em{\hrulefill}\thinspace} |
| 287 |
|
| 288 |
\begin{thebibliography}{9} |
| 289 |
\providecommand*{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace} |
| 290 |
\addcontentsline{toc}{section}{\refname} |
| 291 |
|
| 292 |
\bibitem{dtx} |
| 293 |
G.~Mezzetti, \emph{The \bull\ package}, documented \TeX\ |
| 294 |
source (dtx), included in every distribution of \tbull\ (in |
| 295 |
the file \filedir{\Bullcntr.dtx}). |
| 296 |
|
| 297 |
\bibitem{overview} |
| 298 |
\bysame, \emph{Overview of \tbull}, included in every |
| 299 |
distribution of \tbull, surely as \LaTeX\ source (in the file |
| 300 |
\filedir{\Bullcntr-man.tex}) and perhaps in precompiled PDF |
| 301 |
format too (in the file \filedir{\Bullcntr-man.pdf}). |
| 302 |
|
| 303 |
\bibitem{enum-sam} |
| 304 |
\bysame, \emph{Using \tbenu: an example}, \LaTeX\ source, |
| 305 |
included in every distribution of \tbull\ (in the file |
| 306 |
\filedir{\Bullenum-sam.tex}). |
| 307 |
\end{thebibliography} |
| 308 |
|
| 309 |
|
| 310 |
\end{document} |