From 8645e8a5da54c3f1ea19c24002a20e0356e08bf7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 22 Feb 2011 00:15:48 +0000 Subject: new xelatex package unisugar (21feb11) git-svn-id: svn://tug.org/texlive/trunk@21492 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/xelatex/unisugar/unisugar.sty | 154 +++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 Master/texmf-dist/tex/xelatex/unisugar/unisugar.sty (limited to 'Master/texmf-dist/tex/xelatex/unisugar') diff --git a/Master/texmf-dist/tex/xelatex/unisugar/unisugar.sty b/Master/texmf-dist/tex/xelatex/unisugar/unisugar.sty new file mode 100644 index 00000000000..feca9bfc27e --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/unisugar/unisugar.sty @@ -0,0 +1,154 @@ +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{hyperref} +\newcommand\date@unisugar{2011/02/18} +\newcommand\version@unisugar{V 0.9} +\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 (⌘, ␣, •, ⏎, ¶, 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 write to use the command key +% character as a command prefix. Useful in particular with right-to-left texts, +% in which the familiar 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\␣{␣} +⌘catcode"2423=11 + +% •: 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 + }% +} + + + + + + + + + + + + -- cgit v1.2.3