%PDF- %PDF-
| Direktori : /data/old/usr/share/texlive/texmf-dist/tex/xelatex/unisugar/ |
| Current File : //data/old/usr/share/texlive/texmf-dist/tex/xelatex/unisugar/unisugar.sty |
% 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
}%
}