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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
% Copyright (C) 2011 by Yossi Gil yogi@cs.technion.ac.il
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3 of this license or (at your
% option) any later version. The latest version of this license is in
% http://www.latex-project.org/lppl.txt and version 1.3 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 Yossi Gil
%
% This work consists of the files unisugar.tex and unisugar.sty and the derived
% file unisugar.pdf
\NeedsTeXFormat{LaTeX2e}
\newcommand\date@unisugar{2011/05/07}
\newcommand\version@unisugar{V 0.92}
\newcommand\author@unisugar{Yossi Gil}
\newcommand\mail@unisugar{yogi@cs.technion.ac.il}
\newcommand\signature@unisugar{%
unisugar \version@unisugar{} by
\author@unisugar{} \mail@unisugar
}
\ProvidesPackage{unisugar}[\date@unisugar{} \signature@unisugar:
Selected Unicode characters (e.g., ⌘, ␣, •, ⏎, ¶, and §)
employed in some very common LaTeX commands.
]
\PackageInfo{unisugar}{This is unisugar, \signature@unisugar}
\RequirePackage{ifxetex}
\typeout{This is the unisugar package}
\providecommand\discardNextChar[1]{}
\providecommand*{\toEolnCommand}[2]{%
\newcommand*{#1}{%
\begingroup
\escapechar=`\\%
\catcode\endlinechar=\active
\csname\string#1\endcsname
}%
\begingroup%
\escapechar=`\\%
\lccode`\~=\endlinechar
\lowercase{%
\expandafter\endgroup
\expandafter\def\csname\string#1\endcsname##1~%
}{\endgroup#2\space}%
}
\toEolnCommand\toEolnSection{\section{#1}}
\toEolnCommand\toEolnSubsection{\subsection{#1}}
\toEolnCommand\toEolnSubsubsection{\subsubsection{#1}}
\toEolnCommand\toEolnParagraph{\paragraph{#1}}
\toEolnCommand\toEolnSubparagraph{\subparagraph{#1}}
\ifxetex
\relax
\else
\PackageWarning{You should be LaTeXing your file with "xelatex \jobname"
to enjoy this package fully}
\endinput
\fi
% ⌘: U+2318 PLACE OF INTEREST SIGN (also command key), is used as a direction
% neutral escape character. Makes it possible to use the command key
% character as a command prefix. Useful in particular with right-to-left texts,
% in which the familiar, yet directionally non-neutral, backslash may be a bit confusing.
\catcode"2318=11
\edef\⌘{⌘}
\catcode"2318=0
% ␣: U+2423 OPEN BOX, a visual space is allowed as a legitimate character in
% control sequences, whereby eliminating the need for ugly juxtaposing of words.
\catcode"2423=11
\edef\␣{␣}
% …: U+2026 HORIZONTAL ELLIPSIS, will serve as a sugar nickname for \ldots.
⌘catcode"2026=⌘active
⌘newcommand…{⌘ldots}
% •: U+2022 BULLET (black small circle), a sugared alias for ⌘item.
⌘catcode"2022=11
⌘edef⌘•{•}
⌘catcode"2022=⌘active
⌘newcommand•{⌘item}
% ⏎: U+23CE RETURN SYMBOL, a sugared nickname for \\
⌘catcode"23CE=11
⌘edef\⏎{⏎}
⌘catcode"23CE=⌘active
⌘newcommand⏎{\\}
% ⌖: U+2316 POSITION INDICATOR, is an alias for LaTeX's \label command.
⌘catcode"2316=11
⌘edef\⌖{⌖}
⌘catcode"2316=⌘active
⌘newcommand⌖[1]{⌘label{#1}}
% ☝: U+261D WHITE UP POINTING INDEX, is an alias LaTeX's \ref command.
⌘catcode"261D=11
⌘edef\☝{☝}
⌘catcode"261D=⌘active
⌘newcommand☝[1]{⌘ref{#1}}
% ¶: U+00B6 PILCROW SIGN, will serve as a sugar nickname for ⌘paragraph, using
% the remainder of the line as the paragraph's title. Further, ¶¶, that is two
% successive occurrences of the pilcrow sign, shall serve as a sugared nickname
% for ⌘subparagraph, employing the remainder of the text on the current line as
% the subparagraph's title.
⌘catcode"B6=11
⌘edef\¶{¶}
⌘catcode"B6=⌘active
⌘newcommand¶{⌘paragraph␣sugar}
\newcommand\paragraph␣sugar{%
\@ifnextchar¶{%
\expandafter
\toEolnSubparagraph
\discardNextChar
}{%
\toEolnParagraph
}%
}
% §: U+00A7 SECTION SIGN, will serve as a sugar nickname for ⌘section, using
% the remainder of the line as the section's title. Further, §§, that is two
% successive occurrences of this Unicode code point, shall serve as a sugared
% nickname for ⌘subsection, employing the remainder of the text on the current
% line as the subsection's title. Even further, §§§, three successive
% occurrences shall serve as a sugared nickname for ⌘subsubsection, employing
% again, the remainder of text on the line as the subsubsection's title.
%
⌘catcode"A7=11
⌘edef\§{§}
⌘catcode"A7=⌘active
⌘newcommand§{⌘section␣sugar}
⌘newcommand⌘section␣sugar{%
\@ifnextchar§{% Two or more § were found.
\expandafter
\sub␣or␣subsub␣section
\discardNextChar
}{% Single § found.
\toEolnSection
}%
}
\newcommand*\sub␣or␣subsub␣section{%
\@ifnextchar§{%
\expandafter
\toEolnSubsubsection
\discardNextChar
}{%
\toEolnSubsection
}%
}
|