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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
|
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% Two LaTeX runs are required to ensure this document is up-to-date
% It can take a long time to sort the index, so use the optimize
% option. This has values: off (no optimize, sorting is done every
% run), low (sort every second run) or high (write sorted database
% to file and read in next time round). Don't modify the
% index/glossary databases while the optimize option is set to
% high. Do the modifications while the optimize option is set to
% low or off. Alternatively, delete the .aux and .gidx files before rerunning
% LaTeX.
%\usepackage[optimize=high]{datagidx}
\usepackage[optimize=off]{datagidx}
\usepackage[colorlinks]{hyperref}
% Define some convenient commands
\newcommand*{\principleloc}[1]{\textbf{#1}}
\newcommand*{\appname}[1]{\texttt{#1}}
% Later we'll switch to a fancy small caps Roman page numbering
\newcommand*{\myscroman}[1]{%
\myscromannum{\value{#1}}%
}
\newcommand*{\myscromannum}[1]{%
\textsc{\romannumeral#1}%
}
% Now we need to add this as a possible location type
\DTLgidxAddLocationType{myscromannum}
% Don't let \appname interfere with the sorting and labelling of
% terms:
\appto\newtermlabelhook{\let\appname\DTLgidxNoFormat}
% (datagidx also does this for \MakeUppercase, \MakeTextUppercase,
% \MakeLowercase, \MakeTextLowercase, \textsc and \acronymfont.)
% Make an index database labelled 'index' with given title.
\newgidx{index}{Index}
% Define some terms for the index (entries must be defined in the
% preamble).
% Either use "database" key in optional argument
% or set the default database. It's less typing to set the default
% database, so let's do that:
\DTLgidxSetDefaultDB{index}
% All the following definitions will add terms to the "index" database:
% accent commands get stripped from the default label and sort
% so the following gets both the label and sort set to 'macedoine'
\newterm{mac\'edoine}
% The following gets both the label and sort set to 'macrame'
% (This is only tested with utf8. It most likely won't work with
% other encodings.)
\newterm{macramé}
% Take care if the first letter starts with an accent.
% The initial accented letter must be grouped to ensure it works
% with \makefirstuc, but this will make the default label '{e}lite'
% rather than 'elite', so let's override the default:
\newterm[label=elite]{{é}lite}
% Sometimes the default sort may not suit your requirements. In
% which case you can override it:
\newterm
[
sort={Ten Downing Street}
]
{10 Downing Street}
\newterm{singular}
\newterm{plural}
\newterm{group}
\newterm[see=group]{scope}
\newterm[label={glossary}]{glossary}
\newterm
[%
label={index},
seealso={glossary},
]
{index}
\newterm
[
seealso={glossary}
]
{acronym}
\newterm[parent=acronym]{reset}
\newterm[parent=acronym]{unset}
\newterm
[%
parent=acronym,
label={firstuse},
]
{first use}
\newterm
[%
parent=acronym,
label={acronymlist},
text={list of acronyms},
plural={lists of acronyms}
]
{list}
\newterm{reptile}
\newterm
[%
seealso={reptile}
]
{crocodylian}
\newterm
[%
parent=crocodylian
]
{crocodile}
\newterm
[%
parent=crocodylian
]
{caiman}
\newterm
[%
parent=crocodylian
]
{alligator}
\newterm{seal}
\newterm{sea lion}
\newterm{sea}
\newterm{sea anchor}
\newterm{sea urchin}
\newterm{seam bowler}
\newterm{seam}
% Be careful if a value contains a comma or an equal sign. The
% entire value must be grouped.
\newterm
[%
label={comma},
sort={,},
text={comma (,)},
plural={commas (,)}
]%
{, (comma)}
\newterm
[%
label={equals},
sort={=},
text={equal sign (=)},
plural={equal signs (=)},
]%
{= (equal sign)}
% Don't need to worry about makeindex's special characters (since
% we're not using makeindex!)
\newterm
[%
label={"},
sort={"},
text={double quote (")},
plural={double quotes (")},
]%
{" (double quote)}
\newterm
[%
label={!},
sort={!},
text={exclamation mark (!)},
plural={exclamation marks (!)},
]%
{! (exclamation mark)}
\newterm
[%
label={|},
sort={|},
text={vertical bar (\textbar)},
plural={vertical bars (\textbar)},
]%
{\textbar\ (vertical bar)}
% Be careful of special characters
\newterm
[%
label={amp},
sort={\DTLgidxStripBackslash{\&}},
text={ampersand (\&)},
plural={ampersands (\&)},
]
{\& (ampersand)}
\newterm
[%
label={underscore},
sort={\DTLgidxStripBackslash{\_}},
text={underscore (\_)},
plural={underscores (\_)},
]
{\_ (underscore)}
\newterm
[%
label={dollar},
sort={\DTLgidxStripBackslash{\$}},
text={dollar (\$)},
plural={dollars (\$)},
]
{\$ (dollar)}
\newterm
[%
label={circum},
sort={\DTLgidxStripBackslash{\^}},
text={circumflex (\textasciicircum)},
plural={circumflexes (\textasciicircum)},
]
{\textasciicircum\ (circumflex)}
\newterm
[%
label={tilde},
sort={\string~},
text={tilde (\textasciitilde)},
plural={tildes (\textasciitilde)},
]
{\textasciitilde\ (tilde)}
\newterm{0\DTLgidxParen{zero}}
\newterm{1\DTLgidxParen{one}}
\newterm{2\DTLgidxParen{two}}
\newterm{3\DTLgidxParen{three}}
\newterm{10\DTLgidxParen{ten}}
\newterm{100\DTLgidxParen{one hundred}}
\newterm{20\DTLgidxParen{twenty}}
\newterm{alpine}
% Let's index a person
% The label is formed from the surname.
% If you are indexing more than one person with the same surname,
% you'll have to provide your own labels via the label key.
\newterm{\DTLgidxName{Donald E.}{Knuth}}
% Let's have some examples from the Oxford Style Manual:
\newterm{highwater}
\newterm{highlights}
\newterm{highbrow}
\newterm{Highclere Castle}
\newterm{highball}
\newterm{high chair}
\newterm{high heels}
\newterm{high-fliers}
% parenthetical material
\newterm{high\DTLgidxParen{light-headed}}
\newterm
[% label needed to distinguish from previous entry
label=highheight,
]
{high\DTLgidxParen{height}}
\newterm{\emph{High Water}\DTLgidxParen{play}}
\newterm{high water}
\newterm{\emph{New York, New York}}
% Using \DTLgidxName allows the sort key to work with \dtlwordindexcompare
\newterm{\DTLgidxName{J.}{High}}
\newterm{\DTLgidxName{P.}{High-Smith}}
\newterm{\DTLgidxName{A.}{Highsmith}}
\newterm{\DTLgidxName{Earl of}{New York}}
% Some more examples from the Oxford Style Manual
\newterm
[
label={DrMeynell}
]
{\DTLgidxName{\DTLgidxRank{Dr}{A.}}{Meynell}}
\newterm
[%
label={AliceMeynell}
]
{\DTLgidxName{Alice}{Meynell}}
\newterm
[%
label={AMeynell}
]
{\DTLgidxName{A}{Meynell}}
\newterm
[%
label={FMeynell}
]
{\DTLgidxName{F.}{Meynell}}
\newterm
[%
label={WGMeynell}
]
{\DTLgidxName{W.~G.}{Meynell}}
\newterm
[%
label={WMeynell}
]
{\DTLgidxName{W.}{Meynell}}
\newterm
[%
label={SirMeynell}
]
{\DTLgidxName{\DTLgidxRank{Sir}{F.}}{Meynell}}
% Using \DTLgidxMac allows the sort key to sort on ``Mac'' rather
% than the argument to \DTLgidxMac
\newterm{\DTLgidxName{Joe}{\DTLgidxMac{Mc}Cullers}}
\newterm{\DTLgidxName{Bob}{\DTLgidxMac{M'}Fingal}}
% The labels need to be set here as we have identical surnames
\newterm
[%
label={TomMacFarlane}
]%
{\DTLgidxName{Tom}{\DTLgidxMac{Mac}Farlane}}
\newterm
[%
label={DickMacFarlane}
]%
{\DTLgidxName{Dick}{\DTLgidxMac{Mac}Farlane}}
\newterm{\DTLgidxName{Harry}{\DTLgidxMac{Mc}Namee}}
\newterm{\DTLgidxMac{Mc}Carthyism}
\newterm{\DTLgidxMac{Mc}Guffin}
\newterm{\DTLgidxMac{Mc}Coy}
\newterm{macadam}
\newterm{ma'am}
\newterm{ma}
\newterm{macabre}
\newterm{machete}
\newterm{deem}
\newterm{demote}
\newterm{deerstalker}
\newterm{deface}
\newterm{de facto}
% Don't let the hyphen be considered a word boundary:
\newterm{de\DTLgidxIgnore{-}escalate}
% Ignore particles such as "de", "von", "of"
% The label defaults to deWinter but the name is displayed as
% de~Winter
\newterm{\DTLgidxName{Fred}{\DTLgidxParticle{de}{Winter}}}
\newterm{\DTLgidxName{Wilma}{Winter}}
\newterm{\DTLgidxName{Betty}{Winters}}
% these all need labels added to ensure uniqueness:
\newterm
[
label={HenrySonJohn}
]
{\DTLgidxOffice{son \DTLgidxParticle{of}{John}}{Henry}}
\newterm
[
label={HenryBeaumont}
]
{\DTLgidxOffice{bishop \DTLgidxParticle{of}{Bayeux}}{Henry
\DTLgidxParticle{de}{Beaumont}}}
\newterm
[
label={HenryScribe}
]
{\DTLgidxOffice{scribe \DTLgidxParticle{of}{Bury}
\DTLgidxSaint{St}~Edmunds}{Henry}}
\newterm
[
label={HenryKing}
]
{\DTLgidxOffice{king \DTLgidxParticle{of}{England}}{Henry}}
\newterm
[
label={HenryBlois}
]
{\DTLgidxOffice{bishop \DTLgidxParticle{of}{Winchester}}{Henry
\DTLgidxParticle{of}{Blois}}}
\newterm
[
label={HenryBlund}
]
{Henry Blund}
\newterm
[
label={HenryEssex}
]
{Henry \DTLgidxParticle{of}{Essex}}
\newterm
[
label={HenryLittle}
]
{Henry \DTLgidxParticle{the}{Little}}
\newterm
[
label={HenryMowbray}
]
{Henry \DTLgidxParticle{de}{Mowbray}}
\newterm
[
label={HenryFitzRobert}
]
{Henry \DTLgidxParticle{Fitz}{Robert}}
\newterm
[
label={JBSaint}
]
{\DTLgidxName{J.~B.}{Saint}}
\newterm
[
label={StAndrews}
]
{\DTLgidxPlace{\DTLgidxSaint{St}~Andrews}{Fife}}
\newterm
[
label={StBenetsHall}
]
{\DTLgidxSaint{St}~Benet's Hall}
\newterm
[
label={StJamesInfirmary}
]
{\DTLgidxSaint{St}~James Infirmary}
\newterm
[
label={QStJohnSmythe}
]
{\DTLgidxName{Q.}{\DTLgidxSaint{St}~John-Smythe}}
\newterm
[
label={SaintJulian}
]
{\DTLgidxSaint{Saint}-Julian}
\newterm
[
label={StJustinRoseland}
]
{\DTLgidxSaint{St}~Just-in-Roseland}
% Names with an associated number
% The following gets the label 'James I' and sort 'James 01'
\newterm{James~\DTLgidxNameNum{1}}
% The following gets the label 'James II' and sort 'James 02'
\newterm{James~\DTLgidxNameNum{2}}
% etc
\newterm{James~\DTLgidxNameNum{3}}
\newterm{James~\DTLgidxNameNum{4}}
\newterm{James~\DTLgidxNameNum{5}}
% In the following, the label and name default to 'New York, population'
% The text defaults to 'population'.
% Using \DTLgidxSubject allows the sort key to work with \dtlwordindexcompare
% Here both the label and the text have been changed from their
% defaults.
\newterm
[
label={popNY},% give it a short, easy to type label
text={population of New York}
]
{\DTLgidxSubject{population}{New York}}
% In the following, the label and name become 'New York, USA'
% The text becomes 'New York'.
% The sort key is adjusted to work with \dtlwordindexcompare
\newterm{\DTLgidxPlace{USA}{New York}}
\newterm{\ensuremath{\alpha}-iron}% gets label and sort keys 'alpha-iron'
\newterm{\ensuremath{\alpha} chain}% label & sort -> 'alpha chain'
\newterm{\ensuremath{\alpha} Centauri}% label & sort -> 'alpha Centauri'
\newterm{alphabet}
\newterm{\ensuremath{\Lambda} calculus}% label & sort -> 'Lambda calculus'
% and have a few more entries in the same letter group to test case
% ordering:
\newterm{kite}
\newterm{koala}
% Earlier I modified \newtermlabelhook so
% that \appname won't interfere with the sorting
% and labelling mechanism, so I don't need to specify separate sort
% and label keys here:
\newterm{\appname{makeindex}}% label and sort both set to just 'makeindex'
\newterm{\appname{xindy}}% label and sort both set to just 'xindy'
\title{Sample Document Using the datagidx Package}
\author{Nicola L. C. Talbot}
\begin{document}
\pagenumbering{roman}
The datagidx package was developed to follow the word order indexing
style described by the Oxford Style Manual. Many of the examples
here are taken from that manual. Two \LaTeX\ runs are required. If
you get a pdfTeX warning that a destination has been referenced but
does not exist, this may mean the index is out-of-date and you need
to do another \LaTeX\ run.
With word ordering a word break (space or hyphen) comes before all
other letters of the alphabet (\gls{sea lion} comes before \gls{seal}).
With letter ordering word breaks are ignored (so \gls{seal} comes
before \gls{sea lion}).
Use a few terms here: \gls{index}, \gls{group}, \gls{singular}, \gls{plural}.
\newpage
\Gls{singular}, \glspl{plural}. \gls{glossary}.
\Gls{acronym}: \gls{reset}, \gls{firstuse}.
\newpage
\pagenumbering{arabic}
Switched page numbering style. \Gls{singular}, \gls{kite},
\gls{koala}, \gls{crocodile}, \gls{seal}.
\Gls{sea},
\gls{sea anchor},
\gls{sea urchin}.
Some characters: \gls{comma}, \gls{equals}, \gls{"}, \gls{!}, \gls{|}
\gls{amp}, \gls{underscore}, \gls{dollar}, \gls{circum},
\gls{tilde}.
Some numbers: \gls{0}, \gls{1}, \gls{2}, \gls{3}, \gls{20}, \gls{10}.
\newpage
Some numbers again: \gls{0}, \gls{1}, \gls{2}, \gls{3}, \gls{100},
\gls{10}, \gls{20}.
Case mixture: \gls{kite},
\gls{Knuth} and
\gls{[principleloc]koala}.
\Gls{de-escalate}, \gls{deem}, \gls{demote}.
We don't need to use \gls{makeindex} or \gls{xindy}!
However, \TeX\ takes longer to sort and collate than either
\gls{makeindex} or \gls{xindy}, so document compilation time will
take longer.
\newpage
\Gls{kite}, \gls{highwater}, \gls{koala}, \gls{caiman}, \gls{sea
lion}, \gls{high},
\gls{highbrow}, \gls{high chair}, \gls{highball}, \gls{reptile},
\gls{highlights}, \gls{high heels}, \gls{high-fliers}.
\Gls{seam} and \gls{seam bowler}.
\gls{New York, New York}. \gls{New York}.
\Gls{popNY}. \gls{New York, USA}.
\gls{Highclere Castle}.
\gls{High}. \gls{High-Smith}, \gls{Highsmith}, \gls{High Water}
as opposed to \gls{high water}. \Gls{alphabet}. \Gls{alpine}.
Some terms with Greek letters: \gls{alpha-iron},
\gls{Lambda calculus}, \gls{alpha chain}, \gls{alpha Centauri}.
\newpage
\renewcommand{\thepage}{\myscroman{page}}%
Switching to small caps Roman page numbering.
\Gls{kite}. \Glspl{alligator}. \Gls{highheight}.
\gls{deWinter}.
\gls{Winter}.
\gls{Winters}.
\gls{McCullers}.
\gls{M'Fingal}.
\gls{TomMacFarlane}.
\gls{DickMacFarlane}.
\gls{McNamee}.
\gls{McCarthyism},
\gls{McGuffin},
\gls{McCoy}.
\Gls{macadam},
\gls{ma'am},
\gls{ma},
\gls{macabre},
\gls{macrame},
\gls{macedoine}.
\Gls{elite},
\gls{deem},
\gls{demote},
\gls{deerstalker},
\gls{deface},
\gls{de facto}.
\gls{AliceMeynell}.
\gls{AMeynell}.
\gls{DrMeynell}.
\gls{SirMeynell}.
\gls{FMeynell}.
\gls{WGMeynell}.
\gls{WMeynell}.
\gls{HenrySonJohn}. \gls{HenryBlois}.
\gls{HenryBeaumont}. \gls{HenryBlund}.
\gls{HenryLittle}. \gls{HenryEssex}. \gls{HenryMowbray}.
\gls{HenryFitzRobert}.
\gls{HenryKing}. \gls{HenryScribe}.
\gls{James V}.
\gls{James I}.
\gls{James IV}.
\gls{James III}.
\gls{James II}.
\gls{JBSaint}.
\gls{StAndrews}.
\gls{StBenetsHall}.
\gls{StJamesInfirmary}.
\gls{QStJohnSmythe}.
\gls{SaintJulian}.
\gls{StJustinRoseland}.
\gls{10 Downing Street}.
\newpage
% This will take a while as the sorting algorithm is complex.
\printterms
[
heading={\section[Word Sorted Index]},% make a numbered section
database=index,% 'index' database
prelocation=dotfill,% put a dotted line before the location list
columns=3,% page layout
style=index,% use 'index' style
%balance=false,% don't balance columns
postheading={Locations in bold indicate primary reference.
(Word sort.)}
]
\end{document}
|