% \def\fileversion{2.2}\def\filedate{2001/06/13}\def\docdate{2013/11/26} %\iffalse These lines are necessary for the doc and docstrip utilities %<*asciidocu> %%# %%# Author: %%# %%# M. V\"ath martin@mvath.de %%# %%# The package may be distributed and/or modified under the conditions of %%# the LaTeX Project Public License (version 1.3c or later). %%############################################################################# %%# %%# With this package you may write shorter (or longer) underlines/underbars. %%# This is particularly useful for `underlined' variables which are needed %%# by some engineers. %%# %%############################################################################# %%# %%# This package was tested with plain TeX, LaTeX 2.09, and LaTeX 2e, %%# and it should actually run with most other TeX formats. %%# % If you have access to (reasonable new) docstrip TeXfiles, you should run % tex/latex on the file % `ushort.ins' % to produce the files `ushort.sty', `ushort.txt' and `ushort.tex'. % (In case `ushort.ins' is lost: You can find its content in the last % few lines of the file you are currently reading between the % lines %<*insfile> and %; % BTW: You should name this file here `ushort.dtx' before you run tex % on ushort.ins). % % The file `ushort.txt' contains a `brief' (but complete) ascii % documentation. If you have additionally access to LaTeX2e, you may run % latex on the generated file `ushort.tex' to produce `ushort.dvi' which % contains a more luxury documentation. % % If you do not have access to the docstrip TeXfiles you may simply % copy/rename this file here into % `ushort.sty' % to use the package and read the ascii documentation in this file. % The ascii documentation (the content of `ushort.txt') consists of all % lines in this file which start with %%# (this the above block and another % (very large) block which follows soon). % % But I do not recommended this, because TeX will need more time to read this % longer file, and because there might be a (very slight) incompatibility if % you use it (namely if you load `ushort.sty' with some *extremely* strange % catcodes). % I recommend in this case instead to generate the file `ushort.sty' as % anything between the lines %<*package> and % by hand. % (This is not precisely the file which you get with the docstrip TeXfiles, % but a reasonable good substitute. To speed up loading, you may also % eliminate all lines starting with `% ' in `ushort.sty'). % For your information: The file `ushort.tex' produced by the docstrip % TeXfiles is anything between the lines %<*driver> and % % (with a line containing \endinput and two comment lines appended). % % % In any case, you end up with the file `ushort.sty'. % % If you can generate `ushort.tex', you will probably want to stop % reading now and instead read the `luxury' documentation in `ushort.dvi'. % % Otherwise, you have to make due with the following ascii documentation. % % % \fi\catcode\#14\relax\iffalse (This line is needed for the doc utility) % %%# In the newsgroup de.comp.text.tex the question arose whether it is %%# possible to define `underlined' variables: Such variables are required for %%# complex vectors by electrical engineers. %%# The usual \underline command is not appropriate for this purpose, because %%# the underlines of concatenated variables merge which is not desired. %%# One may use the macro "\ushort" of this package instead. %%# %%# However, this package also provides a generic macro which allows to %%# create new commands which work similarly but use different parameters %%# for the underlines. In particular, it is possible to create e.g. a macro %%# which draws longer underlines than usual or which does a similar task with %%# \underbar. %%# %%# Installation: %%# %%# To use ushort, you have to put `ushort.sty' in a path where TeX looks %%# for its input files. The TeX documents using ushort need the %%# following modifications in their header: %%# %%# a) If you use LaTeX2.09, use ushort as a style option, e.g. %%# \documentstyle[ushort]{article} %%# or %%# \documentstyle[ushort,12pt]{article} %%# b) If you use LaTeX2e, put in the preamble the command %%# \usepackage{ushort} %%# c) If you use some other (non-LaTeX) format, you will probably have to %%# insert a line like %%# \catcode`\@=11\relax \input ushort.sty \catcode`\@=12\relax %%# %%# For TeX insiders: %%# The only LaTeX-specific commands used in `ushort.sty' are: %%# %%# \newcommand (only in the form \newcommand{\command}{} to ensure that %%# \command was not defined before) %%# \ProvidesPackage %%# \typeout %%# %%# The above commands are used only if they are defined. %%# %%# %%# Description of the provided macros: %%# %%# This package provides the following macros. %%# %%# \ushort %%# This command is used analogously to \underline with the difference that %%# the underlines are slightly shorter than usual (and so, in particular, %%# in concatenations of `\ushort'ed variable names the underlines do not %%# merge). The length of the underline is chosen under the assumption that %%# the argument is a single character. If you want to underline a variable %%# name which consists of more than one character, use instead the command %%# \ushortw [Mnemonic: ushort word] %%# which is analogous to \ushort but such that the length of the underline %%# is chosen appropriate for a `long' argument. (This does not look as %%# good as \ushort if the argument is a single character). %%# \ushortd [Mnemonic: ushort double] %%# This is analogous to \ushort except that the underline is doubled. %%# \ushortdw [Mnemonic: ushortd word] %%# This is analogous to \ushortw except that the underline is doubled. %%# \ushortdline %%# This is analogous to \underline except that the underline is doubled. %%# This command is internally used by \ushortd and \ushortdw and %%# thus redefinitions change also the behavior of \ushortd and \ushortdw %%# correspondingly. %%# In Plain TeX, this macro can be used only in math mode. %%# \ushortCreate %%# This can be used to generate a macro which behaves similarly to \ushort %%# or \ushortd but for which certain parameters can be changed. %%# \ushortEnsuremath %%# This is rather equivalent to the LaTeX2e macro \ensuremath %%# (but is available also e.g. in compatibility mode or if this package %%# is used with plain TeX or LaTeX 2.09). %%# %%# Only \ushortCreate needs a detailed description. Its call syntax is: %%# %%# \ushortCreate*:\command[Summand](FactorAfter) %%# +{additional calculations}{Name} %%# %%# All arguments except for the last one {Name} are optional. %%# Moreover, also the order of these arguments can be changed arbitrarily, %%# and they can be repeated (all except for the last occurrence of each %%# each type of argument is ignored). %%# Only the last argument {Name} can not be repeated and must be at the end. %%# %%# This command creates a new macro \Name. It is not tested whether \Name %%# already exists; if it exists already, it is overridden. In particular, %%# it is admissible to use \ushortCreate to redefine \ushort, \ushortw, %%# \ushortd, or \ushortdw. This is the recommended method, if you want to %%# change the default values. %%# %%# The macro \Name can be used analogously to \underline, but the precise %%# behavior depends on the arguments of \ushortCreate. %%# %%# The meaning of the arguments is as follows: %%# %%# * If the * is present, then the command \underbar is used %%# (instead of the default \underline) to draw the underline. %%# Moreover, the command \underbar is not used in math mode (while %%# \underline is used in math mode). %%# :\command Use \command instead of the default \underline to draw the %%# underline. Whether \command is executed in math mode or not %%# depends on whether * has been used. %%# [Summand] Add Summand to the length of the underline before drawing. %%# Values like -.3\ht0 are admissible. Summand is expanded only when \Name %%# is expanded, and \wd0 or \ht0 give the width respectively height of the %%# argument given to \name. In particular, also the value of the unit `em' %%# depends on the mode in which \Name is called. %%# The default is empty (which means 0pt but is faster). %%# Multiply the length of the underline before adding Summand. %%# The empty string means 1 (and costs no time). %%# The default is empty. %%# (FactorAfter) Multiply the length of the underline after adding Summand. %%# The empty string means 1 (and costs no time). %%# The default is `.8'. %%# +{Additional calculations} With this argument, you can introduce an %%# arbitrary command sequence into the generated command: This sequence %%# is executed (within a group) after Summand was added, but before %%# FactorAfter is applied. This sequence is meant to do additional %%# calculation with \dimen0 which is the length of the generated %%# underline. When the calculations are carried out, \box0 contains the %%# content which is to be underlined. However, in contrast to previous %%# releases of this package, modifications of this box are ignored. %%# Instead, the registers \dimen1 and \dimen2 also contain the height and %%# depth of this box - you have to modify these values to attain the %%# desired effect. %%# %%# Examples: %%# %%# The most important examples are the macros \ushort, \ushortw, \ushortd, %%# and \ushortdw which have been created by %%# %%# \ushortCreate{ushort} %%# \ushortCreate()[-.1em]{ushortw} %%# \ushortCreate:\ushortdline{ushortd} %%# \ushortCreate:\ushortdline()[-.1em]{ushortdw} %%# %%# A further example demonstrating other parameters is %%# %%# \ushortCreate(3)(.5){uline} %%# %%# This creates the macro \uline which underbars its argument but such that %%# the underbar has only half of the usual length (the argument (3) %%# in the above call is overridden by the later argument (.5)). %%# %%# A more useful example is %%# %%# \ushortCreate()[-.3\ht0]{ushort} %%# %%# This modifies \ushort such that the underline is shrunken by .3 times %%# the height of the argument of \ushort. If the argument is one letter, this %%# means: The higher the letter, the shorter the underline. This looks good %%# for italic fonts with some exceptions (like the letter `b'). % This is the end of the ascii documentation % %\fi\catcode\#6\relax % % \iffalse %<*metainfo> % \fi % \def\basename{ushort} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} % \CheckSum{272} % \iffalse % \RecordChanges % \fi % \def\ChangesTab{\def\mypar{\par}}\let\orichanges\changes % \def\changes#1#2#3{\orichanges{#1}{#2}{#3}\relax % \expandafter\def\expandafter\ChangesTab\expandafter{\ChangesTab % \item[v#1 {\mdseries(\emph{#2})}] {#3.}}} % \newcommand{\cmdcite}[1]{\texttt{\textbackslash#1}} % \def\mypar{} % \changes{2.2}{2013/11/26}{Update email, add license. Date/version remains the % same since only commments and documentation are modified} % \changes{2.2}{2001/06/13}{As % Alessandro Russo \texttt{} suggested, % the case of arguments consisting of more than a single character is % now documented. Corresponding macros \cmdcite{ushortw} and % \cmdcite{ushortdw} have been added} % \changes{2.1}{2001/06/07}{Improved speed dramatically (up to factor 4) % by not using \cmdcite{phantom} anymore. Unfortunately, if bad hacks had % been used for the argument ``Additional calculations'' in % \cmdcite{ushortCreate}, they could fail to work now. For this reason, % the major release number has been changed.\mypar % Further internal change: In \cmdcite{ushrt@Main} the arguments are now % expanded by a loop} % \changes{1.4}{2001/04/06}{Set defaults for the parameters as documented} % \changes{1.3}{2001/04/05}{Added the argument for additional calculations. % Changed the default values of the arguments (and thus of \cmdcite{ushort})} % \changes{1.2}{2001/04/04}{Removed a typing error in the scan macro and % added the commands \cmdcite{ushortd} and \cmdcite{ushortdline}} % \changes{1.1}{2001/04/04}{Introduced clean version of % \cmdcite{ushortEnsuremath} (and eliminated the corresponding previous hack)} % \changes{1.0}{2001/04/03}{First beta release} % % \iffalse % % The following part is the code needed to compile the documentation. % We do some trickery here, because we want that this file here could be used % for *both*: Compiling the documentation *and* as `ushort.sty' % (if really required). % Everything between the lines %<*driver> and % % goes to the file `ushort.tex'. % % \fi \ifcat @a% If this test is positive, then `@' has letter catcode which means % that this file is loaded as a style file (or as described in the % install section of the documentation). \def\TemporaryDummy{} \else\long\def\TemporaryDummy{% % % % \iffalse % %<*driver> \documentclass{ltxdoc} \OnlyDescription%% Comment this out, or %%\AlsoImplementation%% uncomment this line, if you want to see the source. %% If you want an index, uncomment one of the following lines. %% After running latex a first time, you have to use %% makeindex -s gind.ist ushort %% Then run latex again. %%\CodelineIndex% comment this out if you want an index referring to codelines %%\PageIndex% comment this out if you want an index referring to pages %%\OldMakeindex% uncomment this line, if your MakeIndex is pre-v2.9 \setlength\hfuzz{15pt} \hbadness=7000 \begin{document} \DocInput{ushort.dtx} \end{document} % %<*metainfo> % \fi } \fi\TemporaryDummy\let\TemporaryDummy\undefined % % \iffalse % Personal macros used for the doc utility: % \fi % \MakeShortVerb{"} % \def\bracemeta#1{\texttt{\{}\meta{#1}\texttt{\}}} % \def\DescMac#1{\expandafter\DescribeMacro\expandafter{\csname#1\endcsname}} % \def\iDescribe#1{\item[\mdseries\cmdcite{#1}:]\DescMac{#1}} % \def\nocomment{} % \parindent0pt % \title{The \texttt{ushort} package\thanks % {This package has version number \fileversion{}, last revised \filedate. % The package may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3c of this license or (at % your option) any later version. The latest version of this license is in % \texttt{http://www.latex-project.org/lppl.txt}, and version 1.3c or later % is part of all distributions of LaTeX version 2005/12/01 or later.}} % \author{Martin V\"ath\thanks % {\texttt{martin@mvath.de}}} % \date{\docdate} % \maketitle % \begin{abstract} % With this package you may write shorter (or longer) underlines/underbars. % This is particularly useful for `underlined' variables which are needed % by some engineers. % \end{abstract} % You may copy this package freely, as long as you distribute only unmodified % and complete versions. % \tableofcontents % \section{Changes} % % \begin{description} % \ChangesTab % \end{description} % \section{Introduction} % % In the newsgroup "de.comp.text.tex" the question arose whether it is % possible to define `underlined' variables: Such variables are required for % complex vectors by electrical engineers. % The usual "\underline" command is not appropriate for this purpose, because % the underlines of concatenated variables merge which is not desired. % One may use the macro "\ushort" of this package instead. % % However, this package also provides a generic macro which allows to % create new commands which work similarly but use different parameters % for the underlines. In particular, it is possible to create e.g.\ a macro % which draws longer underlines than usual or which does a similar task with % "\underbar". % \section{Installation} % This package was tested with plain \TeX, \LaTeX 2.09, and \LaTeXe, and it % should actually run with most other \TeX\ formats. % To use ``ushort'', you have to put the file "ushort.sty" in a path where % \TeX\ looks for its input files. The \TeX\ documents using ushort need the % following modifications in their header: % % \begin{itemize} % \item If you use \LaTeXe, put in the preamble the command % \begin{verbatim} % \usepackage{ushort}\end{verbatim} % % \item If you use \LaTeX 2.09, use "ushort" as a style option, e.g.\ % \begin{verbatim} % \documentstyle[ushort]{article}\end{verbatim} % or % \begin{verbatim} % \documentstyle[ushort,12pt]{article}\end{verbatim} % % \item If you use some other (non-\LaTeX) format, you will probably have to % insert a line like % \begin{verbatim} % \catcode`\@=11\relax \input ushort.sty \catcode`\@=12\relax\end{verbatim} % % \end{itemize} % % For \TeX\ insiders: % The only \LaTeX-specific commands used in "ushort.sty" are: % % \begin{itemize} % \item "\newcommand" (used only in the form "\newcommand{"\meta{command}"}{}" % to ensure that \meta{command} was not defined before) % \item "\ProvidesPackage" % \item "\typeout" % \end{itemize} % The above commands are used only if they are defined % (for "\typeout" a reasonable substitute is used, otherwise). % % \section{Description of the provided macros} % % This package provides the following macros. % \begin{description} % \iDescribe{ushort} % This command is used analogously to % "\underline" with the difference that the underlines are slightly shorter % than usual (and so, in particular, in concatenations of "\ushort"'ed % variable names the underlines do not merge). % The length of the underline is chosen under the assumption that % the argument is a single character. If you want to underline a variable % name which consists of more than one character, use instead the % following command "\ushortw". % \iDescribe{ushortw} (Mnemonic: ``ushort word''). % This command is analogous to "\ushort" but such that the length of the % underline is chosen appropriate for a `long' argument. (This does not % look as good as "\ushort" if the argument is a single character). % \iDescribe{ushortd} (Mnemonic: ``ushort double''). % This is analogous to "\ushort" except that the underline is doubled. % \iDescribe{ushortdw} (Mnemonic: ``ushortd word''). % This is analogous to "\ushortd" except that the underline is doubled. % \iDescribe{ushortdline} % This is analogous to "\underline" except that the underline is doubled. % This command is internally used by "\ushortd" and "\ushortdw", % and thus redefinitions change also the behavior of "\ushortd" and % "\ushortdw" correspondingly. % In Plain \TeX, this macro can be used only in math mode. % \iDescribe{ushortCreate} % This can be used to generate a macro which behaves similarly to "\ushort" % or "\ushortd" but for which certain parameters can be changed. % For a detailed description, see below. % \iDescribe{ushortEnsuremath} % This is rather equivalent to the \LaTeXe\ macro "\ensuremath" % (but is available also e.g.\ in compatibility mode or if this package % is used with plain \TeX\ or \LaTeX 2.09). % \end{description} % % Only "\ushortCreate" needs a detailed description. Its call syntax is: % \begin{quote} %"\ushortCreate*:\"\meta{command}"["\meta{summand}"]<"\meta{factor before}">"\\ %" "\relax %"("\meta{factor after}")+"\bracemeta{additional calculations}\bracemeta{name} % \end{quote} % % All arguments except for the last one \bracemeta{name} are optional. % Moreover, also the order of these arguments can be changed arbitrarily, % and they can be repeated (all except for the last occurrence of each % each type of argument is ignored). % Only the last argument \bracemeta{name} can not be repeated and must be at % the end. % % This command creates a new macro \textbackslash\meta{name}. % It is not tested whether \textbackslash\meta{name} already exists; % if it exists already, it is overridden. In particular, % it is admissible to use "\ushortCreate" to redefine "\ushort", "\ushortw", % "\ushortd", or "\ushortdw". This is the recommended method, if you want to % change the default values. % % The macro \textbackslash\meta{name} can be used analogously to "\underline", % but the precise behavior depends on the arguments of "\ushortCreate". % % The meaning of the arguments is as follows: % % \begin{description} % \item[\mdseries\texttt*] % If the "*" is present, then the command "\underbar" is used % (instead of the default "\underline") to draw the underline. % Moreover, the command "\underbar" is not used in math mode (while % "\underline" is used in math mode). % \item[\mdseries\texttt:\textbackslash\meta{command}] % Use \textbackslash\meta{command} instead of the default "\underline" to % draw the underline. Whether \textbackslash\meta{command} is executed in % math mode or not depends on whether "*" has been used. % \item[\mdseries\texttt{[}\meta{summand}\texttt{]}] % Add \meta{summand} to the length of the underline before drawing. % Values like "-.3\ht0" are admissible. % \meta{summand} is expanded only when \textbackslash\meta{name} is % expanded, and "\wd0" or "\ht0" give the width respectively height of the % argument given to "\name". In particular, also the value of the unit "em" % depends on the mode in which \textbackslash\meta{name} is called. % The default is empty (which means "0pt" but is faster). % \item[\mdseries\texttt{<}\meta{factor before}\texttt{>}] % Multiply the length of the underline before adding \meta{summand}. % The empty string means $1$ (and costs no time). % The default is empty. % \item[\mdseries\texttt{(}\meta{factor after}\texttt{)}] % Multiply the length of the underline after adding \meta{summand}. % The empty string means $1$ (and costs no time). % The default is "0.8". % \item[\mdseries\texttt+\bracemeta{Additional calculations}] % With this argument, you can introduce an arbitrary command sequence into % the generated command: This sequence is executed (within a group) after % \meta{summand} was added, but before \meta{factor after} is applied. % This sequence is meant to do additional calculation with "\dimen0" which % is the length of the generated underline. % When the calculations are carried out, "\box0" contains the % content which is to be underlined. However, in contrast to previous % releases of this package, modifications of this box are ignored. % Instead, the registers "\dimen1" and "\dimen2" also contain the height % and depth of this box -- you have to modify these values to attain the % desired effect. % \end{description} % % Examples: % The most important examples are the macros "\ushort", "\ushortw", % "\ushortd", and "\ushortdw" which have been created by % \begin{verbatim} % \ushortCreate{ushort} % \ushortCreate()[-.1em]{ushortw} % \ushortCreate:\ushortdline{ushortd} % \ushortCreate:\ushortdline()[-.1em]{ushortdw}\end{verbatim} % A further example demonstrating other parameters is % \begin{verbatim} % \ushortCreate*(3)(.5){uline}\end{verbatim} % This creates the macro "\uline" which underbars its argument but such that % the underbar has only half of the usual length (the argument "(3)" in % the above call is overridden by the later argument "(.5)").\par % A more useful example is % \begin{verbatim} % \ushortCreate()[-.3\ht0]{ushort}\end{verbatim} % This modifies "\ushort" such that the underline is shrunken by $.3$ times % the height of the argument of "\ushort". If the argument is one letter, this % means: The higher the letter, the shorter the underline. This looks good % for italic fonts with some exceptions (like the letter "b"). % \iffalse % % \fi % \iffalse--------------------------------------------------------------\fi % \StopEventually{\PrintChanges} % \section{Implementation} % % \iffalse-------------------------------------------------------------- % % %<*package> % \fi % \begin{macrocode} %% %% This file was generated by the docstrip utility from ushort.dtx. %% You may distribute this file only together with the source ushort.dtx %% (and if possible with ushort.ins) and only if these files are unmodified. %% %% Author: %% %% M. V\"ath martin@mvath.de %% \ifx\typeout\undefined \def\ushrt@tmp{\immediate\write17} \else \let\ushrt@tmp\typeout \fi \ushrt@tmp{ushort.sty by M. Vaeth: Release: 2.2 } %% First, some LaTeX support: \ifx\ProvidesPackage\undefined\else \ProvidesPackage{ushort}[2001/06/13 v2.2] \fi \ifx\newcommand\undefined\else \newcommand{\ushort}{} \newcommand{\ushortw}{} \newcommand{\ushortd}{} \newcommand{\ushortdw}{} \newcommand{\ushortdline}{} \newcommand{\ushortCreate}{} \newcommand{\ushortEnsuremath}{} \fi %% The implementation follows % \end{macrocode} % % \begin{macro}{\ushortCreate} % We first scan the parameters into various macros. Then we call "\ushrt@Main". % \begin{macrocode} \def\ushortCreate{\let\ushrt@calc\ushrt@empty\let\ushrt@TextMode\undefined \def\ushrt@FactorAfter{0.8}\let\ushrt@FactorBefore\ushrt@calc \let\ushrt@Summand\ushrt@empty\def\ushrt@cmd{\underline}\ushrt@TestLoop} \def\ushrt@TestLoop{\ushrt@TestAndExec*\ushrt@Star\ushrt@TestCommand} \def\ushrt@Star*{\def\ushrt@cmd{\underbar}\let\ushrt@TextMode\ushrt@empty \ushrt@TestLoop} \def\ushrt@TestCommand{\ushrt@TestAndExec:\ushrt@GetCommand\ushrt@TestCalc} \def\ushrt@GetCommand:#1{\def\ushrt@cmd{#1}\ushrt@TestLoop} \def\ushrt@TestCalc{\ushrt@TestAndExec+\ushrt@GetCalc\ushrt@TestSummand} \def\ushrt@GetCalc+#1{\def\ushrt@calc{#1}\ushrt@TestLoop} \def\ushrt@TestSummand{\ushrt@TestAndExec[%] \ushrt@GetSummand\ushrt@TestFactorBefore} \def\ushrt@GetSummand[#1]{\def\ushrt@Summand{\advance\dimen0 by#1}% \ushrt@TestLoop} \def\ushrt@TestFactorBefore{\ushrt@TestAndExec<%> \ushrt@GetFactorBefore\ushrt@TestFactorAfter} \def\ushrt@GetFactorBefore<#1>{\def\ushrt@FactorBefore{#1}\ushrt@TestLoop} \def\ushrt@TestFactorAfter{\ushrt@TestAndExec(%) \ushrt@GetFactorAfter\ushrt@Main} \def\ushrt@GetFactorAfter(#1){\def\ushrt@FactorAfter{#1}\ushrt@TestLoop} % \end{macrocode} % % \begin{macro}{\ushrt@TestAndExec} % "\ushrt@TestAndExec" is a submacro needed to scan the parameters. % \begin{macrocode} \def\ushrt@TestAndExec#1#2#3{% \ushrt@SkipAndExec{% \ifx\ushrt@NextToken#1% \def\ushrt@exec{#2}% \else \def\ushrt@exec{#3}% \fi \ushrt@exec}} \def\ushrt@SkipAndExec#1{\def\ushrt@tmp{#1}\ushrt@skip} \def\ushrt@skip{\futurelet\ushrt@NextToken\ushrt@tmp} % \end{macrocode} % \end{macro} % \begin{macro}{\ushrt@Main} % "\ushrt@Main" calls "\ushrt@Define" with appropriately expanded parameters. % \begin{macrocode} \def\ushrt@Main#1{\def\ushrt@exec{\ushrt@Define}\ushrt@ExpandLoop \ushrt@cmd\ushrt@calc\ushrt@Summand\ushrt@FactorBefore\ushrt@FactorAfter {\csname#1\endcsname}{\csname ushrt@#1\endcsname}{}} % \end{macrocode} % \begin{macro}{\ushrt@ExpandLoop} % "\ushrt@ExpandLoop" expands successively the first token in each argument % by precisely one level (until the empty argument is reached which marks % the end of the argument list). % The expanded arguments are put into "{...}" and added to the end of the % content of "\ushrt@exec". % When all arguments have been parsed, "\ushrt@exec" is executed. % \begin{macrocode} \def\ushrt@ExpandLoop#1{\def\ushrt@tmp{#1}% \ifx\ushrt@tmp\ushrt@empty \let\ushrt@tmp\ushrt@exec \else \let\ushrt@tmp\ushrt@ExpandLoop \expandafter\ushrt@Expand\expandafter{#1}% \fi\ushrt@tmp} \def\ushrt@Expand#1{\expandafter \def\expandafter\ushrt@exec\expandafter{\ushrt@exec{#1}}} % \end{macrocode} % \end{macro} % \end{macro} % \begin{macro}{\ushrt@Define} % All arguments of "\ushrt@Define" must be expanded. The call syntax is: % \begin{quote} %"\ushrt@Define"\relax %\bracemeta{underline command}\bracemeta{calculations}\bracemeta{summand}\\ %" "\relax %\bracemeta{factor before}\bracemeta{factor after}"{\"\meta{name}"}"\relax %"{\ushrt@"\meta{name}"}" % \end{quote} % Actually, \meta{summand} is not only the pure summand but the token sequence % "\advance\dimen0 by"\meta{value}; \meta{summand} may also be empty. % \begin{macrocode} \def\ushrt@Define#1#2#3#4#5#6#7{% \def#6##1{\ushortEnsuremath{\mathpalette#7{##1}##1}}% \ifx\ushrt@TextMode\undefined \def#7##1##2{\hbox to 0pt{{\mathsurround0pt$#1{% {\setbox0\hbox{\mathsurround0pt$##1##2$}% \dimen0=#4\wd0#3\dimen1\ht0\dimen2\dp0#2% \setbox0\hbox to#5\dimen0{}\ht0\dimen1\dp0\dimen2% \box0}}$\hss}}}% \else \def#7##1##2{\hbox to 0pt{#1{% {\setbox0\hbox{\mathsurround0pt$##1##2$}% \dimen0=#4\wd0#3\dimen1\ht0\dimen2\dp0#2% \setbox0\hbox to#5\dimen0{}\ht0\dimen1\dp0\dimen2% \box0}}\hss}}% \fi} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\ushortEnsuremath} % Since "\ensuremath" does not work due to \LaTeXe's irritating test for % compatibility mode (and in order to use this package also for plain \TeX\ % and \LaTeX 2.09), we must write our own "\ensuremath" command. The command % "\relax" in the beginning is necessary, because otherwise our command would % not work if it is the first command in e.g.\ an "{eqnarray}" environment. % \begin{macrocode} \def\ushortEnsuremath{\relax \ifmmode \let\ushrt@exec\ushrt@NoSwitch \else \let\ushrt@exec\ushrt@Switch \fi\ushrt@exec} \def\ushrt@NoSwitch#1{#1} \def\ushrt@Switch#1{\relax$#1\relax$\relax} % \end{macrocode} % \end{macro} % % \begin{macro}{\ushrt@empty} % We do not want to rely on the fact that "\empty" is defined as "{}", so % we use our own definition. % \begin{macrocode} \def\ushrt@empty{} % \end{macrocode} % \end{macro} % \begin{macro}{\ushort} % "\ushort" is nothing else but an instance created by "\ushortCreate" % with the default values. % \begin{macrocode} \ushortCreate{ushort} % \end{macrocode} % \end{macro} % \begin{macro}{\ushortw} % "\ushortw" is nothing else but an instance created by "\ushortCreate" % where the default values are changed by omitting \meta{factor after} and % by setting another value for \meta{summand}: % \begin{macrocode} \ushortCreate()[-.1em]{ushortw} % \end{macrocode} % \end{macro} % \begin{macro}{\ushortd} % "\ushortd" is nothing else but an instance created by "\ushortCreate" % with the default values but the \textbackslash\meta{command} value % "\ushortdline": % \begin{macrocode} \ushortCreate:\ushortdline{ushortd} % \end{macrocode} % \end{macro} % \begin{macro}{\ushortdw} % "\ushortdw" is nothing else but an instance created by "\ushortCreate" % where the default values are modified as in "\ushortw" and "\ushortd": % \begin{macrocode} \ushortCreate:\ushortdline()[-.1em]{ushortdw} % \end{macrocode} % \end{macro} % \begin{macro}{\ushortdline} % "\ushortdline" in turn is very simple to implement: % \begin{macrocode} \def\ushortdline#1{\underline{\underline #1}} % \end{macrocode} % \end{macro} % % % \iffalse % % \fi % \Finale\PrintIndex % % % % \iffalse %<*metainfo> % \fi \iffalse ------------------------------------------------------------- % % Just in case that for some reason the file `ushort.ins' got lost: % The content of this file is between the lines %<*insfile> and %. % %\iffalse % %<*insfile> \def\batchfile{ushort.ins} \input docstrip.tex \keepsilent \nopreamble \generateFile{ushort.sty}{f}{\from{ushort.dtx}{package}} \generateFile{ushort.txt}{f}{\from{ushort.dtx}{asciidocu}} \generateFile{ushort.tex}{f}{\from{ushort.dtx}{driver}} %%\generateFile{ushort.ins.dup}{f}{\from{ushort.dtx}{insfile}} \Msg{***************************************************************} \Msg{*} \Msg{* To finish the installation you have to move the} \Msg{* file 'ushort.sty' into a directory searched by TeX.} \Msg{*} \Msg{*} \Msg{* Run the file ushort.tex through LaTeX to produce the} \Msg{* documentation or read the ascii documentation in ushort.txt} \Msg{*} \Msg{*} \Msg{***************************************************************} \endbatchfile % %<*metainfo> % \fi \fi % \iffalse % % \fi \endinput %%% Local Variables: %%% mode: latex %%% TeX-master: "ushort.tex" %%% End: