blob: 95a619f03daf2866d42686306ac7a7765508c021 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
%%
%% This is file `crbox.sty',
%%
%% __________________________________
%% Copyright © 2011–2013 Persian TeX Group
%%
%% License information appended.
%%
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{crbox}[2013/04/04 typesetting boxes with crossing lines in the four corners]
\RequirePackage{biditools}
\newif\ifcurved
\newif\ifhollowcurved
\newdimen\length@corner@paper \length@corner@paper1cm
\newdimen\thickness@corner@paper \thickness@corner@paper0.4pt
\newcommand\crbox[1][]{\def\@tempa{#1}%
\ifx\@tempa\@void \toks@{}\else
\toks@\expandafter{\csname#1true\endcsname}\fi
\edef\option@cr{\noexpand\curvedfalse\noexpand\hollowcurvedfalse\the\toks@}%
\leavevmode\@crbox}
\let\option@cr\@void
\bidi@AtEndPreamble{%
\@ifpackageloaded{bidi}{%
\def\@crbox#1{\vbox{\setbox\tw@\vbox{\vskip\fboxsep
\hbox{\hskip\fboxsep\hbox{#1}\hskip\fboxsep}%
\vskip\fboxsep}\offinterlineskip%
\dimen@\thickness@corner@paper \@tempdima\length@corner@paper
\option@cr \font@corner \@tempdimb\z@
\ifhollowcurved \advance\@tempdima-1em \curvedtrue
\let\llap\hbox \let\rlap\hbox
\else \@tempdimb-\dimen@ \fi
\advance\@tempdimb\@tempdima
\ifcurved
\def\@makecorner##1##2{\setbox\z@\hbox to \wd\tw@
{\rlap{\if@RTL\char##2\else\char##1\fi}\copy\thr@@\hfil\copy\thr@@\llap{\if@RTL\char##1\else\char##2\fi}}%
\ifhollowcurved\else\dp\z@\z@ \ht\z@\dimen@\fi}%
\else
\def\@makecorner##1##2{\setbox\z@\hbox to \wd\tw@
{\copy\thr@@\hfil\copy\thr@@}}%
\fi
\ifdim\dimen@<0.4\p@
\chardef\ch@pa16 \chardef\r@pa17%
\chardef\r@ba18 \chardef\ch@ba19%
\else%
\chardef\ch@pa8 \chardef\r@pa9%
\chardef\r@ba10 \chardef\ch@ba11%
\fi %
\setbox\thr@@\hbox to \@tempdima{\leaders\hrule\@height\dimen@\hfil}%
\setbox\@ne\vbox to \@tempdimb{\leaders\vrule\@width\dimen@\vfil}%
\@makecorner\ch@ba\r@ba
\setbox\@ne\hbox to \wd\tw@{\copy\@ne\hfil\copy\@ne}%
\copy\z@ \copy\@ne
\vskip-\ht\@ne \vskip-\dp\z@ \vskip-\ht\z@
\copy\tw@
\@makecorner\ch@pa\r@pa
\vskip-\ht\z@ \vskip-\dp\z@ \vskip-\ht\@ne
\copy\@ne\copy\z@}}%
}{%
\def\@crbox#1{\vbox{\setbox\tw@\vbox{\vskip\fboxsep
\hbox{\hskip\fboxsep\hbox{#1}\hskip\fboxsep}%
\vskip\fboxsep}\offinterlineskip%
\dimen@\thickness@corner@paper \@tempdima\length@corner@paper
\option@cr \font@corner \@tempdimb\z@
\ifhollowcurved \advance\@tempdima-1em \curvedtrue
\let\llap\hbox \let\rlap\hbox
\else \@tempdimb-\dimen@ \fi
\advance\@tempdimb\@tempdima
\ifcurved
\def\@makecorner##1##2{\setbox\z@\hbox to \wd\tw@
{\rlap{\char##1}\copy\thr@@\hfil\copy\thr@@\llap{\char##2}}%
\ifhollowcurved\else\dp\z@\z@ \ht\z@\dimen@\fi}%
\else
\def\@makecorner##1##2{\setbox\z@\hbox to \wd\tw@
{\copy\thr@@\hfil\copy\thr@@}}%
\fi
\ifdim\dimen@<0.4\p@
\chardef\ch@pa16 \chardef\r@pa17%
\chardef\r@ba18 \chardef\ch@ba19%
\else%
\chardef\ch@pa8 \chardef\r@pa9%
\chardef\r@ba10 \chardef\ch@ba11%
\fi %
\setbox\thr@@\hbox to \@tempdima{\leaders\hrule\@height\dimen@\hfil}%
\setbox\@ne\vbox to \@tempdimb{\leaders\vrule\@width\dimen@\vfil}%
\@makecorner\ch@ba\r@ba
\setbox\@ne\hbox to \wd\tw@{\copy\@ne\hfil\copy\@ne}%
\copy\z@ \copy\@ne
\vskip-\ht\@ne \vskip-\dp\z@ \vskip-\ht\z@
\copy\tw@
\@makecorner\ch@pa\r@pa
\vskip-\ht\z@ \vskip-\dp\z@ \vskip-\ht\@ne
\copy\@ne\copy\z@}}%
}}
\font\font@corner=ghab
\endinput
%%
%% Copyright © 2011–2013 by Persian TeX Group <persian-tex@tug.org>
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%%
%% This work is "maintained" (as per LPPL maintenance status)
%% by Persian TeX Group.
%%
%%
%%
%%
%%
%% End of file `crbox.sty'.
|