| 1 |
|
| 2 |
%%# |
| 3 |
%%# Author: |
| 4 |
%%# |
| 5 |
%%# M. V\"ath [email protected] |
| 6 |
%%# |
| 7 |
%%# The package may be distributed and/or modified under the conditions of |
| 8 |
%%# the LaTeX Project Public License (version 1.3c or later). |
| 9 |
|
| 10 |
%%############################################################################# |
| 11 |
%%# |
| 12 |
%%# With this package you may write shorter (or longer) underlines/underbars. |
| 13 |
%%# This is particularly useful for `underlined' variables which are needed |
| 14 |
%%# by some engineers. |
| 15 |
%%# |
| 16 |
%%############################################################################# |
| 17 |
|
| 18 |
%%# |
| 19 |
%%# This package was tested with plain TeX, LaTeX 2.09, and LaTeX 2e, |
| 20 |
%%# and it should actually run with most other TeX formats. |
| 21 |
%%# |
| 22 |
|
| 23 |
|
| 24 |
%%# In the newsgroup de.comp.text.tex the question arose whether it is |
| 25 |
%%# possible to define `underlined' variables: Such variables are required for |
| 26 |
%%# complex vectors by electrical engineers. |
| 27 |
%%# The usual \underline command is not appropriate for this purpose, because |
| 28 |
%%# the underlines of concatenated variables merge which is not desired. |
| 29 |
%%# One may use the macro "\ushort" of this package instead. |
| 30 |
%%# |
| 31 |
%%# However, this package also provides a generic macro which allows to |
| 32 |
%%# create new commands which work similarly but use different parameters |
| 33 |
%%# for the underlines. In particular, it is possible to create e.g. a macro |
| 34 |
%%# which draws longer underlines than usual or which does a similar task with |
| 35 |
%%# \underbar. |
| 36 |
|
| 37 |
%%# |
| 38 |
%%# Installation: |
| 39 |
%%# |
| 40 |
|
| 41 |
%%# To use ushort, you have to put `ushort.sty' in a path where TeX looks |
| 42 |
%%# for its input files. The TeX documents using ushort need the |
| 43 |
%%# following modifications in their header: |
| 44 |
%%# |
| 45 |
%%# a) If you use LaTeX2.09, use ushort as a style option, e.g. |
| 46 |
%%# \documentstyle[ushort]{article} |
| 47 |
%%# or |
| 48 |
%%# \documentstyle[ushort,12pt]{article} |
| 49 |
%%# b) If you use LaTeX2e, put in the preamble the command |
| 50 |
%%# \usepackage{ushort} |
| 51 |
%%# c) If you use some other (non-LaTeX) format, you will probably have to |
| 52 |
%%# insert a line like |
| 53 |
%%# \catcode`\@=11\relax \input ushort.sty \catcode`\@=12\relax |
| 54 |
%%# |
| 55 |
%%# For TeX insiders: |
| 56 |
%%# The only LaTeX-specific commands used in `ushort.sty' are: |
| 57 |
%%# |
| 58 |
%%# \newcommand (only in the form \newcommand{\command}{} to ensure that |
| 59 |
%%# \command was not defined before) |
| 60 |
%%# \ProvidesPackage |
| 61 |
%%# \typeout |
| 62 |
%%# |
| 63 |
%%# The above commands are used only if they are defined. |
| 64 |
%%# |
| 65 |
|
| 66 |
%%# |
| 67 |
%%# Description of the provided macros: |
| 68 |
%%# |
| 69 |
|
| 70 |
%%# This package provides the following macros. |
| 71 |
%%# |
| 72 |
%%# \ushort |
| 73 |
%%# This command is used analogously to \underline with the difference that |
| 74 |
%%# the underlines are slightly shorter than usual (and so, in particular, |
| 75 |
%%# in concatenations of `\ushort'ed variable names the underlines do not |
| 76 |
%%# merge). The length of the underline is chosen under the assumption that |
| 77 |
%%# the argument is a single character. If you want to underline a variable |
| 78 |
%%# name which consists of more than one character, use instead the command |
| 79 |
%%# \ushortw [Mnemonic: ushort word] |
| 80 |
%%# which is analogous to \ushort but such that the length of the underline |
| 81 |
%%# is chosen appropriate for a `long' argument. (This does not look as |
| 82 |
%%# good as \ushort if the argument is a single character). |
| 83 |
%%# \ushortd [Mnemonic: ushort double] |
| 84 |
%%# This is analogous to \ushort except that the underline is doubled. |
| 85 |
%%# \ushortdw [Mnemonic: ushortd word] |
| 86 |
%%# This is analogous to \ushortw except that the underline is doubled. |
| 87 |
%%# \ushortdline |
| 88 |
%%# This is analogous to \underline except that the underline is doubled. |
| 89 |
%%# This command is internally used by \ushortd and \ushortdw and |
| 90 |
%%# thus redefinitions change also the behavior of \ushortd and \ushortdw |
| 91 |
%%# correspondingly. |
| 92 |
%%# In Plain TeX, this macro can be used only in math mode. |
| 93 |
%%# \ushortCreate |
| 94 |
%%# This can be used to generate a macro which behaves similarly to \ushort |
| 95 |
%%# or \ushortd but for which certain parameters can be changed. |
| 96 |
%%# \ushortEnsuremath |
| 97 |
%%# This is rather equivalent to the LaTeX2e macro \ensuremath |
| 98 |
%%# (but is available also e.g. in compatibility mode or if this package |
| 99 |
%%# is used with plain TeX or LaTeX 2.09). |
| 100 |
%%# |
| 101 |
%%# Only \ushortCreate needs a detailed description. Its call syntax is: |
| 102 |
%%# |
| 103 |
%%# \ushortCreate*:\command[Summand]<FactorBefore>(FactorAfter) |
| 104 |
%%# +{additional calculations}{Name} |
| 105 |
%%# |
| 106 |
%%# All arguments except for the last one {Name} are optional. |
| 107 |
%%# Moreover, also the order of these arguments can be changed arbitrarily, |
| 108 |
%%# and they can be repeated (all except for the last occurrence of each |
| 109 |
%%# each type of argument is ignored). |
| 110 |
%%# Only the last argument {Name} can not be repeated and must be at the end. |
| 111 |
%%# |
| 112 |
%%# This command creates a new macro \Name. It is not tested whether \Name |
| 113 |
%%# already exists; if it exists already, it is overridden. In particular, |
| 114 |
%%# it is admissible to use \ushortCreate to redefine \ushort, \ushortw, |
| 115 |
%%# \ushortd, or \ushortdw. This is the recommended method, if you want to |
| 116 |
%%# change the default values. |
| 117 |
%%# |
| 118 |
%%# The macro \Name can be used analogously to \underline, but the precise |
| 119 |
%%# behavior depends on the arguments of \ushortCreate. |
| 120 |
%%# |
| 121 |
%%# The meaning of the arguments is as follows: |
| 122 |
%%# |
| 123 |
%%# * If the * is present, then the command \underbar is used |
| 124 |
%%# (instead of the default \underline) to draw the underline. |
| 125 |
%%# Moreover, the command \underbar is not used in math mode (while |
| 126 |
%%# \underline is used in math mode). |
| 127 |
%%# :\command Use \command instead of the default \underline to draw the |
| 128 |
%%# underline. Whether \command is executed in math mode or not |
| 129 |
%%# depends on whether * has been used. |
| 130 |
%%# [Summand] Add Summand to the length of the underline before drawing. |
| 131 |
%%# Values like -.3\ht0 are admissible. Summand is expanded only when \Name |
| 132 |
%%# is expanded, and \wd0 or \ht0 give the width respectively height of the |
| 133 |
%%# argument given to \name. In particular, also the value of the unit `em' |
| 134 |
%%# depends on the mode in which \Name is called. |
| 135 |
%%# The default is empty (which means 0pt but is faster). |
| 136 |
%%# <FactorBefore> Multiply the length of the underline before adding Summand. |
| 137 |
%%# The empty string means 1 (and costs no time). |
| 138 |
%%# The default is empty. |
| 139 |
%%# (FactorAfter) Multiply the length of the underline after adding Summand. |
| 140 |
%%# The empty string means 1 (and costs no time). |
| 141 |
%%# The default is `.8'. |
| 142 |
%%# +{Additional calculations} With this argument, you can introduce an |
| 143 |
%%# arbitrary command sequence into the generated command: This sequence |
| 144 |
%%# is executed (within a group) after Summand was added, but before |
| 145 |
%%# FactorAfter is applied. This sequence is meant to do additional |
| 146 |
%%# calculation with \dimen0 which is the length of the generated |
| 147 |
%%# underline. When the calculations are carried out, \box0 contains the |
| 148 |
%%# content which is to be underlined. However, in contrast to previous |
| 149 |
%%# releases of this package, modifications of this box are ignored. |
| 150 |
%%# Instead, the registers \dimen1 and \dimen2 also contain the height and |
| 151 |
%%# depth of this box - you have to modify these values to attain the |
| 152 |
%%# desired effect. |
| 153 |
%%# |
| 154 |
%%# Examples: |
| 155 |
%%# |
| 156 |
%%# The most important examples are the macros \ushort, \ushortw, \ushortd, |
| 157 |
%%# and \ushortdw which have been created by |
| 158 |
%%# |
| 159 |
%%# \ushortCreate{ushort} |
| 160 |
%%# \ushortCreate()[-.1em]{ushortw} |
| 161 |
%%# \ushortCreate:\ushortdline{ushortd} |
| 162 |
%%# \ushortCreate:\ushortdline()[-.1em]{ushortdw} |
| 163 |
%%# |
| 164 |
%%# A further example demonstrating other parameters is |
| 165 |
%%# |
| 166 |
%%# \ushortCreate(3)(.5){uline} |
| 167 |
%%# |
| 168 |
%%# This creates the macro \uline which underbars its argument but such that |
| 169 |
%%# the underbar has only half of the usual length (the argument (3) |
| 170 |
%%# in the above call is overridden by the later argument (.5)). |
| 171 |
%%# |
| 172 |
%%# A more useful example is |
| 173 |
%%# |
| 174 |
%%# \ushortCreate()[-.3\ht0]{ushort} |
| 175 |
%%# |
| 176 |
%%# This modifies \ushort such that the underline is shrunken by .3 times |
| 177 |
%%# the height of the argument of \ushort. If the argument is one letter, this |
| 178 |
%%# means: The higher the letter, the shorter the underline. This looks good |
| 179 |
%%# for italic fonts with some exceptions (like the letter `b'). |
| 180 |
|
| 181 |
\endinput |
| 182 |
%% |
| 183 |
%% End of file `ushort.txt'. |