summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fgruler
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-06-25 20:22:32 +0000
committerKarl Berry <karl@freefriends.org>2022-06-25 20:22:32 +0000
commitcf70129a8ef1242754986008823499a035937a63 (patch)
treedd7992c1b5ccb02e85e886a59adee5aaa49082e6 /Master/texmf-dist/tex/latex/fgruler
parentf44f1f1e886253cffeed0a04c805e37c263d9089 (diff)
fgruler (25jun22)
git-svn-id: svn://tug.org/texlive/trunk@63721 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/fgruler')
-rw-r--r--Master/texmf-dist/tex/latex/fgruler/fgruler.sty205
1 files changed, 158 insertions, 47 deletions
diff --git a/Master/texmf-dist/tex/latex/fgruler/fgruler.sty b/Master/texmf-dist/tex/latex/fgruler/fgruler.sty
index d1f6abfda0f..7bf126ee923 100644
--- a/Master/texmf-dist/tex/latex/fgruler/fgruler.sty
+++ b/Master/texmf-dist/tex/latex/fgruler/fgruler.sty
@@ -22,7 +22,7 @@
%% The Current Maintainer of this work is Tibor Tomacs.
%%
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesPackage{fgruler}[2022/06/19 v1.4 Package for drawing rulers on the foreground or in the text]
+\ProvidesPackage{fgruler}[2022/06/25 v1.5 Package for drawing rulers on the foreground or in the text]
%%
\@ifpackageloaded{kvoptions}{}{\RequirePackage{kvoptions}}
\@ifpackageloaded{etoolbox}{}{\RequirePackage{etoolbox}}
@@ -55,9 +55,17 @@
\setlength{\fgruler@sep}{#5}%
\def\fgruler@font@{\normalfont\normalsize\fgruler@font}%
\addtolength{\fgruler@sep}{\fgruler@marklth}%
-\ifx\thefgrulernum\@empty\setlength{\fgruler@width}{\fgruler@marklth}\else%
-\settoheight{\fgruler@width}{\fgruler@font@\thefgrulernum}%
-\addtolength{\fgruler@width}{\fgruler@sep}\fi}
+\ifx\thefgrulernum\@empty%
+ \expandafter\ifx\csname fgruler@caption@\fgruler@unit\endcsname\@empty%
+ \setlength{\fgruler@width}{\fgruler@marklth}%
+ \else
+ \settoheight{\fgruler@width}{\fgruler@font@\csname fgruler@caption@\fgruler@unit\endcsname}%
+ \addtolength{\fgruler@width}{\fgruler@sep}%
+ \fi
+\else
+ \settoheight{\fgruler@width}{\fgruler@font@\thefgrulernum}%
+ \addtolength{\fgruler@width}{\fgruler@sep}%
+\fi}
\def\rulerparams#1#2#3#4#5{%
\ifx#1\@empty\else\def\fgruler@markthick@{#1}\fi%
@@ -79,31 +87,35 @@
\fgruler@set{\fgruler@markthick@}{\fgruler@numfont@}{\fgruler@color@}{\fgruler@marklength@}{\fgruler@numsep@}}
\def\fgruler@activate@type{%
+\def\fgruler@output{}%
\def\fgruler@check{cm}\ifx\fgruler@unit\fgruler@check\else%
\def\fgruler@check{in}\ifx\fgruler@unit\fgruler@check\else%
\PackageError{fgruler}{\fgruler@unit\space is invalid unit}{Valid units: cm, in}%
\fi\fi%
-\def\fgruler@check{upperleft}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{upperright}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{lowerleft}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{lowerright}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{upperleftT}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{upperrightT}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{lowerleftT}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{lowerrightT}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{alledges}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{alledges*}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{alledgesT}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{alledgesT*}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{none}\ifx\fgruler@type\fgruler@check\else%
-\def\fgruler@check{user}\ifx\fgruler@type\fgruler@check\else%
-\PackageError{fgruler}{\fgruler@type\space is invalid type}%
+\def\do##1{%
+\expandafter\def\expandafter\fgruler@type@item\expandafter{##1}%
+\def\fgruler@check{upperleft}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{upperright}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{lowerleft}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{lowerright}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{upperleftT}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{upperrightT}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{lowerleftT}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{lowerrightT}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{alledges}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{alledges*}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{alledgesT}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{alledgesT*}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{none}\ifx\fgruler@type@item\fgruler@check\else%
+\def\fgruler@check{user}\ifx\fgruler@type@item\fgruler@check\else%
+\PackageError{fgruler}{\fgruler@type@item\space is invalid type}%
{Valid types:\MessageBreak
upperleft, upperright, lowerleft, lowerright,\MessageBreak
upperleftT, upperrightT, lowerleftT, lowerrightT,\MessageBreak
alledges, alledges*, alledgesT, alledgesT*, user, none}%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
-\def\fgruler@output{\csname fgruler@\fgruler@unit @\fgruler@type @fg\endcsname}}
+\g@addto@macro\fgruler@output{\csname fgruler@\fgruler@unit @##1@fg\endcsname}}%
+\expandafter\docsvlist\expandafter{\fgruler@type}}
\def\fgrulerratiocm#1#2{%
\ifx#1\@empty\else\def\fgruler@cm@ratio@i{#1}\fi%
@@ -180,12 +192,12 @@ alledges, alledges*, alledgesT, alledgesT*, user, none}%
\@tempcnta\fgruler@tempdima\advance\@tempcnta\@ne}
\def\fgruler@check@param#1#2{%
-\def\fgruler@param{#1}%
+\expandafter\def\expandafter\fgruler@param\expandafter{#1}%
\def\fgruler@check{cm}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{in}\ifx\fgruler@param\fgruler@check\else%
\PackageError{fgruler}{\fgruler@param\space is invalid parameter}{Valid parameters: cm, in}%
\fi\fi%
-\def\fgruler@param{#2}%
+\expandafter\def\expandafter\fgruler@param\expandafter{#2}%
\def\fgruler@check{rightdown}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{rightup}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{leftdown}\ifx\fgruler@param\fgruler@check\else%
@@ -194,19 +206,21 @@ alledges, alledges*, alledgesT, alledgesT*, user, none}%
\def\fgruler@check{downleft}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{upright}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{upleft}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{taperight}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{tapeleft}\ifx\fgruler@param\fgruler@check\else%
\PackageError{fgruler}{\fgruler@param\space is invalid parameter}%
{Valid parameters:\MessageBreak
rightdown, rightup, leftdown, leftup,\MessageBreak
-downright, downleft, upright, upleft}%
-\fi\fi\fi\fi\fi\fi\fi\fi}
+downright, downleft, upright, upleft, taperight, tapeleft}%
+\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\def\fgruler@check@param@#1#2{%
-\def\fgruler@param{#1}%
+\expandafter\def\expandafter\fgruler@param\expandafter{#1}%
\def\fgruler@check{cm}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{in}\ifx\fgruler@param\fgruler@check\else%
\PackageError{fgruler}{\fgruler@param\space is invalid parameter}{Valid parameters: cm, in}%
\fi\fi%
-\def\fgruler@param{#2}%
+\expandafter\def\expandafter\fgruler@param\expandafter{#2}%
\def\fgruler@check{upperleft}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{upperright}\ifx\fgruler@param\fgruler@check\else%
\def\fgruler@check{lowerleft}\ifx\fgruler@param\fgruler@check\else%
@@ -216,6 +230,33 @@ downright, downleft, upright, upleft}%
upperleft, upperright, lowerleft, lowerright}%
\fi\fi\fi\fi}
+\def\fgruler@check@param@@#1#2{%
+\expandafter\def\expandafter\fgruler@param\expandafter{#1}%
+\def\fgruler@check{cm}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{in}\ifx\fgruler@param\fgruler@check\else%
+\PackageError{fgruler}{\fgruler@param\space is invalid parameter}{Valid parameters: cm, in}%
+\fi\fi%
+\expandafter\def\expandafter\fgruler@param\expandafter{#2}%
+\def\fgruler@check{upperleft}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{upperright}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{lowerleft}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{lowerright}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{upperleftT}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{upperrightT}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{lowerleftT}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{lowerrightT}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{alledges}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{alledges*}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{alledgesT}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{alledgesT*}\ifx\fgruler@param\fgruler@check\else%
+\def\fgruler@check{user}\ifx\fgruler@param\fgruler@check\else%
+\PackageError{fgruler}{\fgruler@param\space is invalid type}%
+{Valid types:\MessageBreak
+upperleft, upperright, lowerleft, lowerright,\MessageBreak
+upperleftT, upperrightT, lowerleftT, lowerrightT,\MessageBreak
+alledges, alledges*, alledgesT, alledgesT*, user}%
+\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+
\newcommand{\fgruler@ruler}[3][cm]{\fgruler@check@param{#1}{#2}\fgruler@intextsetting\csname fgruler@#1@#2@\endcsname{#3}}
\newcommand{\fgruler@ruler@}[3][cm]{\fgruler@check@param{#1}{#2}\fgruler@intextsetting\csname fgruler@#1@#2@@\endcsname{#3}}
\def\ruler{\@ifstar{\fgruler@ruler@}{\fgruler@ruler}}
@@ -224,7 +265,9 @@ upperleft, upperright, lowerleft, lowerright}%
\newcommand{\fgruler@squareruler@}[4][cm]{\fgruler@check@param@{#1}{#2}\fgruler@intextsetting\csname fgruler@#1@#2@@\endcsname{#3}{#4}}
\def\squareruler{\@ifstar{\fgruler@squareruler@}{\fgruler@squareruler}}
-\newcommand{\fgruler}[4][cm]{\fgruler@check@param@{#1}{#2}\g@addto@macro\fgruler@output@{\csname fgruler@#1@#2@fg@\endcsname{#3}{#4}}}
+\newcommand{\fgruler@fgruler}[4][\fgruler@unit]{\fgruler@check@param@{#1}{#2}\g@addto@macro\fgruler@output@{\csname fgruler@#1@#2@fg@\endcsname{#3}{#4}}}
+\newcommand{\fgruler@fgruler@}[2][]{\g@addto@macro\fgruler@output@{{\setkeys{fgruler}{#1}\fgruler@check@param@@{\fgruler@unit}{#2}\csname fgruler@\fgruler@unit @#2@fg\endcsname}}}
+\def\fgruler{\@ifstar{\fgruler@fgruler@}{\fgruler@fgruler}}
\def\fgrulercaptioncm#1{\def\fgruler@caption@cm{#1}\ignorespaces}
\def\fgruler@caption@cm{cm}
@@ -315,6 +358,7 @@ upperleft, upperright, lowerleft, lowerright}%
\def\fgruler@startnumv{0}%
\fgruler@borderlinetrue%
\fgruler@showframefalse%
+\def\fgruler@output{\csname fgruler@\fgruler@unit @\fgruler@type @fg\endcsname}%
\else\PackageError{fgruler}{Don't use \protect\fgrulerreset\space in preamble!}{}\fi%
\ignorespaces}
@@ -327,7 +371,8 @@ upperleft, upperright, lowerleft, lowerright}%
\iffgruler@nonefgrulers
-\renewcommand{\fgruler}[4][]{}
+\renewcommand{\fgruler@fgruler}[4][]{}
+\renewcommand{\fgruler@fgruler@}[2][]{}
\else
@@ -401,7 +446,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(5,0){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(0,-1){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(10,0){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(0,-1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(1,0){#1}}\fi%
+\iffgruler@borderline\put(-\@halfwidth,0){\line(1,0){#1+\@wholewidth}}\fi% \@wholewidth is current line thickness and \@halfwidth = 0.5\@wholewidth (see in latex.ltx)
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(10,-\fgruler@sep)(10,0){\fgruler@tempdima}{\makebox(0,0)[t]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -434,7 +479,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(8,0){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(0,-1){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(16,0){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(0,-1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(1,0){#1}}\fi%
+\iffgruler@borderline\put(-\@halfwidth,0){\line(1,0){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(16,-\fgruler@sep)(16,0){\fgruler@tempdima}{\makebox(0,0)[t]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -461,7 +506,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(5,0){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(0,1){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(10,0){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(0,1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(1,0){#1}}\fi%
+\iffgruler@borderline\put(-\@halfwidth,0){\line(1,0){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(10,\fgruler@sep)(10,0){\fgruler@tempdima}{\makebox(0,0)[b]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -494,7 +539,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(8,0){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(0,1){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(16,0){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(0,1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(1,0){#1}}\fi%
+\iffgruler@borderline\put(-\@halfwidth,0){\line(1,0){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(16,\fgruler@sep)(16,0){\fgruler@tempdima}{\makebox(0,0)[b]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -521,7 +566,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(-5,0){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(0,-1){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(-10,0){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(0,-1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(-1,0){#1}}\fi%
+\iffgruler@borderline\put(\@halfwidth,0){\line(-1,0){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(-10,-\fgruler@sep)(-10,0){\fgruler@tempdima}{\makebox(0,0)[t]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -554,7 +599,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(-8,0){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(0,-1){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(-16,0){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(0,-1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(-1,0){#1}}\fi%
+\iffgruler@borderline\put(\@halfwidth,0){\line(-1,0){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(-16,-\fgruler@sep)(-16,0){\fgruler@tempdima}{\makebox(0,0)[t]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -581,7 +626,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(-5,0){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(0,1){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(-10,0){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(0,1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(-1,0){#1}}\fi%
+\iffgruler@borderline\put(\@halfwidth,0){\line(-1,0){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(-10,\fgruler@sep)(-10,0){\fgruler@tempdima}{\makebox(0,0)[b]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -614,7 +659,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(-8,0){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(0,1){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(-16,0){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(0,1){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(-1,0){#1}}\fi%
+\iffgruler@borderline\put(\@halfwidth,0){\line(-1,0){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumh}\stepcounter{fgrulernum}%
\multiput(-16,\fgruler@sep)(-16,0){\fgruler@tempdima}{\makebox(0,0)[b]{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}
@@ -641,7 +686,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,-5){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(1,0){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(0,-10){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,-1){#1}}\fi%
+\iffgruler@borderline\put(0,\@halfwidth){\line(0,-1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(\fgruler@sep,-10)(0,-10){\fgruler@tempdima}{\makebox(0,0)[l]{\fgruler@rotatebox{90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -674,7 +719,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,-8){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(1,0){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(0,-16){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,-1){#1}}\fi%
+\iffgruler@borderline\put(0,\@halfwidth){\line(0,-1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(\fgruler@sep,-16)(0,-16){\fgruler@tempdima}{\makebox(0,0)[l]{\fgruler@rotatebox{90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -701,7 +746,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,-5){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(-1,0){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(0,-10){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(-1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,-1){#1}}\fi%
+\iffgruler@borderline\put(0,\@halfwidth){\line(0,-1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(-\fgruler@sep,-10)(0,-10){\fgruler@tempdima}{\makebox(0,0)[r]{\fgruler@rotatebox{-90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -734,7 +779,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,-8){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(-1,0){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(0,-16){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(-1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,-1){#1}}\fi%
+\iffgruler@borderline\put(0,\@halfwidth){\line(0,-1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(-\fgruler@sep,-16)(0,-16){\fgruler@tempdima}{\makebox(0,0)[r]{\fgruler@rotatebox{-90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -761,7 +806,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,5){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(1,0){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(0,10){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,1){#1}}\fi%
+\iffgruler@borderline\put(0,-\@halfwidth){\line(0,1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(\fgruler@sep,10)(0,10){\fgruler@tempdima}{\makebox(0,0)[l]{\fgruler@rotatebox{90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -794,7 +839,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,8){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(1,0){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(0,16){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,1){#1}}\fi%
+\iffgruler@borderline\put(0,-\@halfwidth){\line(0,1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(\fgruler@sep,16)(0,16){\fgruler@tempdima}{\makebox(0,0)[l]{\fgruler@rotatebox{90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -821,7 +866,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,5){\@tempcnta}{\fgruler@ifodd{\fgruler@cm@thick@ii\fgruler@cm@color@ii\line(-1,0){\fgruler@cm@ratio@ii\fgruler@marklth}}}%
\fgruler@div{#1}{10}%
\multiput(0,0)(0,10){\@tempcnta}{\fgruler@cm@thick@iii\fgruler@cm@color@iii\line(-1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,1){#1}}\fi%
+\iffgruler@borderline\put(0,-\@halfwidth){\line(0,1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(-\fgruler@sep,10)(0,10){\fgruler@tempdima}{\makebox(0,0)[r]{\fgruler@rotatebox{-90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -854,7 +899,7 @@ upperleft, upperright, lowerleft, lowerright}%
\multiput(0,0)(0,8){\@tempcnta}{\fgruler@ifodd{\fgruler@in@thick@iv\fgruler@in@color@iv\line(-1,0){\fgruler@in@ratio@iv\fgruler@marklth}}}%
\fgruler@div{#1}{16}%
\multiput(0,0)(0,16){\@tempcnta}{\fgruler@in@thick@v\fgruler@in@color@v\line(-1,0){\fgruler@marklth}}%
-\iffgruler@borderline\put(0,0){\line(0,1){#1}}\fi%
+\iffgruler@borderline\put(0,-\@halfwidth){\line(0,1){#1+\@wholewidth}}\fi%
\setcounter{fgrulernum}{\fgruler@startnumv}\stepcounter{fgrulernum}%
\multiput(-\fgruler@sep,16)(0,16){\fgruler@tempdima}{\makebox(0,0)[r]{\fgruler@rotatebox{-90}{\fgruler@font@\thefgrulernum\stepcounter{fgrulernum}}}}}
@@ -869,6 +914,66 @@ upperleft, upperright, lowerleft, lowerright}%
\def\fgruler@in@upleft@@#1{\leavevmode\hbox{}\lower#1\hbox{\fgruler@in@upleft@{#1}}}
+%% TAPERIGHT CM
+\def\fgruler@cm@taperight@#1{%
+\setlength{\unitlength}{1mm}%
+\begin{picture}(#1,\fgruler@width+\fgruler@sep)%
+\fgruler@cm@rightup{#1}%
+\setcounter{fgrulernum}{\fgruler@startnumh}%
+\put(0,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\thefgrulernum}}%
+\ifdim#1>.5cm\put(5,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\fgruler@caption@cm}}\fi%
+\def\thefgrulernum{}%
+\put(0,\fgruler@width+\fgruler@sep){\fgruler@cm@rightdown{#1}}%
+\end{picture}}
+
+\def\fgruler@cm@taperight@@#1{\leavevmode\hbox{}\lower\dimexpr
+\fgruler@width+\fgruler@sep\relax\hbox{\fgruler@cm@taperight@{#1}}}
+
+%% TAPERIGHT IN
+\def\fgruler@in@taperight@#1{%
+\setlength{\unitlength}{.0625in}%
+\begin{picture}(#1,\fgruler@width+\fgruler@sep)%
+\fgruler@in@rightup{#1}%
+\setcounter{fgrulernum}{\fgruler@startnumh}%
+\put(0,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\thefgrulernum}}%
+\ifdim#1>.5in\put(8,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\fgruler@caption@in}}\fi%
+\def\thefgrulernum{}%
+\put(0,\fgruler@width+\fgruler@sep){\fgruler@in@rightdown{#1}}%
+\end{picture}}
+
+\def\fgruler@in@taperight@@#1{\leavevmode\hbox{}\lower\dimexpr
+\fgruler@width+\fgruler@sep\relax\hbox{\fgruler@in@taperight@{#1}}}
+
+%% TAPELEFT CM
+\def\fgruler@cm@tapeleft@#1{%
+\setlength{\unitlength}{1mm}%
+\begin{picture}(#1,\fgruler@width+\fgruler@sep)(-#1,0)%
+\fgruler@cm@leftup{#1}%
+\setcounter{fgrulernum}{\fgruler@startnumh}%
+\put(0,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\thefgrulernum}}%
+\ifdim#1>.5cm\put(-5,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\fgruler@caption@cm}}\fi%
+\def\thefgrulernum{}%
+\put(0,\fgruler@width+\fgruler@sep){\fgruler@cm@leftdown{#1}}%
+\end{picture}}
+
+\def\fgruler@cm@tapeleft@@#1{\leavevmode\hbox{}\lower\dimexpr
+\fgruler@width+\fgruler@sep\relax\hbox{\fgruler@cm@tapeleft@{#1}}}
+
+%% TAPELEFT IN
+\def\fgruler@in@tapeleft@#1{%
+\setlength{\unitlength}{.0625in}%
+\begin{picture}(#1,\fgruler@width+\fgruler@sep)(-#1,0)%
+\fgruler@in@leftup{#1}%
+\setcounter{fgrulernum}{\fgruler@startnumh}%
+\put(0,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\thefgrulernum}}%
+\ifdim#1>.5in\put(-8,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\fgruler@caption@in}}\fi%
+\def\thefgrulernum{}%
+\put(0,\fgruler@width+\fgruler@sep){\fgruler@in@leftdown{#1}}%
+\end{picture}}
+
+\def\fgruler@in@tapeleft@@#1{\leavevmode\hbox{}\lower\dimexpr
+\fgruler@width+\fgruler@sep\relax\hbox{\fgruler@in@tapeleft@{#1}}}
+
%% UPPERLEFT CM
\def\fgruler@cm@upperleft@#1#2{%
\setlength{\unitlength}{1mm}%
@@ -1262,7 +1367,7 @@ upperleft, upperright, lowerleft, lowerright}%
\fgruler@in@downleft{\textheight}%
\put(0,-\textheight){\fgruler@in@rightdown{\textwidth}}
\put(\textwidth,0){\fgruler@in@downright{\textheight}}
-\put(5,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\fgruler@caption@in}}%
+\put(8,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\fgruler@caption@in}}%
\setcounter{fgrulernum}{\fgruler@startnumh}%
\put(0,\fgruler@sep){\makebox(0,0)[b]{\fgruler@font@\thefgrulernum}}%
\put(0,-\textheight-\fgruler@sep){\makebox(0,0)[t]{\fgruler@font@\thefgrulernum}}%
@@ -1313,8 +1418,14 @@ upperleft, upperright, lowerleft, lowerright}%
\def\fgruler@cm@user@fg{}
\def\fgruler@in@user@fg{}
\def\fgrulertype#1#2{\csname fgruler@#1@#2@fg\endcsname}
-\def\fgrulerdefusercm#1{\def\fgruler@cm@user@fg{#1}}
-\def\fgrulerdefuserin#1{\def\fgruler@in@user@fg{#1}}
+
+\def\fgrulerdefusercm#1{\def\fgruler@cm@user@fg{#1}} % for old versions
+\def\fgrulerdefuserin#1{\def\fgruler@in@user@fg{#1}} % for old versions
+
+\def\fgrulerdefuser#1{%
+\expandafter\def\expandafter\fgrulerunit\expandafter{\fgruler@unit}%
+\@namedef{fgruler@\fgruler@unit @user@fg}{#1}}
+
\endinput
%%
%% End of file `fgruler.sty'.