diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:57:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:57:21 +0000 |
commit | 5ab48c515e7f18de489791d28188b43a389fe4c8 (patch) | |
tree | d11d232a328cd0436ccd36c402481be300e6d1e1 /Master/texmf-dist/tex/latex/jknapltx/smartmn.sty | |
parent | 350ddf44c5a7b4a3fd69591394cd828cd6518eb3 (diff) |
jknapltx
git-svn-id: svn://tug.org/texlive/trunk@1006 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/jknapltx/smartmn.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/jknapltx/smartmn.sty | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/jknapltx/smartmn.sty b/Master/texmf-dist/tex/latex/jknapltx/smartmn.sty new file mode 100644 index 00000000000..393becb607f --- /dev/null +++ b/Master/texmf-dist/tex/latex/jknapltx/smartmn.sty @@ -0,0 +1,68 @@ +% smartmn.sty +% +% (c) 1996--1999 Copyleft J"org Knappen +% Licence: GNU public licence version 2 + +\NeedsTeXFormat{LaTeX2e}[1994/12/01] % \DeclareRobustCommand +\ProvidesPackage{smartmn}[1999/06/01 v 1.1b Intelligent hyphen/minus (jk)] + +\newcommand*\oriminus{-} +\providecommand\emdash{---} +\def\aft@rfi#1\fi{\fi#1} +\chardef\m@nuscode=\catcode"2D % +\catcode"2D=\active +\def\sm@rtm@nus{\ifmmode\oriminus\else\aft@rfi\sm@rtm@n@s\fi } +\def\sm@rtm@n@s{\futurelet\sm@rtminus@next\sm@rtminus} +\def\sm@rtminus#1{% + \expandafter\ifx \space\sm@rtminus@next\oriminus\space#1% + \else\ifx \ #1\oriminus\space + \else\ifx -#1\oriminus\oriminus + \else\ifx 0#1\textminus0% + \else\ifx 1#1\textminus1% + \else\ifx 2#1\textminus2% + \else\ifx 3#1\textminus3% + \else\ifx 4#1\textminus4% + \else\ifx 5#1\textminus5% + \else\ifx 6#1\textminus6% + \else\ifx 7#1\textminus7% + \else\ifx 8#1\textminus8% + \else\ifx 9#1\textminus9% + \else \oriminus#1% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +\DeclareRobustCommand\p@m@nus{\sm@rtm@nus} +\let-\p@m@nus + +\catcode"2D=\m@nuscode % Unactivate the hyphen/minus till \begin{document} + +\providecommand{\textminus}{\ensuremath{\oriminus}} + + +\AtBeginDocument{\catcode"2D=\active} + +\endinput + +Description: + +This style file makes the ASCII character `-' (hyphen/minus) active, so +that it guesses, whether to print as a minus sign or as a hyphen. +The used heuristic is simple: It turns to a minus in math mode, or if it +is followed directly by a digit. Two dashes between digits are interpreted as +number range dash, no minus is inserted there. In other cases, it is just +the plain old hyphen. The ligature `--' works as usual, but the em dash +`---' is broken. If --- is followed by a digit, it prints as --$-$<digit>, +in the other case it is an en dash followed by a hyphen. The emdash can be +produced with the command \emdash. + +Know deficiencies: + +* You can't produce an em-dash by the input `---', use \emdash instead. +* The input `- -' produces an error message and wrong output. +* A space after the minus sign is eaten in moved text (like inside the + table of contents). + Workaround for the later two deficiencies: -{} + +J"org Knappen, Barbarossaring 43, D-55118 Mainz, Allemagne. +Author of the Book: Schnell ans Ziel mit LaTeX2e, Oldenbourg-Verlag +M"unchen, 1997, ISBN 3-486-24199-0. + +% /smartmn.sty
\ No newline at end of file |