summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/romanbar
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-01-03 00:14:41 +0000
committerKarl Berry <karl@freefriends.org>2012-01-03 00:14:41 +0000
commit20d68fe66aecde758e45ff238550f92ecff39cac (patch)
tree5f116721982e6a038384fad96df77d337b05b9b8 /Master/texmf-dist/tex/latex/romanbar
parent27a5cc0e9cbd1ea3a4f4d2f57e3d228ddf8d2ac7 (diff)
romanbar (2jan12)
git-svn-id: svn://tug.org/texlive/trunk@25005 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/romanbar')
-rw-r--r--Master/texmf-dist/tex/latex/romanbar/romanbar.sty181
1 files changed, 181 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/romanbar/romanbar.sty b/Master/texmf-dist/tex/latex/romanbar/romanbar.sty
new file mode 100644
index 00000000000..95aeddaafd5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/romanbar/romanbar.sty
@@ -0,0 +1,181 @@
+%%
+%% This is file `romanbar.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% romanbar.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Project: romanbar
+%% Version: 2012/01/01 v1.0f
+%%
+%% Copyright (C) 2011 by
+%% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
+%%
+%% The usual disclaimer applies:
+%% If it doesn't work right that's your problem.
+%% (Nevertheless, send an e-mail to the maintainer
+%% when you find an error in this package.)
+%%
+%% This work 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. This version of this license is in
+%% http://www.latex-project.org/lppl/lppl-1-3c.txt
+%% and the latest version of this license is in
+%% 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.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is H.-Martin Muench.
+%%
+%% This work consists of the main source file romanbar.dtx,
+%% the README, and the derived files
+%% romanbar.sty, romanbar.pdf,
+%% romanbar.ins, romanbar.drv,
+%% romanbar-example.tex, romanbar-example.pdf.
+%%
+\NeedsTeXFormat{LaTeX2e}[2011/06/27]
+\ProvidesPackage{romanbar}[2012/01/01 v1.0f
+ Roman numbers with bars (HMM)]
+
+%% Allows to write Roman numbers (or any other text) with bars
+%% and to convert Arabic numbers into Roman ones.
+%% romanbar may work with earlier versions of LaTeX,
+%% but this was not tested. Please consider updating
+%% your LaTeX to the most recent version
+%% (if it is not already the most recent version).
+
+\def\gobbleminus#1{\ifx-#1\else#1\fi}
+%% from http://www.tex.ac.uk/cgi-bin/texfaq2html?label=isitanum
+
+\newcommand{\ifnumeric}[3]{%
+%% similar to http://tex.stackexchange.com/a/17119
+\sbox\z@{\@tempcnta=0\gobbleminus#1\relax}%
+\ifdim\wd0>\z@\relax#3% is not numeric
+\else#2% is numeric
+\fi%
+}
+
+\def\r@iseL#1{\ifx @#1% then terminate
+\else%
+\if L#1\raisebox{0.05ex}{L}\else #1\fi%
+\expandafter\r@iseL%
+\fi%
+}
+
+\DeclareRobustCommand{\Romanbar}[1]{%
+\ifnumeric{#1}{% is numeric
+\@tempcnta=#1\relax%
+%% similar to \XRoman from the http://ctan.org/pkg/pageslts package
+\ifnum\@tempcnta<1%
+ \ifnum #1>0%
+ \relax \Roman@bar{\Roman{#1}}%
+ \else%
+ \ifnum #1<0%
+ -\Roman@bar{\expandafter\@slowromancap\romannumeral\number-#1@%
+ }%
+ \else%
+ \Roman@bar{0}%
+ \fi%
+ \fi%
+\else\Roman@bar{\@Roman\@tempcnta}%
+\fi%
+}{% is not numeric
+\Roman@bar{#1}%
+}%
+}
+
+\DeclareRobustCommand{\Roman@bar}[1]{% #1 is in Roman, i.e. MMXII
+%% (or any other text, "Caesar" would work, too).
+%% similar to code of by Prof. Enrico Gregorio (egreg) at
+%% http://tex.stackexchange.com/questions/24065/roman-numerals-formatting/24084#24084
+\@bsphack%
+\edef\romanbartmp{#1}%
+%% height:
+\sbox0{\textsf{\romanbartmp}}%
+%% top line:
+%% + top of top line:
+\@tempdima=\ht0%
+\advance\@tempdima+0.05ex%0.03
+\dimen1=\@tempdima%
+%% + bottom of top line:
+\@tempdima=-\ht0%
+\advance\@tempdima+0.05ex%0.07
+\dimen2=\@tempdima%
+%% width:
+\sbox0{\textsf{\expandafter\r@iseL\romanbartmp @}}%
+\@tempdima=\wd0%
+\advance\@tempdima+1pt%
+\dimen0=\@tempdima%
+\@esphack%
+\makebox[\dimen0]{%
+\rlap{\vrule width\dimen0 height\dimen1 depth\dimen2}% top line
+\rlap{\vrule width\dimen0 height 0.06ex depth 0.03ex}% bottom line
+\kern0.5pt\textsf{\expandafter\r@iseL\romanbartmp @}\kern0.5pt}%
+}
+
+\DeclareRobustCommand{\romannum}[1]{%
+\ifnumeric{#1}{% is numeric
+\@tempcnta=#1\relax%
+%% similar to \xroman from the http://ctan.org/pkg/pageslts package
+\ifnum\@tempcnta<1%
+ \ifnum #1>0%
+ \relax \roman{#1}%
+ \else%
+ \ifnum #1<0%
+ -\romannumeral\number-#1@%
+ \else%
+ 0%
+ \fi%
+ \fi%
+\else\@roman\@tempcnta%
+\fi%
+}{% is not numeric
+\PackageError{romanbar}{%
+Argument of \string\romannum\space is not a number}{%
+The command \string\romannum\space converts an Arabic number into a%
+ lower-case Roman one,\MessageBreak%
+but the used argument of \string\romannum\space is not an Arabic number%
+ but\MessageBreak%
+`#1`,\MessageBreak%
+which will now be printed unchanged.}%
+#1%
+}%
+}
+
+\DeclareRobustCommand{\Romannum}[1]{%
+\ifnumeric{#1}{% is numeric
+\@tempcnta=#1\relax%
+%% similar to \XRoman from the http://ctan.org/pkg/pageslts package
+\ifnum\@tempcnta<1%
+ \ifnum #1>0%
+ \relax \Roman{#1}%
+ \else%
+ \ifnum #1<0%
+ -\expandafter\@slowromancap\romannumeral\number-#1@%
+ \else%
+ 0%
+ \fi%
+ \fi%
+\else\@Roman\@tempcnta%
+\fi%
+}{% is not numeric
+\PackageError{romanbar}{%
+Argument of \string\Romannum\space is not a number}{%
+The command \string\Romannum\space converts an Arabic number into an%
+ upper-case Roman one,\MessageBreak%
+but the used argument of \string\Romannum\space is not an Arabic number%
+ but\MessageBreak%
+`#1`.}%
+#1%
+}%
+}
+
+\endinput
+%%
+%% End of file `romanbar.sty'.