Menu
CTAN
Comprehensive TeX Archive Network
Cover Upload Browse Search

Direc­tory tex-archive/macros/latex/contrib/refenums

refenums - Ref­er­ence­ableEnumEle­ments

De­fine named items and pro­vide back-ref­er­ences with that name

This pack­age pro­vides com­mands to de­fine enu­mer­able items with a num­ber and a long name, which can be ref­er­enced ref­er­enced later with the name or just the short form. For in­stance, "Mile­stone M1: Spec­i­fi­ca­tion cre­ated" can be de­fined and later on be ref­er­enced with M1 or M1 ("Specification created"). The text in the ref­er­ences is de­rived from the def­i­ni­tion and also ren­dered as hy­per­link to the def­i­ni­tion. Thus, a change of the def­i­ni­tion also leads to a change of all ref­er­ences to the text. This en­sures con­sis­tency in the text.

Usage

\usepackage{refenums}

Load the pack­age af­ter all pack­ages (hy­per­ref, clev­eref, ...). For best re­sults, use the nameinlink op­tion at clev­eref. The op­tion capitalise is also use­ful if you use clev­eref's \cref com­mand, there­fore we rec­om­mend load­ing cleveref be­fore refenums with foll­wing line: \usepackage[capitalise,nameinlink]{cleveref}

De­fine the "Ref­er­ence­able Enum En­vi­ron­ment"

De­cide for <EnumId>. E.g., req.

Ini­tial­ize

\setupRefEnums{<EnumId>}{<PrintName>}

In case <PrintName> is set to ONLYSHORT, only the short name is used.

Op­tional pa­ram­e­ter: Separa­tor be­tween <EnumId> and num­ber.

(Op­tional) De­fine short­hand macro to de­fine the macros for ref­er­enc­ing

\newcommand{\def<EnumId>}[2]{\defRefEnum{<EnumId>}{#1}{#2}}

Usage in the text

De­fine a sin­gle enum

  • \defRefEnum{<EnumId>}{<FullName>}{<LabelId>} (al­ways sup­ported)
  • \def<EnumId>{<FullName>}{<LabelId>} (when the short­hand com­mand is de­fined)

De­fine a sin­gle enum us­ing the in­line for­mat

\defineReferenceableEnumElementInline{<EnumId>}{<FullName>}{<LabelId>}. Us­ing this, a enu­mer­a­tion sim­i­lar to the ones of the inparaenum en­vi­ron­ment is pos­si­ble. inparaenum is of­fered by the par­al­ist pack­age.

Ref­er­enc­ing

  • \refEnumFull{<EnumId>}{<LabelId>} = <EnumId>-<Counter> ("<FullName>"), e.g. R-1 ("Quality")
  • \refEnumFullP{<EnumId>}{<LabelId>} is the long form for \refEnumFull'.
  • \refEnumFullT{<EnumId>}{<LabelId>} = <EnumId>-<Counter>: "<FullName>", e.g. R-1: "Quality"
  • \refEnum{<EnumId>}{<LabelId>} = <EnumId>-<Counter>, e.g. R-1
  • Ref­er­ences to the la­bel
    • \nameref{enum:<EnumId>:<LabelId>} = <FullName>
    • \ref{enum:<EnumId>:<LabelId>} = <Counter>, e.g. 1

Ex­am­ple

Ini­tial­ize: \setupRefEnums{R}{Requirement}

De­fine a sin­gle enum: \defRefEnum{R}{Quality}{qual}. When you want to put the el­e­ment in a sec­tion, use the op­tional pa­ram­e­ter: \defRefEnum[section]{R}{Quality}{qual}

Ref­er­enc­ing:

  • Ref­er­ence only Name + Num­ber: \refEnum{R}{qual}
  • Full ref­er­ence with the print name in brack­ets: \refEnumFull{R}{qual}
  • Full ref­er­ence with the print name ap­pended af­ter ":": \refEnumFullT{R}{qual}

See also demo.tex.

Tun­ing

When defin­ing a ref­er­ence­able el­e­ment, this el­e­ment is en­closed us­ing \refenumenclosing for nor­mal enums and \refenumenclosinginline for in­line enums. Th­ese com­mands can be re­de­fined af­ter pack­age us­age.

TODO

  • The de­ci­sion to put the enum in a sec­tion should be taken at \setupRefEnums not at \defRefEnum.
  • En­able au­to­mat­i­cally gen­er­at­ing \def<EnumId> at \setupRefEnums via a pack­age pa­ram­e­ter.

Source code

The lat­est source code is avail­able at https://github.com/kop­por/refenums

Files

Direc­to­ries

Name Notes
test

Files

Name Size Date Notes
LICENSE 713 2014-01-03 17:55
3566 2014-01-03 17:55 ==> /macros/la­tex/con­trib/refenums/README.md
README.md 3566 2014-01-03 17:55
demo.pdf 82477 2014-01-03 17:57
demo.tex 3165 2014-01-03 17:55
refenums.sty 4798 2014-01-03 17:55

Down­load the con­tents of this pack­age in one zip archive (75.0k).

refenums – De­fine ref­er­ence la­bels items with names of their own

The pack­age pro­vides com­mands to de­fine enu­mer­able items with a num­ber and a long name, which can be ref­er­enced ref­er­enced later with the name or just the short form. For in­stance, “Mile­stone M1: Spec­i­fi­ca­tion cre­ated” can be de­fined and later on be ref­er­enced with ‘M1’ or ‘M1 (“Spec­i­fi­ca­tion cre­ated”)’. The text in the ref­er­ences is de­rived from the def­i­ni­tion and also ren­dered as hy­per­link to the def­i­ni­tion.

Pack­age De­tailsrefenums
Home pagehttps://github.com/kop­por/refenums
Ver­sion1.1.1 2014-01-03
Li­censeThe LaTeX Project Public Li­cense 1.3
Copy­right2013 Oliver Kopp, To­bias Binz
Main­tainerOliver Kopp
Con­tained inTeXlive as refenums
MikTeX as refenums
Topics la­bel and ref­er­ence sys­tems
Guest Book Sitemap Contact