From 53e17bc8a3cd2a7046b87e53478f5bb5a844a8a3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 12 Mar 2020 16:59:44 +0000 Subject: nth own package, from genmisc git-svn-id: svn://tug.org/texlive/trunk@54252 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/generic/nth/nth.sty | 56 ++++++++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 2 +- Master/tlpkg/libexec/ctan2tds | 2 + Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc | 1 + Master/tlpkg/tlpsrc/nth.tlpsrc | 0 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 Master/texmf-dist/tex/generic/nth/nth.sty create mode 100644 Master/tlpkg/tlpsrc/nth.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/tex/generic/nth/nth.sty b/Master/texmf-dist/tex/generic/nth/nth.sty new file mode 100644 index 00000000000..8a96c73903d --- /dev/null +++ b/Master/texmf-dist/tex/generic/nth/nth.sty @@ -0,0 +1,56 @@ +% nth.sty version 2002/27/02 Donald Arseneau +% Ordinal numbering style, 1st 2nd 3rd 4th 5th... 12th... 101st 102nd... +% +% (Public domain: take, include, extract, whatever) +% +% In LaTeX: +% \usepackage[super,negative]{nth} +% where option [super] gives superscript `th' +% and option [negative] allows ``st, nd, rd'' suffixes on negative numbers. +% +% example: \renewcommand{\thesection}{\ordinal{section}} +% or \renewcommand{\thesection}{\@ordinal\c@section} +% or \renewcommand{\thesection}{\nth\c@section} +% +% In plain TeX: +% \input nth.sty +% use: \nth{}. +% Change formatting by redefining \nthscript and \nthtest + +\def\nth#1{% First print number: + \expandafter\nthM \number #1\relax + \nthscript{% + \ifnum#1\nthtest0 th\else % negatives are all ``th'' (depending on \nthtest) + \expandafter \nthSuff \expandafter 0\number\ifnum #1<0-\fi#1\delimiter + \fi + }} + +% Minus sign using math mode: +\def\nthM#1{\if -#1\ifmmode-\else$-$\fi\else #1\fi} + +% Print suffix depending on last two digits: +\def\nthSuff#1#2#3{% + \ifx \delimiter#3% #1#2 are last two digits + \ifnum #1=1 th% teens are always ``th'' + \else % use appropriate suffix + \ifcase #2 th\or st\or nd\or rd\else th\fi + \fi + \else % continue scanning for last two digits + \expandafter \nthSuff \expandafter #2\expandafter #3% + \fi} + +% Formatting hook for ordinals (\let\nthscript\textsuperscript) +\def\nthscript#1{#1}% alternate: \def\nthscript#1{$\rm^{#1}$} + +% Formatting hook for all negative numbers giving ``th'' +\def\nthtest{<} % alternate: \def\nthtest{=} + +\ifx\Alph\undefined\else + \def\ordinal#1{\expandafter\@ordinal\csname c@#1\endcsname} + \let\@ordinal\nth + \ProvidesPackage{nth}[2002/02/27] + \DeclareOption{super}{\def\nthscript{\textsuperscript}} + \DeclareOption{negative}{\def\nthtest{=}} + \ProcessOptions +\fi + diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 8e74fb5a7a1..04b629aee8a 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -520,7 +520,7 @@ my @TLP_working = qw( nomencl nomentbl nonfloat nonumonpart nopageno norasi-c90 normalcolor nostarch notes notes2bib notespages notestex notex-bst noto noto-emoji notoccite novel nowidow nox npp-for-context - nrc ntgclass ntheorem ntheorem-vn nuc nucleardata + nrc ntgclass nth ntheorem ntheorem-vn nuc nucleardata numberedblock numberpt numericplots numname numnameru numprint numspell nwejm oberdiek objectz obnov diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 48bde7c8281..23682aab821 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1644,6 +1644,7 @@ $standarddest = "texmf-dist"; 'midnight', 'generic', 'mkpattern', 'plain', 'musixtnt', 'generic', + 'nth', 'generic', 'oberdiek', 'generic', 'ocherokee', 'lambda', 'ofs', 'generic', @@ -1956,6 +1957,7 @@ $standardtex 'noindentafter', "noindentafter\.sty", 'nomencl', '\.sty', # not .cfg 'notes', '[^s]\.(eps|pdf|png)|' . $standardtex, # not notes.pdf + 'nth', '\.sty', 'ntheorem', '\.sty|\.std', 'nucleardata', '\.(csv|hd|pytxcode)|' . $standardtex, 'nwejm', '[^c]\.cfg$|\.(.bx|sty|cls)$', # not ltxdoc.cfg diff --git a/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc b/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc index 4adbf915991..914cc1ad913 100644 --- a/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc @@ -61,6 +61,7 @@ depend modulus depend multido depend navigator depend newsletr +depend nth depend ofs depend olsak-misc depend path diff --git a/Master/tlpkg/tlpsrc/nth.tlpsrc b/Master/tlpkg/tlpsrc/nth.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3