3.3 Texto generado o con formato especial

One of the features of LaTEX is that it can automatically generate text based on the current context. We have already seen examples of this in Chapter 2 in the form of references that adjust their text based on the distance between label and reference.

In this section two other useful applications are discussed. The fmtcount package offers ways to produce ordinal and cardinal strings from counter values so that you can refer to the “third chapter” without worrying that it may become the “fourth chapter” later. The other package (acro) helps you manage acronyms and offers sophisticated ways to typeset them based on your needs and their position in the text.

We finish the section with a small package that produces fractions such as 1⁄2, 2⁄3, or 3⁄4 for use in running text.

3.3.1 fmtcount - Ordinales y cardenales

When typesetting the value of counters, LaTEX offers a number of commands, such as , to generate “III”; see Appendix A.2.1. Sometimes there is a need to provide a textual representation of the counter value or to write “in the 3rd chapter”, and for this you can use the fmtcount package by Nicola Talbot and Vincent Belaïche. The package provides various commands to format counter values and can generate correct ordinals for different languages.

3.3.2 acro - Gestionar sus abreviaturas y acrónimos

Documents often contain acronyms and abbreviations such as “CTAN” or “etc.”. If they are infrequent, one can easily typeset them manually, e.g., as , or provide simple commands for them.

However, if there are many and there is a need to introduce the acronyms on first use, e.g., writing “Comprehensive TEX Archive Network (CTAN)” and only later just “CTAN”, then this gets problematical. Every change of the text might move the first use to a different place and thus require reworking of the text. Furthermore, if you want to generate an annotated list of all acronyms in an appendix, there is a good chance that this compilation of terms may not fit reality if it was done manually and not automatically generated from the acronyms used in the text.

To help you with such tasks Clemens Niederberger developed the very comprehensive acro package with which you can easily manage your acronyms and customize their appearance. To declare such acronyms and abbreviations you use the command.

3.3.3 xfrac - Fracciones de texto personalizables

In formulas, fractions are usually typeset with the command that sets the numerator on top of the denominator separated by a horizontal like this: 1 2. While this layout is sensible in mathematics, because it helps to unambiguously identify the components, it does not work very well in text. The fraction is typically too large to fit nicely into the text line, and furthermore the digits used come from the math fonts that may or may not match the current text font. For this reason it is quite customary to set fractions used in text (for example in recipes) like this: 1⁄2. Here a solidus symbol is used as a separator and the figures in the numerator and denominator come from the current text font in a slightly smaller size. This type of layout is provided with the xfrac package by Morten Høgholm.

3.3.4 siunitx - Notación científica de unidades y cantidades.

The International System of Units (SI, abbreviated from the French Système international (d’unités)) is a codified form of the metric system and one of the most widely used system of measurement, officially endorsed by more than 50 nations [27]. It is built on seven base units that can be derived from invariant constants of nature and measured with high precision (ampere, kelvin, second, metre, kilogram,1 candela, mole) and a set of decimal prefixes to the unit names and unit symbols to specify multiples or fractions of the units. The system further defines the names for derived units of other common physical quantities like becquerel, lumen, volt, etc. The standard also offers advice on many units that are not adopted into the system, but are in common use in many places. Typographic conventions for all such units are defined, and consistently following them helps to ensure that there are no misunderstandings when presenting numbers and units in printed matter.

The siunitx package by Joseph Wright aims at providing access to this standard and ways for LaTEX users to typeset numbers and units correctly and consistently. By default the package follows agreed conventions but at the same time offers a huge number of keys to configure the results to fit the requirements posed by journals or universities without the need to alter the document source.

The most important of such configuration possibilities are covered in this section, but if you find that a particular requirement is not discussed, there is a high likelihood that you can find it in the extensive package documentation [201]. The package preloads amstext, array, and color; if you prefer xcolor, you can load that on top.