| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: romanbar.dtx |
| 4 |
% Version: 2025-01-28 v1.0g |
| 5 |
% Info: Roman numbers with bars |
| 6 |
% |
| 7 |
% Copyright (C) 2011 - 2025 by |
| 8 |
% H.-Martin Münch <Martin dot Muench at Uni-Bonn dot de> |
| 9 |
% |
| 10 |
% The original code for the bars was written by Prof. Enrico Gregorio |
| 11 |
% (https://profs.sci.univr.it/~gregorio/), and published at |
| 12 |
% https://tex.stackexchange.com/a/24084 |
| 13 |
% I (H.-Martin Münch) submitted this package to CTAN |
| 14 |
% (after diverse updates of the code and writing a documentation). |
| 15 |
% |
| 16 |
% This work may be distributed and/or modified under the |
| 17 |
% conditions of the LaTeX Project Public License, either |
| 18 |
% version 1.3c of this license or (at your option) any later |
| 19 |
% version. This version of this license is in |
| 20 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 21 |
% and the latest version of this license is in |
| 22 |
% https://www.latex-project.org/lppl.txt |
| 23 |
% and version 1.3c or later is part of all distributions of |
| 24 |
% LaTeX version 2005-12-01 or later. |
| 25 |
% |
| 26 |
% This work has the LPPL maintenance status "maintained". |
| 27 |
% |
| 28 |
% The Current Maintainer of this work is H.-Martin Münch. |
| 29 |
% |
| 30 |
% This work consists of the main source file romanbar.dtx, |
| 31 |
% the README, and the derived files |
| 32 |
% romanbar.sty, romanbar.pdf, |
| 33 |
% romanbar.ins, romanbar.drv, |
| 34 |
% romanbar-example.tex, romanbar-example.pdf. |
| 35 |
% |
| 36 |
% "romanbar" is available on CTAN: |
| 37 |
% https://www.ctan.org/pkg/romanbar |
| 38 |
% |
| 39 |
% Also a TDS.ZIP file is provided that contains all the files |
| 40 |
% already sorted in a TDS tree: |
| 41 |
% https://mirror.ctan.org/install/macros/latex/contrib/romanbar.tds.zip |
| 42 |
% |
| 43 |
%<*ignore> |
| 44 |
\begingroup |
| 45 |
\catcode123=1 % |
| 46 |
\catcode125=2 % |
| 47 |
\def\x{LaTeX2e}% |
| 48 |
\expandafter\endgroup |
| 49 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 50 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 51 |
\ifx\fmtname\x\else 1\fi\relax |
| 52 |
\else\csname fi\endcsname |
| 53 |
%</ignore> |
| 54 |
%<*install> |
| 55 |
\input docstrip.tex |
| 56 |
\Msg{********************************************************************} |
| 57 |
\Msg{* Installation *} |
| 58 |
\Msg{* Package: romanbar 2025-01-28 v1.0g Roman numbers with bars (HMM) *} |
| 59 |
\Msg{********************************************************************} |
| 60 |
|
| 61 |
\keepsilent |
| 62 |
\askforoverwritefalse |
| 63 |
|
| 64 |
\let\MetaPrefix\relax |
| 65 |
\preamble |
| 66 |
|
| 67 |
This is a generated file. |
| 68 |
|
| 69 |
Project: romanbar |
| 70 |
Version: 2025-01-28 v1.0g |
| 71 |
|
| 72 |
Copyright (C) 2011 - 2025 by |
| 73 |
H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de> |
| 74 |
|
| 75 |
This work may be distributed and/or modified under the |
| 76 |
conditions of the LaTeX Project Public License, either |
| 77 |
version 1.3c of this license or (at your option) any later |
| 78 |
version. This version of this license is in |
| 79 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 80 |
and the latest version of this license is in |
| 81 |
https://www.latex-project.org/lppl.txt |
| 82 |
and version 1.3c or later is part of all distributions of |
| 83 |
LaTeX version 2005-12-01 or later. |
| 84 |
|
| 85 |
This work has the LPPL maintenance status "maintained". |
| 86 |
|
| 87 |
The Current Maintainer of this work is H.-Martin Muench. |
| 88 |
|
| 89 |
This work consists of the main source file romanbar.dtx, |
| 90 |
the README, and the derived files |
| 91 |
romanbar.sty, romanbar.pdf, |
| 92 |
romanbar.ins, romanbar.drv, |
| 93 |
romanbar-example.tex, romanbar-example.pdf. |
| 94 |
|
| 95 |
In memoriam |
| 96 |
Claudia Simone Barth + 1996-01-30 |
| 97 |
Tommy Muench + 2014-01-02 |
| 98 |
Hans-Klaus Muench + 2014-08-24 |
| 99 |
|
| 100 |
\endpreamble |
| 101 |
\let\MetaPrefix\DoubleperCent |
| 102 |
|
| 103 |
\generate{% |
| 104 |
\file{romanbar.ins}{\from{romanbar.dtx}{install}}% |
| 105 |
\file{romanbar.drv}{\from{romanbar.dtx}{driver}}% |
| 106 |
\usedir{tex/latex/romanbar}% |
| 107 |
\file{romanbar.sty}{\from{romanbar.dtx}{package}}% |
| 108 |
\usedir{doc/latex/romanbar}% |
| 109 |
\file{romanbar-example.tex}{\from{romanbar.dtx}{example}}% |
| 110 |
} |
| 111 |
|
| 112 |
\catcode32=13\relax% active space |
| 113 |
\let =\space% |
| 114 |
\Msg{************************************************************************} |
| 115 |
\Msg{*} |
| 116 |
\Msg{* To finish the installation you have to move the following} |
| 117 |
\Msg{* file into a directory searched by TeX:} |
| 118 |
\Msg{*} |
| 119 |
\Msg{* romanbar.sty} |
| 120 |
\Msg{*} |
| 121 |
\Msg{* To produce the documentation run the file `romanbar.drv'} |
| 122 |
\Msg{* through (pdf)LaTeX, e.g.} |
| 123 |
\Msg{* pdflatex romanbar.drv} |
| 124 |
\Msg{* makeindex -s gind.ist romanbar.idx} |
| 125 |
\Msg{* pdflatex romanbar.drv} |
| 126 |
\Msg{* makeindex -s gind.ist romanbar.idx} |
| 127 |
\Msg{* pdflatex romanbar.drv} |
| 128 |
\Msg{*} |
| 129 |
\Msg{* At least three runs are necessary e.g. to get the} |
| 130 |
\Msg{* references right!} |
| 131 |
\Msg{*} |
| 132 |
\Msg{* Happy TeXing!} |
| 133 |
\Msg{*} |
| 134 |
\Msg{************************************************************************} |
| 135 |
|
| 136 |
\endbatchfile |
| 137 |
%</install> |
| 138 |
%<*ignore> |
| 139 |
\fi |
| 140 |
%</ignore> |
| 141 |
% |
| 142 |
% \section{The documentation driver file} |
| 143 |
% |
| 144 |
% The next bit of code contains the documentation driver file for |
| 145 |
% \TeX , i.\,e., the file that will produce the documentation you |
| 146 |
% are currently reading. It will be extracted from this file by the |
| 147 |
% \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip} |
| 148 |
% and specify the \texttt{driver} option when \texttt{docstrip} |
| 149 |
% asks for options. |
| 150 |
% |
| 151 |
% \begin{macrocode} |
| 152 |
%<*driver> |
| 153 |
\NeedsTeXFormat{LaTeX2e}[2024-11-01] |
| 154 |
\ProvidesFile{romanbar.drv}% |
| 155 |
[2025-01-28 v1.0g Roman numbers with bars (HMM)] |
| 156 |
\documentclass{ltxdoc}[2024/02/08]% v2.1j |
| 157 |
\usepackage{holtxdoc}[2019/12/09]% v0.30 |
| 158 |
\hypersetup{% |
| 159 |
pdfsubject={Writing Roman numbers with bars (HMM)},% |
| 160 |
pdfkeywords={LaTeX, romanbar, roman, Roman, bars},% |
| 161 |
pdfencoding=auto,% |
| 162 |
pdflang={en},% |
| 163 |
breaklinks=true,% |
| 164 |
linktoc=all,% |
| 165 |
pdfstartview=FitH,% |
| 166 |
pdfpagelayout=OneColumn,% |
| 167 |
bookmarksnumbered=true,% |
| 168 |
bookmarksopen=true,% |
| 169 |
bookmarksopenlevel=2,% |
| 170 |
pdfmenubar=true,% |
| 171 |
pdftoolbar=true,% |
| 172 |
pdfwindowui=true,% |
| 173 |
pdfnewwindow=true% |
| 174 |
} |
| 175 |
\CodelineIndex |
| 176 |
\hyphenation{docu-ment ana-lysed} |
| 177 |
\begin{document} |
| 178 |
\DocInput{romanbar.dtx}% |
| 179 |
\end{document} |
| 180 |
%</driver> |
| 181 |
% \end{macrocode} |
| 182 |
% \fi |
| 183 |
% |
| 184 |
% \GetFileInfo{romanbar.drv} |
| 185 |
% |
| 186 |
% \begingroup |
| 187 |
% \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}% |
| 188 |
% \makeatletter |
| 189 |
% \@onelevel@sanitize\x |
| 190 |
% \expandafter\endgroup |
| 191 |
% \expandafter\DoNotIndex\expandafter{\x} |
| 192 |
% \expandafter\DoNotIndex\expandafter{\string\ } |
| 193 |
% \begingroup |
| 194 |
% \makeatletter |
| 195 |
% \lccode`9=32\relax |
| 196 |
% \lowercase{%^^A |
| 197 |
% \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A |
| 198 |
% }%^^A |
| 199 |
% \expandafter\endgroup\x |
| 200 |
% |
| 201 |
% \DoNotIndex{\,,\@Roman,\@bsphack,\@esphack,\@roman,\@slowromancap,\c@romanbarcount,% |
| 202 |
% \documentclass,\begin,\end,\listfiles,\MessageBreak,\NeedsTeXFormat,% |
| 203 |
% \newline,\noindent,\ProvidesPackage,\space,\textsf,\texttt,\usepackage,% |
| 204 |
% \DeclareRobustCommand,\dimexpr,\ht,\if,\ifdim,\ifnum,\ifx,\item,% |
| 205 |
% \kern,\makebox,\newcommand,\number,\PackageError,\pagenumbering,% |
| 206 |
% \raisebox,\RequirePackage,\rlap,\Roman,\roman,% |
| 207 |
% \romanbardimD,\romanbardimH,\romanbardimW,\romanbartmp,\romannumeral,% |
| 208 |
% \sbox,\section,\setcounter,\setlength,\theexample,\theromanbarcount,% |
| 209 |
% \verb,\vrule,\wd,\XRoman,\xroman,\z@} |
| 210 |
% |
| 211 |
% \title{The \xpackage{romanbar} package} |
| 212 |
% \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}} |
| 213 |
% \date{2025-01-28 v1.0g} |
| 214 |
% \maketitle |
| 215 |
% |
| 216 |
% \begin{abstract} |
| 217 |
% \noindent This \LaTeX{} package allows to write Roman numbers |
| 218 |
% (or any other text) with horizontal bars. Additionally, |
| 219 |
% commands for converting Arabic numbers into Roman ones are provided |
| 220 |
% and an |\ifnumeric| test function. |
| 221 |
% \end{abstract} |
| 222 |
% \bigskip |
| 223 |
% |
| 224 |
% \noindent Disclaimer for web links: The author is not responsible for any contents |
| 225 |
% referred to in this work unless having full knowledge of illegal contents. |
| 226 |
% If any damage occurs by the use of information presented there, |
| 227 |
% only the author of the respective pages might be liable, |
| 228 |
% not the one who has referred to those pages. |
| 229 |
% |
| 230 |
% \tableofcontents |
| 231 |
% |
| 232 |
% \bigskip |
| 233 |
% |
| 234 |
% \section{Introduction} |
| 235 |
% \indent This \LaTeX{} package allows to write Roman numbers |
| 236 |
% (or any other text) with horizontal bars. Additionally, |
| 237 |
% commands for converting Arabic numbers into Roman ones are provided |
| 238 |
% and an |\ifnumeric| test function.\bigskip |
| 239 |
% |
| 240 |
% \section{Usage} |
| 241 |
% \indent Just load the package placing |
| 242 |
% \begin{quote} |
| 243 |
% |\usepackage{romanbar}| |
| 244 |
% \end{quote} |
| 245 |
% \noindent in the preamble of your \LaTeXe{} source file.\newline |
| 246 |
% |\Romanbar{...}| then produces a Roman number with bars (please see the example file). |
| 247 |
% |\romannum{...}| turns an Arabic number into a lowercase Roman one, and |
| 248 |
% |\Romannum{...}| turns an Arabic number into an uppercase Roman one. |
| 249 |
% |\ifnumeric{test}{true}{false}| tests for |test| being numeric. |
| 250 |
% |
| 251 |
% \subsection*{Options} |
| 252 |
% \DescribeMacro{options} |
| 253 |
% \indent The \xpackage{romanbar} package takes no options. |
| 254 |
% |
| 255 |
% \section{Alternatives\label{sec:Alternatives}} |
| 256 |
% \begin{description} |
| 257 |
% \item[-] the original code written by Prof. Enrico Gregorio\newline |
| 258 |
% (\url{https://profs.sci.univr.it/~gregorio/}),\newline |
| 259 |
% \url{https://tex.stackexchange.com/a/24084} |
| 260 |
% \end{description} |
| 261 |
%\begin{verbatim} |
| 262 |
%\def\barroman#1{\sbox0{#1}\dimen0=\dimexpr\wd0+1pt\relax |
| 263 |
% \makebox[\dimen0]{\rlap{\vrule width\dimen0 height 0.06ex depth 0.06ex}% |
| 264 |
% \rlap{\vrule width\dimen0 height\dimexpr\ht0+0.03ex\relax |
| 265 |
% depth\dimexpr-\ht0+0.09ex\relax}% |
| 266 |
% \kern.5pt#1\kern.5pt}} |
| 267 |
% |
| 268 |
%\barroman{I} \barroman{XI} |
| 269 |
%\end{verbatim} |
| 270 |
% \begin{description} |
| 271 |
% \item[-] Some fonts provide single characters for Roman numerals, |
| 272 |
% \hbox{cf. e.\,g.} \url{https://tex.stackexchange.com/q/38695}. |
| 273 |
% With \TeX-engines like \LuaLaTeX{} and \XeLaTeX{} |
| 274 |
% unicode can be used directly if an according font is used |
| 275 |
% (e.\,g.~|\usepackage{fontspec}\usepackage{libertine}|). |
| 276 |
% \end{description} |
| 277 |
% |
| 278 |
% \noindent (You programmed or found another alternative, |
| 279 |
% which is available at \url{https://www.ctan.org/}?\newline |
| 280 |
% OK, send an e-mail to me with the name, location at |
| 281 |
% \url{https://www.ctan.org/}, and a short notice, |
| 282 |
% and I will probably include it in the list above.) |
| 283 |
% |
| 284 |
% \newpage |
| 285 |
% |
| 286 |
% \section{Example} |
| 287 |
% |
| 288 |
% \begin{macrocode} |
| 289 |
%<*example> |
| 290 |
\NeedsTeXFormat{LaTeX2e}[2024-11-01] |
| 291 |
\documentclass[british]{article}[2024/06/29]% v1.4n |
| 292 |
\usepackage[extension=pdf,% |
| 293 |
plainpages=false,% |
| 294 |
pdfpagelabels=true,% |
| 295 |
hyperindex=false,% |
| 296 |
pdflang={en},% |
| 297 |
pdftitle={romanbar package example},% |
| 298 |
pdfauthor={H.-Martin Muench},% |
| 299 |
pdfsubject={Example for the romanbar package},% |
| 300 |
pdfkeywords={LaTeX, romanbar, roman, Roman, bars},% |
| 301 |
pdfview=Fit,pdfstartview=Fit,% |
| 302 |
pdfpagelayout=SinglePage% |
| 303 |
]{hyperref}[2024-11-05]% v7.01l |
| 304 |
\usepackage{romanbar}[2025-01-28]% v1.0g |
| 305 |
\listfiles |
| 306 |
\begin{document} |
| 307 |
\pagenumbering{arabic} |
| 308 |
\section*{Example for romanbar} |
| 309 |
|
| 310 |
This example demonstrates the use of package\newline |
| 311 |
\textsf{romanbar}, v1.0g as of 2025-01-28.\newline |
| 312 |
There are no options to be used.\newline |
| 313 |
|
| 314 |
\noindent For more details please see the documentation! |
| 315 |
|
| 316 |
\noindent This package provides the command \verb|\Romanbar| |
| 317 |
to print bars below and over the following: |
| 318 |
|
| 319 |
\begin{description} |
| 320 |
\item[-] Roman numbers: \verb|\Romanbar{MMXXV}| prints \Romanbar{MMXXV} |
| 321 |
|
| 322 |
\item[-] Arabic numbers turned into upper-case Roman numbers:\newline |
| 323 |
\verb|\Romanbar{2025}| prints \Romanbar{2025} |
| 324 |
|
| 325 |
\item[-] negative Arabic numbers turned into upper-case Roman numbers |
| 326 |
\newline |
| 327 |
(although historically there were no negative Roman numbers): |
| 328 |
\newline |
| 329 |
\verb|\Romanbar{-25}| prints \Romanbar{-25} |
| 330 |
|
| 331 |
\item[-] zero Arabic number ($0$; although historically |
| 332 |
there was no Roman zero):\newline |
| 333 |
\verb|\Romanbar{0}| prints \Romanbar{0} |
| 334 |
|
| 335 |
\item[-] some arbitrary text: |
| 336 |
\verb|\Romanbar{Caesar}| prints \Romanbar{Caesar}\newline |
| 337 |
(with descenders: \Romanbar{AgjpqyW}) |
| 338 |
|
| 339 |
\newcounter{example} |
| 340 |
\setcounter{example}{25} |
| 341 |
|
| 342 |
\item[-] some counter's value: |
| 343 |
\verb|\Romanbar{\theexample}| prints \Romanbar{\theexample} |
| 344 |
\newline |
| 345 |
(where the value of \texttt{example} is \theexample) |
| 346 |
|
| 347 |
\item[-] Arabic numbers, without turning them into upper-case Roman |
| 348 |
numbers:\newline |
| 349 |
\verb|\Romanbar{\relax 2025}| prints \Romanbar{\relax 2025} |
| 350 |
\end{description} |
| 351 |
|
| 352 |
Special care was taken for "L" (50), e.\,g.~in 555/DLV: \Romanbar{555}. |
| 353 |
|
| 354 |
\verb|\romannum{...}| converts an Arabic number into a lower-case Roman one, |
| 355 |
e.\,g.~\verb|\romannum{2025}| prints \romannum{2025}, and |
| 356 |
\verb|\Romannum{...}| converts an Arabic number into an upper-case Roman one, |
| 357 |
e.\,g.~\verb|\Romannum{2025}| prints \Romannum{2025}. |
| 358 |
\end{document} |
| 359 |
%</example> |
| 360 |
% \end{macrocode} |
| 361 |
% |
| 362 |
% \StopEventually{} |
| 363 |
% |
| 364 |
% \bigskip |
| 365 |
% |
| 366 |
% \section{The implementation} |
| 367 |
% |
| 368 |
% We start off by checking that we are loading into \LaTeXe{} and |
| 369 |
% announcing the name and version of this package. |
| 370 |
% |
| 371 |
% \begin{macrocode} |
| 372 |
%<*package> |
| 373 |
% \end{macrocode} |
| 374 |
% |
| 375 |
% \begin{macrocode} |
| 376 |
\NeedsTeXFormat{LaTeX2e}[2024-11-01] |
| 377 |
\ProvidesPackage{romanbar}[2025-01-28 v1.0g Roman numbers with bars (HMM)] |
| 378 |
% \end{macrocode} |
| 379 |
% |
| 380 |
% A short description of the \xpackage{romanbar} package: |
| 381 |
% |
| 382 |
% \begin{macrocode} |
| 383 |
%% Allows to write Roman numbers (or any other text) with bars |
| 384 |
%% and to convert Arabic numbers into Roman ones. |
| 385 |
% \end{macrocode} |
| 386 |
% |
| 387 |
% There are no options to be processed. |
| 388 |
% |
| 389 |
% \begin{macrocode} |
| 390 |
|
| 391 |
\RequirePackage{trimclip}[2020/08/19]% v1.2 |
| 392 |
|
| 393 |
\newcounter{romanbarcount} |
| 394 |
\newdimen\romanbardimH |
| 395 |
\newdimen\romanbardimD |
| 396 |
\newdimen\romanbardimW |
| 397 |
|
| 398 |
% \end{macrocode} |
| 399 |
% \begin{macro}{\gobbleminus} |
| 400 |
% |
| 401 |
% A command to gobble a possible minus sign is needed and |
| 402 |
% |\gobbleminus| from \url{https://texfaq.org/FAQ-isitanum} |
| 403 |
% is used. |
| 404 |
% |
| 405 |
% \begin{macrocode} |
| 406 |
\def\gobbleminus#1{\ifx-#1\else#1\fi} |
| 407 |
%% from https://texfaq.org/FAQ-isitanum |
| 408 |
|
| 409 |
% \end{macrocode} |
| 410 |
% \end{macro} |
| 411 |
% \begin{macro}{\ifnumeric} |
| 412 |
% |
| 413 |
% We want to test whether the argument passed to |\Romanbar| is numeric |
| 414 |
% and therefore define |\ifnumeric{test}{true}{false}|, |
| 415 |
% where |test| is to be analysed, |true| is the code to be executed, |
| 416 |
% if |test| is numeric, and |false| is the code to be executed, |
| 417 |
% if |test| is not numeric. This is done similar to |
| 418 |
% \url{https://tex.stackexchange.com/a/17119}. |
| 419 |
% |
| 420 |
% \begin{macrocode} |
| 421 |
\newcommand{\ifnumeric}[3]{% |
| 422 |
%% similar to https://tex.stackexchange.com/a/17119 |
| 423 |
\sbox\z@{\c@romanbarcount=0\gobbleminus#1\relax}% |
| 424 |
\ifdim\wd0>\z@\relax#3% is not numeric |
| 425 |
\else#2% is numeric |
| 426 |
\fi% |
| 427 |
} |
| 428 |
|
| 429 |
% \end{macrocode} |
| 430 |
% \end{macro} |
| 431 |
% \begin{macro}{\r@iseL} |
| 432 |
% |
| 433 |
% We define |\r@iseL| to raise any L~(50), otherwise a good deal |
| 434 |
% of the horizontal part of the letter would be swallowed by the lower bar |
| 435 |
% under the \textquotedblleft number\textquotedblright . |
| 436 |
% |
| 437 |
% \begin{macrocode} |
| 438 |
\def\r@iseL#1{\ifx @#1% then terminate |
| 439 |
\else% |
| 440 |
\if L#1\raisebox{0.05ex}{\begin{clipbox}{0pt 0pt 0pt 0.05ex}L\end{clipbox}}% |
| 441 |
\else #1\fi% |
| 442 |
\expandafter\r@iseL% |
| 443 |
\fi% |
| 444 |
} |
| 445 |
|
| 446 |
% \end{macrocode} |
| 447 |
% \end{macro} |
| 448 |
% \begin{macro}{\Romanbar} |
| 449 |
% |
| 450 |
% We define the |\Romanbar| command. |
| 451 |
% |
| 452 |
% \begin{macrocode} |
| 453 |
\DeclareRobustCommand{\Romanbar}[1]{% |
| 454 |
\ifnumeric{#1}{% is numeric |
| 455 |
% \end{macrocode} |
| 456 |
% |
| 457 |
% If its parameter is numeric, the temporary counter |romanbarcount| is set to the value. |
| 458 |
% |
| 459 |
% \begin{macrocode} |
| 460 |
\setcounter{romanbarcount}{#1}% |
| 461 |
% \end{macrocode} |
| 462 |
% |
| 463 |
% Regularly there are no non-positive Roman numbers, therefore we do some trick |
| 464 |
% similar to |\XRoman| from the \url{https://ctan.org/pkg/pageslts} package. |
| 465 |
% |
| 466 |
% \begin{macrocode} |
| 467 |
%% similar to \XRoman from the https://ctan.org/pkg/pageslts package |
| 468 |
\ifnum\theromanbarcount<1% |
| 469 |
\ifnum #1>0\relax% |
| 470 |
\Roman@bar{\Roman{#1}}% |
| 471 |
\else% |
| 472 |
\ifnum #1<0\relax% |
| 473 |
-\Roman@bar{\expandafter\@slowromancap\romannumeral\number-#1@}% |
| 474 |
\else% |
| 475 |
\Roman@bar{0}% |
| 476 |
\fi% |
| 477 |
\fi% |
| 478 |
\else\Roman@bar{\@Roman\c@romanbarcount}% |
| 479 |
\fi% |
| 480 |
}{% is not numeric |
| 481 |
\Roman@bar{#1}% |
| 482 |
}% |
| 483 |
} |
| 484 |
|
| 485 |
% \end{macrocode} |
| 486 |
% \end{macro} |
| 487 |
% \begin{macro}{\Roman@bar} |
| 488 |
% |
| 489 |
% Whether it is numeric or not, in the end |\Roman@bar| is applied to it. |
| 490 |
% |
| 491 |
% \begin{macrocode} |
| 492 |
\DeclareRobustCommand{\Roman@bar}[1]{% #1 is in Roman, i.e. MMXXIII |
| 493 |
%% (or any other text, "Caesar" would work, too); |
| 494 |
%% similar to code of by Prof. Enrico Gregorio (egreg) at |
| 495 |
%% https://tex.stackexchange.com/a/24084 |
| 496 |
\@bsphack% |
| 497 |
\edef\romanbartmp{#1}% |
| 498 |
%% height: |
| 499 |
\sbox0{\textsf{\romanbartmp}}% |
| 500 |
%% top line: |
| 501 |
%% + top of top line: |
| 502 |
\setlength{\romanbardimH}{\dimexpr\ht0+0.05ex\relax}% |
| 503 |
%% + bottom of top line: |
| 504 |
\setlength{\romanbardimD}{\dimexpr-\ht0+0.05ex\relax}% |
| 505 |
%% width: |
| 506 |
\sbox0{\textsf{\expandafter\r@iseL\romanbartmp @}}% |
| 507 |
\setlength{\romanbardimW}{\dimexpr\wd0+1pt\relax}% |
| 508 |
\@esphack% |
| 509 |
\makebox[\romanbardimW]{% |
| 510 |
\rlap{\vrule width\romanbardimW height\romanbardimH depth\romanbardimD}% top line |
| 511 |
\rlap{\vrule width\romanbardimW height 0.06ex depth 0.03ex}% bottom line |
| 512 |
\kern0.5pt\textsf{\expandafter\r@iseL\romanbartmp @}\kern0.5pt}% |
| 513 |
} |
| 514 |
|
| 515 |
% \end{macrocode} |
| 516 |
% \end{macro} |
| 517 |
% \begin{macro}{\romannum} |
| 518 |
% |
| 519 |
% While it is not needed for the bars, it is sometimes asked for a command |
| 520 |
% to convert an Arabic number into a Roman one. |\roman{...}| can only be applied |
| 521 |
% to a counter, i.\,e.~|\roman{25}| does not work, but |
| 522 |
%\begin{verbatim} |
| 523 |
%\newcounter{examplecounter} |
| 524 |
%\setcounter{examplecounter}{25} |
| 525 |
%\roman{examplecounter} |
| 526 |
%\end{verbatim} |
| 527 |
% would be necessary. Further non-negative values would not work. |
| 528 |
% |\romannum| accepts any number as argument. (If the argument is no number, |
| 529 |
% an error message is given and the argument printed (executed) |
| 530 |
% without applying anything to it.) |
| 531 |
% |
| 532 |
% \begin{macrocode} |
| 533 |
\DeclareRobustCommand{\romannum}[1]{% |
| 534 |
\ifnumeric{#1}{% is numeric |
| 535 |
\setcounter{romanbarcount}{#1}% |
| 536 |
%% similar to \xroman from the https://ctan.org/pkg/pageslts package |
| 537 |
\ifnum\c@romanbarcount<1\relax% |
| 538 |
\ifnum #1>0\relax% |
| 539 |
\roman{#1}% |
| 540 |
\else% |
| 541 |
\ifnum #1<0\relax% |
| 542 |
-\romannumeral\number-#1@% |
| 543 |
\else% |
| 544 |
0% |
| 545 |
\fi% |
| 546 |
\fi% |
| 547 |
\else\@roman\c@romanbarcount% |
| 548 |
\fi% |
| 549 |
}{% is not numeric |
| 550 |
\PackageError{romanbar}{% |
| 551 |
Argument of \string\romannum\space is not a number}{% |
| 552 |
The command \string\romannum\space converts an Arabic number into a % |
| 553 |
lower-case Roman one,\MessageBreak% |
| 554 |
but the used argument of \string\romannum\space is not an Arabic number % |
| 555 |
but\MessageBreak% |
| 556 |
`#1`,\MessageBreak% |
| 557 |
which will now be printed unchanged.}% |
| 558 |
#1% |
| 559 |
}% |
| 560 |
} |
| 561 |
|
| 562 |
% \end{macrocode} |
| 563 |
% \end{macro} |
| 564 |
% \begin{macro}{\Romannum} |
| 565 |
% |
| 566 |
% The same for upper-case Roman numbers, |\Romannum| instead of |\Roman|: |
| 567 |
% |
| 568 |
% \begin{macrocode} |
| 569 |
\DeclareRobustCommand{\Romannum}[1]{% |
| 570 |
\ifnumeric{#1}{% is numeric |
| 571 |
\setcounter{romanbarcount}{#1}% |
| 572 |
%% similar to \XRoman from the http://ctan.org/pkg/pageslts package |
| 573 |
\ifnum\c@romanbarcount<1\relax% |
| 574 |
\ifnum #1>0\relax% |
| 575 |
\Roman{#1}% |
| 576 |
\else% |
| 577 |
\ifnum #1<0\relax% |
| 578 |
-\expandafter\@slowromancap\romannumeral\number-#1@% |
| 579 |
\else% |
| 580 |
0% |
| 581 |
\fi% |
| 582 |
\fi% |
| 583 |
\else\@Roman\c@romanbarcount% |
| 584 |
\fi% |
| 585 |
}{% is not numeric |
| 586 |
\PackageError{romanbar}{% |
| 587 |
Argument of \string\Romannum\space is not a number}{% |
| 588 |
The command \string\Romannum\space converts an Arabic number into an % |
| 589 |
upper-case Roman one,\MessageBreak% |
| 590 |
but the used argument of \string\Romannum\space is not an Arabic number % |
| 591 |
but\MessageBreak% |
| 592 |
`#1`.}% |
| 593 |
#1% |
| 594 |
}% |
| 595 |
} |
| 596 |
|
| 597 |
% \end{macrocode} |
| 598 |
% \end{macro} |
| 599 |
% \begin{macrocode} |
| 600 |
%</package> |
| 601 |
% \end{macrocode} |
| 602 |
% |
| 603 |
% \section{Installation} |
| 604 |
% \subsection{Downloads} |
| 605 |
% Everything is available at \url{https://www.CTAN.org/}, |
| 606 |
% but may need additional packages themselves. |
| 607 |
% |
| 608 |
% \DescribeMacro{romanbar.dtx} |
| 609 |
% For unpacking the |romanbar.dtx| file and constructing the documentation |
| 610 |
% it is required: |
| 611 |
% \begin{description} |
| 612 |
% \item[-] \LaTeXe{}[2024-11-01] or newer, |
| 613 |
% \url{https://www.ctan.org/starter} |
| 614 |
% |
| 615 |
% \item[-] document class \xpackage{ltxdoc}, 2024/02/08, v2.1j, |
| 616 |
% \url{https://www.ctan.org/pkg/ltxdoc} |
| 617 |
% |
| 618 |
% \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, |
| 619 |
% \url{https://www.ctan.org/pkg/holtxdoc} |
| 620 |
% |
| 621 |
% \item[-] package \xpackage{hypdoc}, 2023-10-26, v1.19, |
| 622 |
% \url{https://www.ctan.org/pkg/hypdoc} |
| 623 |
% \end{description} |
| 624 |
% |
| 625 |
% \DescribeMacro{romanbar.sty} |
| 626 |
% The \texttt{romanbar.sty} for \LaTeXe{} (i.\,e.~each document using |
| 627 |
% the \xpackage{romanbar} package) requires: |
| 628 |
% \begin{description} |
| 629 |
% \item[-] \TeX Format \LaTeXe{}[2024-11-01] or newer, |
| 630 |
% \url{https://www.ctan.org/starter} |
| 631 |
% |
| 632 |
% \item[-] package \xpackage{trimclip}, 2020/08/19, v1.2, |
| 633 |
% from the \xpackage{adjustbox} bundle, |
| 634 |
% \url{https://www.ctan.org/pkg/adjustbox} |
| 635 |
% \end{description} |
| 636 |
% |
| 637 |
% \DescribeMacro{romanbar-example.tex} |
| 638 |
% The \texttt{romanbar-example.tex} requires the same files as all |
| 639 |
% documents using the \xpackage{romanbar} package and additionally: |
| 640 |
% \begin{description} |
| 641 |
% \item[-] class \xpackage{article}, 2024/06/29, v1.4n , from \xpackage{classes}: |
| 642 |
% \url{https://www.ctan.org/pkg/classes} |
| 643 |
% |
| 644 |
% \item[-] package \xpackage{romanbar}, 2025-01-28, v1.0g, |
| 645 |
% \url{https://www.ctan.org/pkg/romanbar} |
| 646 |
% (Well, it is the example file for this package, and because you are reading the |
| 647 |
% documentation for the \xpackage{romanbar} package, it can be assumed that you already |
| 648 |
% have some version of it -- is it the current one?) |
| 649 |
% \end{description} |
| 650 |
% |
| 651 |
% \DescribeMacro{Oberdiek} |
| 652 |
% \DescribeMacro{holtxdoc} |
| 653 |
% All packages of \textsc{Heiko Oberdiek's} bundle `oberdiek' |
| 654 |
% (especially \xpackage{holtxdoc}) are also available in a TDS compliant ZIP archive:\newline |
| 655 |
% \url{https://mirrors.ctan.org/macros/latex/contrib/oberdiek.zip}.\newline |
| 656 |
% It is probably best to download and use this, because the packages in there |
| 657 |
% are quite probably both recent and compatible among themselves.\bigskip |
| 658 |
% |
| 659 |
% \DescribeMacro{hyperref} |
| 660 |
% \noindent \xpackage{hyperref} is not included in that bundle and needs to be |
| 661 |
% downloaded separately,\newline |
| 662 |
% \url{https://mirrors.ctan.org/macros/latex/contrib/hyperref.zip}.\bigskip |
| 663 |
% |
| 664 |
% \DescribeMacro{Münch} |
| 665 |
% A hyperlinked list of my (other) packages can be found at |
| 666 |
% \url{https://www.ctan.org/author/muench-hm}. |
| 667 |
% |
| 668 |
% \subsection{Package, unpacking TDS} |
| 669 |
% \paragraph{Package.} This package is available on CTAN: |
| 670 |
% \begin{description} |
| 671 |
% \item[\url{http://mirrors.ctan.org/macros/latex/contrib/romanbar/romanbar.dtx}]\hspace*{0.1cm} \newline |
| 672 |
% The source file. |
| 673 |
% \item[\url{http://mirrors.ctan.org/macros/latex/contrib/romanbar/romanbar.pdf}]\hspace*{0.1cm} \newline |
| 674 |
% The documentation. |
| 675 |
% \item[\url{http://mirrors.ctan.org/macros/latex/contrib/romanbar/romanbar-example.pdf}]\hspace*{0.1cm} \newline |
| 676 |
% The compiled example file, as it should look like. |
| 677 |
% \item[\url{http://mirrors.ctan.org/macros/latex/contrib/romanbar/README}]\hspace*{0.1cm} \newline |
| 678 |
% The README file. |
| 679 |
% \end{description} |
| 680 |
% There is also a romanbar.tds.zip available: |
| 681 |
% \begin{description} |
| 682 |
% \item[\url{https://mirrors.ctan.org/install/macros/latex/contrib/romanbar.tds.zip}]\hspace*{0.1cm} \newline |
| 683 |
% Everything in \xfile{TDS} compliant, compiled format. |
| 684 |
% \end{description} |
| 685 |
% which additionally contains\newline |
| 686 |
% \begin{tabular}{ll} |
| 687 |
% romanbar.ins & The installation file.\\ |
| 688 |
% romanbar.drv & The driver to generate the documentation.\\ |
| 689 |
% romanbar.sty & The \xext{sty}le file.\\ |
| 690 |
% romanbar-example.tex & The example file. |
| 691 |
% \end{tabular} |
| 692 |
% |
| 693 |
% \bigskip |
| 694 |
% |
| 695 |
% \noindent For required other packages, please see the preceding subsection. |
| 696 |
% |
| 697 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 698 |
% \docstrip{} archive. The files are extracted by running the |
| 699 |
% \xext{.dtx} through \plainTeX{}: |
| 700 |
% \begin{quote} |
| 701 |
% \verb|tex romanbar.dtx| |
| 702 |
% \end{quote} |
| 703 |
% |
| 704 |
% About generating the documentation see paragraph~\ref{GenDoc} below.\bigskip |
| 705 |
% |
| 706 |
% \paragraph{TDS.} Now the different files must be moved into |
| 707 |
% the different directories in your installation TDS tree |
| 708 |
% (also known as \xfile{texmf} tree): |
| 709 |
% \begin{quote} |
| 710 |
% \def\t{^^A |
| 711 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 712 |
% romanbar.sty & tex/latex/romanbar/romanbar.sty\\ |
| 713 |
% romanbar.pdf & doc/latex/romanbar/romanbar.pdf\\ |
| 714 |
% romanbar-example.tex & doc/latex/romanbar/romanbar-example.tex\\ |
| 715 |
% romanbar-example.pdf & doc/latex/romanbar/romanbar-example.pdf\\ |
| 716 |
% romanbar.dtx & source/latex/romanbar/romanbar.dtx |
| 717 |
% \end{tabular}^^A |
| 718 |
% }^^A |
| 719 |
% \sbox0{\t}^^A |
| 720 |
% \ifdim\wd0>\linewidth |
| 721 |
% \begingroup |
| 722 |
% \advance\linewidth by\leftmargin |
| 723 |
% \advance\linewidth by\rightmargin |
| 724 |
% \edef\x{\endgroup |
| 725 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 726 |
% }\x |
| 727 |
% \def\lwbox{^^A |
| 728 |
% \leavevmode |
| 729 |
% \hbox to \linewidth{^^A |
| 730 |
% \kern-\leftmargin\relax |
| 731 |
% \hss |
| 732 |
% \usebox0 |
| 733 |
% \hss |
| 734 |
% \kern-\rightmargin\relax |
| 735 |
% }^^A |
| 736 |
% }^^A |
| 737 |
% \ifdim\wd0>\lw |
| 738 |
% \sbox0{\small\t}^^A |
| 739 |
% \ifdim\wd0>\linewidth |
| 740 |
% \ifdim\wd0>\lw |
| 741 |
% \sbox0{\footnotesize\t}^^A |
| 742 |
% \ifdim\wd0>\linewidth |
| 743 |
% \ifdim\wd0>\lw |
| 744 |
% \sbox0{\scriptsize\t}^^A |
| 745 |
% \ifdim\wd0>\linewidth |
| 746 |
% \ifdim\wd0>\lw |
| 747 |
% \sbox0{\tiny\t}^^A |
| 748 |
% \ifdim\wd0>\linewidth |
| 749 |
% \lwbox |
| 750 |
% \else |
| 751 |
% \usebox0 |
| 752 |
% \fi |
| 753 |
% \else |
| 754 |
% \lwbox |
| 755 |
% \fi |
| 756 |
% \else |
| 757 |
% \usebox0 |
| 758 |
% \fi |
| 759 |
% \else |
| 760 |
% \lwbox |
| 761 |
% \fi |
| 762 |
% \else |
| 763 |
% \usebox0 |
| 764 |
% \fi |
| 765 |
% \else |
| 766 |
% \lwbox |
| 767 |
% \fi |
| 768 |
% \else |
| 769 |
% \usebox0 |
| 770 |
% \fi |
| 771 |
% \else |
| 772 |
% \lwbox |
| 773 |
% \fi |
| 774 |
% \else |
| 775 |
% \usebox0 |
| 776 |
% \fi |
| 777 |
% \end{quote} |
| 778 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 779 |
% TDS installing feature, then some files can already be in the right |
| 780 |
% place, see the documentation of \docstrip{}. |
| 781 |
% |
| 782 |
% \subsection{Refresh file name databases} |
| 783 |
% |
| 784 |
% If your \TeX~distribution (\TeX\,Live, \mikTeX, \dots) relies on |
| 785 |
% file name databases, you must refresh these. For example, \TeX\,Live\ users |
| 786 |
% run \verb|texhash| or \verb|mktexlsr|. |
| 787 |
% |
| 788 |
% \subsection{Some details for the interested} |
| 789 |
% |
| 790 |
% \paragraph{Unpacking with \LaTeX{}.} |
| 791 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 792 |
% \begin{description} |
| 793 |
% \item[\plainTeX:] Run \docstrip{} and extract the files. |
| 794 |
% \item[\LaTeX:] Generate the documentation. |
| 795 |
% \end{description} |
| 796 |
% If you insist on using \LaTeX{} for \docstrip{} (really, |
| 797 |
% \docstrip{} does not need \LaTeX ), then inform the autodetect routine |
| 798 |
% about your intention: |
| 799 |
% \begin{quote} |
| 800 |
% \verb|latex \let\install=y\input{romanbar.dtx}| |
| 801 |
% \end{quote} |
| 802 |
% Do not forget to quote the argument according to the demands |
| 803 |
% of your shell. |
| 804 |
% |
| 805 |
% \paragraph{Generating the documentation.\label{GenDoc}} |
| 806 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 807 |
% the documentation. The process can be configured by a |
| 808 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put the following |
| 809 |
% line into this file, if you want to have A4 as paper format: |
| 810 |
% \begin{quote} |
| 811 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 812 |
% \end{quote} |
| 813 |
% |
| 814 |
% \noindent An example follows how to generate the |
| 815 |
% documentation with \pdfLaTeX : |
| 816 |
% |
| 817 |
% \begin{quote} |
| 818 |
%\begin{verbatim} |
| 819 |
%pdflatex romanbar.dtx |
| 820 |
%makeindex -s gind.ist romanbar.idx |
| 821 |
%pdflatex romanbar.dtx |
| 822 |
%makeindex -s gind.ist romanbar.idx |
| 823 |
%pdflatex romanbar.dtx |
| 824 |
%\end{verbatim} |
| 825 |
% \end{quote} |
| 826 |
% |
| 827 |
% \subsection{Compiling the example} |
| 828 |
% |
| 829 |
% The example file, \textsf{romanbar-example.tex}, can be compiled via\newline |
| 830 |
% |(pdf)latex romanbar-example.tex|. |
| 831 |
% |
| 832 |
% \section{Acknowledgements} |
| 833 |
% |
| 834 |
% I would like to thank Prof.~\textsc{Enrico Gregorio} (egreg) for his answer |
| 835 |
% at \url{https://tex.stackexchange.com/a/24084} and |
| 836 |
% \textsc{Heiko Oberdiek} for providing a lot of useful packages (from which |
| 837 |
% I also got everything I know about creating a file in \xext{dtx} format, OK, say it: copying). |
| 838 |
% |
| 839 |
% \phantomsection |
| 840 |
% \begin{History}\label{History} |
| 841 |
% \begin{Version}{2011/07/25 v1.0a} |
| 842 |
% \item First code by Prof.~\textsc{Enrico Gregorio} (egreg) at |
| 843 |
% \url{https://tex.stackexchange.com/a/24084} |
| 844 |
% \end{Version} |
| 845 |
% \begin{Version}{2011/07/26 v1.0b} |
| 846 |
% \item Packed into a \xext{sty} file. |
| 847 |
% \item Removed the requirement of \eTeX{} for the package. |
| 848 |
% \end{Version} |
| 849 |
% \begin{Version}{2011/08/25 v1.0c} |
| 850 |
% \item Renamed \xpackage{romanbar} package. |
| 851 |
% \item Minor details. |
| 852 |
% \end{Version} |
| 853 |
% \begin{Version}{2011/09/16 v1.0d} |
| 854 |
% \item Made commands robust. |
| 855 |
% \item Minor details. |
| 856 |
% \end{Version} |
| 857 |
% \begin{Version}{2011/12/16 v1.0e} |
| 858 |
% \item Additionally accepts now Arabic numbers and converts them to Roman ones with bars. |
| 859 |
% \item Also non-positive numbers are now accepted. |
| 860 |
% \end{Version} |
| 861 |
% \begin{Version}{2012/01/01 v1.0f} |
| 862 |
% \item Added |\romannum| and |\Romannum| to convert Arabic to Roman numbers (without bars). |
| 863 |
% \item |\r@iseL|. |
| 864 |
% \item Created a \xfile{dtx}, example, and README. |
| 865 |
% \item Uploaded to CTAN. |
| 866 |
% \end{Version} |
| 867 |
% \begin{Version}{2025-01-28 v1.0g} |
| 868 |
% \item Converted to UTF-8. |
| 869 |
% \item Updated to \LaTeX{} format 2024-11-01. |
| 870 |
% \item Documentation updates. |
| 871 |
% \item Using the \xpackage{trimclip} package for improved handling |
| 872 |
% \hbox{of \textquotedblleft L\textquotedblright .} |
| 873 |
% \item Again using \eTeX{} for the package. Version~1.0b removed the requirement |
| 874 |
% of \eTeX{} for this package. Now it is 2025 and \eTeX{} can be assumed standard. |
| 875 |
% Therefore \eTeX{} is used for this package. Also own counters and |
| 876 |
% own dimens instead of scratch ones are used now. |
| 877 |
% \end{Version} |
| 878 |
% \end{History} |
| 879 |
% \bigskip |
| 880 |
% |
| 881 |
% When you find a mistake or have a suggestion for an improvement of this package, |
| 882 |
% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.) |
| 883 |
% |
| 884 |
% \PrintIndex |
| 885 |
% |
| 886 |
% \Finale |
| 887 |
\endinput |