summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/vertbars/vertbars.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/vertbars/vertbars.sty')
-rw-r--r--macros/latex/contrib/vertbars/vertbars.sty60
1 files changed, 60 insertions, 0 deletions
diff --git a/macros/latex/contrib/vertbars/vertbars.sty b/macros/latex/contrib/vertbars/vertbars.sty
new file mode 100644
index 0000000000..9b24d20496
--- /dev/null
+++ b/macros/latex/contrib/vertbars/vertbars.sty
@@ -0,0 +1,60 @@
+%%%%%%%%%1%%%%%%%%%2%%%%%%%%%3%%%%%%%%%4%%%%%%%%%5
+%% Bundled source file for the VERTBARS package
+%%-------1---------2---------3---------4---------5
+%% Please see the accompanying README for author,
+%% license, documentation and installation information
+%%%%%%%%%1%%%%%%%%%2%%%%%%%%%3%%%%%%%%%4%%%%%%%%%5
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{vertbars}[2018/12/16 v1.0c vertical bars in the margin]
+
+\newcommand{\LNenv}{runninglinenumbers}
+\DeclareOption{switch}{%
+ \renewcommand{\LNenv}{runningpagewiselinenumbers}
+ \PassOptionsToPackage{\CurrentOption}{lineno}
+}
+
+\DeclareOption{switch*}{%
+ \renewcommand{\LNenv}{runningpagewiselinenumbers}
+ \PassOptionsToPackage{\CurrentOption}{lineno}
+}
+
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{lineno}}
+\ProcessOptions\relax
+\RequirePackage{lineno}
+
+% Code to add stuff at start and end of a pre-existing zero argument macro:
+\newcommand{\addtodef}[3]{\begingroup
+ \@temptokena{#2}%
+ \toks@\expandafter{#1#3}%
+ \edef\x{\endgroup
+ \def\noexpand#1{\the\@temptokena \the\toks@}}%
+ \x
+}
+
+% It's useful to preserve \cmd\baselineskip:
+\newlength{\pwvbbl}
+\setlength{\pwvbbl}{\baselineskip}
+
+% Width of bars:
+\newlength{\barwidth}
+\setlength{\barwidth}{0.4pt}
+
+% Horizontal space between bars:
+\newlength{\barspace}
+\setlength{\barspace}{0.5\linenumbersep}
+
+\newcommand{\addtomakeLNL}{{\rule[-0.25\pwvbbl]{\barwidth}{1.1\pwvbbl}\hskip\barspace\relax}}
+\newcommand{\pwvbLNL}{}
+
+\newenvironment{vertbar}{%
+ \par
+ \pagewiselinenumbers
+ \begin{\LNenv}%
+ \addtodef{\pwvbLNL}{}{\addtomakeLNL}%
+ \let\LineNumber\pwvbLNL
+}{%
+ \end{\LNenv}%
+ \par
+}
+