From fd8b5081012294fd4fa8b3c9371f0b26b39d0ef1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 14 Oct 2010 23:41:12 +0000 Subject: reinstate bezos, it contains babeltools git-svn-id: svn://tug.org/texlive/trunk@20106 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/bezos/babeltools.pdf | Bin 0 -> 112815 bytes Master/texmf-dist/doc/latex/bezos/babeltools.tex | 111 +++++++ Master/texmf-dist/tex/latex/bezos/babeltools.sty | 362 +++++++++++++++++++++++ Master/tlpkg/libexec/ctan2tds | 5 +- Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 2 +- 5 files changed, 477 insertions(+), 3 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/bezos/babeltools.pdf create mode 100644 Master/texmf-dist/doc/latex/bezos/babeltools.tex create mode 100644 Master/texmf-dist/tex/latex/bezos/babeltools.sty diff --git a/Master/texmf-dist/doc/latex/bezos/babeltools.pdf b/Master/texmf-dist/doc/latex/bezos/babeltools.pdf new file mode 100644 index 00000000000..092a6558725 Binary files /dev/null and b/Master/texmf-dist/doc/latex/bezos/babeltools.pdf differ diff --git a/Master/texmf-dist/doc/latex/bezos/babeltools.tex b/Master/texmf-dist/doc/latex/bezos/babeltools.tex new file mode 100644 index 00000000000..f54db645662 --- /dev/null +++ b/Master/texmf-dist/doc/latex/bezos/babeltools.tex @@ -0,0 +1,111 @@ +%$PDFLaTeX (encoding:utf-8) + +\documentclass{article} + +\author{Javier Bezos} +\title{\textsf{babeltools}\\% +\Large Fixing (some) \textsf{babel} annoyances} + +\begin{document} + +\maketitle + +(Beta.) + +The \textsf{babel} package introduces some changes in the \LaTeX{} +kernel which are not strictly necessary (perhaps just convenient), but +have some unwanted side-effects. Oddly enough, most of these changes +cannot be disabled, with a few exceptions (eg, \texttt{activeacute} +and \texttt{activegrave}, but note there are not \texttt{activecaret} +or \texttt{activetilde}). + +With \textsf{babeltools} you can modify the \textsf{babel} behaviour +by means of a set of package options, with a few macros serving as +tools for specific purposes. This package must be loaded +\textbf{before} \textsf{babel}. + +\section{Package options} + +\begin{description} +\item[shorthands=off] The shorthands mechanism is turned off. +As some languages use this mechanism for tools not availible +otherwise, a macro \verb|\babelshorthand| is defined, which allows +using them; see below. + +\item[shortands=...] The shorthands mechanism is on, but the only +shorthands activated are those given, like, eg: +\begin{verbatim} +\usepackage[shorthands=:;!?]{babeltools} +\end{verbatim} + +If \verb|'| is included, \texttt{activeacute} is passed to +\textsf{babel}; if \verb|`| is included, \texttt{activegrave} is +passed. Active characters (like \verb|~|) should be preceded by +\verb|\string| (otherwise they will be expanded by \LaTeX{} before +they are passed to the package and therefore they will not be +recognized). + +\item[adaptive] By default, all \textsf{babel} shorthands are active +and live from start to end of documents. You can deactivate them by +hand with \verb|\shorthandoff|, but this is cumbersome and you cannot +use it ``just in case'' (if the character is not a shorthands an error +is raised, instead of ignoring silently the redundant setting). That +means you have to accept a character like : is active in an English +document even if you need it for just a few quotations in French. The +default engine may be replaced by a new one which adapts the +shorthands behaviour to the context in the following way: +\begin{enumerate} +\item In math mode, while still shorthands, they behave always like the +corresponding normal char. Things like \verb|$a \mathrel{x'} b$| +work as expected. + +\item When the language is switched, shorthands chars are made normal or +active, as appropiate. Thus, \texttt{:} or \texttt{?} are active only in +\texttt{french}. +\end{enumerate} + +% This option is useful when there are, say, short quotations in French +% inside a German text or when there are whole chapter in either French +% or German. + +\item[nocrossrefs] newlabel, ref and pageref are not redefined. You +cannot use shorthands in labels. + +\item[nocitations] nocite, bibcite and bibitem are not redefined. You +cannot use shorthands in labels. + +\item[langcaptions] Captions are redefined if possible so that an +intermediate macro \verb|\lang...name| is used, eg, +\verb|\germanchaptername|. Somewhat experimental. + +\item[noconfig] Config files are not loaded, so you can make sure your +document is not spoilt by an unexpected \texttt{.cfg} file. +\end{description} + +Babel tweaks several packages for shorthands to be accepted. At the +time of this writing they are \textsf{cite}, \textsf{natbib}, +\textsf{varioref} and \textsf{hhline} (the latter for the colon). If +you don't use shorthands, these redefinitions are unnecesary and +inconvenient. If you give a list of shorthands and it doesn't include +\verb|:|, then \verb|hhline| is left untouched. The other packages +are handled by \texttt{nocrossrefs} and \texttt{nocitations}, as +appropiate. + +\section{Macros} + +\begin{description} +\item[\ttfamily\string\babelshorthand] Use a shorthand, even with +\texttt{shorthands=off} or not listed in it, eg, +\verb|\babelshorthand{"u}| or \verb|\babelshorthand{:}|. You can +conveniently define your own macros. +\end{description} + +\section{Known limitations} + +If a class loads \textsf{babel} with a language, you cannot use +\textsf{babeltools}. However, if a class loads babel without loading +any language, you can use it. Languages given in +\verb|\documentclass| work as expected (provided the class doesn't +load it, of course). + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/bezos/babeltools.sty b/Master/texmf-dist/tex/latex/bezos/babeltools.sty new file mode 100644 index 00000000000..2818aa36519 --- /dev/null +++ b/Master/texmf-dist/tex/latex/bezos/babeltools.sty @@ -0,0 +1,362 @@ +% Copyright (c) 2010 by Javier Bezos. +% All Rights Reserved. +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, 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 2003/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Javier Bezos. +% +% TODO: +% noshorthands -> shorthands=off, nocitations, nocrossrefs + +\ProvidesPackage{babeltools}[2010/10/14 v0.2 Tools for the babel system (beta)] + +\edef\bbtl@savedcatcodes{% + \catcode`\noexpand\~=\the\catcode`\~ + \catcode`\noexpand\:=\the\catcode`\: + \catcode`\noexpand\"=\the\catcode`\"} +\catcode`\~=\active +\catcode`\"=12 +\catcode`\:=12 + +\def\bbtl@meaning{\expandafter\strip@prefix\meaning} + +\def\bbtl@ifshorthand#1{% + \@expandtwoargs\in@{#1}{\bbtl@o@shorthands}% + \ifin@ + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} + +\let\bbtl@afterbabelhook\@empty +\newcommand\AfterBabel[1]{% + \g@addto@macro\bbtl@afterbabelhook{#1}} + +\let\bbtl@atendofbabelhook\@empty +\newcommand\AtEndOfBabel[1]{% + \g@addto@macro\bbtl@atendofbabelhook{#1}} + +\let\bbtl@beforebabelhook\@empty +\newcommand\BeforeBabel[1]{% + \g@addto@macro\bbtl@beforebabelhook{#1}} + +% Not to be redefined. The current value, saved by babel, is +% restored. More robust code is necessary, I think. + +\def\bbtl@restore@org#1{% + \@ifundefined{#1 }% Not robust? + {\expandafter\let\csname #1\expandafter\endcsname + \csname org@#1\endcsname}% + {\expandafter\let\csname #1 \expandafter\endcsname + \csname org@#1\endcsname}} + +\def\bbtl@save@org#1{% + \expandafter\let\csname org@#1\expandafter\endcsname + \csname #1\endcsname} + +% Citations and cross refs +% ~~~~~~~~~~~~~~~~~~~~~~~~ + +\let\bbtl@ignorepackages\@empty + +\DeclareOption{nocitations} + {\g@addto@macro\bbtl@ignorepackages{,cite,natbib,}% + \AfterBabel{% + \bbtl@restore@org{nocite}% + \bbtl@restore@org{bibcite}% + \bbtl@restore@org{@bibitem}%S + \bbtl@restore@org{@citex}}} + +\DeclareOption{nocrossrefs} + {\g@addto@macro\bbtl@ignorepackages{,varioref,}% + \BeforeBabel{% + \bbtl@save@org{@newl@bel}}% babel DOESN'T save it! + \AfterBabel{% + \bbtl@restore@org{@newl@bel}% + \bbtl@restore@org{ref}% Robust + \bbtl@restore@org{pageref}}}% Robust + +% More cases are to be added, but they must be delayed at the end of +% begin document, because they are related to loaded packages (see +% babel.dtx) +% +% Shorthands +% ~~~~~~~~~~ +% Some languages use the shortand mechanism for tools not defined +% otherwise, so you can still use them with \babelshorthand{..}. +% Then you can use it conveniently to define your own macros. + +% ~ is an special case, as it's defined in babel.def + +% New shorthands +% -------------- + +\DeclareOption{adaptive}% + {\AfterBabel{% + \let\bbtl@initiate@active@char\initiate@active@char + \let\initiate@active@char\bbtl@set@shorthand + \let\bbtl@declare@shorthand\declare@shorthand + \let\declare@shorthand\bbtl@declare + \let\bbl@activate\bbtl@activate + \let\bbtl@deactivate\bbl@deactivate + \let\bbl@deactivate\bbtl@restore}} + +% Do \bbtl@initiate@active@char but don't make the char active. +% Not necessary and a source of bugs. + +\def\bbtl@set@shorthand#1{% + \expandafter\edef\csname bbtl@savecat\string#1\endcsname + {\the\catcode`#1}% + \bbtl@initiate@active@char{#1}% + \catcode`#1=\csname bbtl@savecat\string#1\endcsname\relax + \addto\bbtl@select{\shorthandon{#1}}} + +\def\bbtl@use@shorthand{% + \if@safe@actives + \bbl@afterelse + \string + \else + \bbl@afterfi + {\ifx\thepage\relax + \bbl@afterelse + \string + \else + \bbl@afterfi + \bbtl@use@sh + \fi}% + \fi} + +\def\bbtl@use@sh#1{% + \ifx\protect\@unexpandable@protect + \bbl@afterelse + \noexpand#1% + \else% + \bbl@afterfi + \textormath + {\csname active@char\string#1\endcsname}% + {\csname normal@char\string#1\endcsname}% + \fi} + +\gdef\bbtl@activate#1{% + \begingroup + \lccode`\~=`#1 + \lowercase{% + \endgroup + \def~{\bbtl@use@shorthand~}}} + +\def\bbtl@restore#1{% + \shorthandon{#1}% + \begingroup + \lccode`\~=`#1 + \lowercase{% + \endgroup + \bbtl@deactivate{~}}} + +\def\bbtl@declare#1#2{% + \@ifundefined{bbtl@savecat\expandafter\string\@firstoftwo#2\@empty}% + {\@gobble}% + {\bbtl@declare@shorthand{#1}{#2}}} + +% No shorthands +% ------------- + +% This is done after 'adaptive', if present. + +\DeclareOption{shorthands=off}% + {\AfterBabel{\bbl@doshorthands}} + +\def\babelshorthand#1{% + \def\bbtl@tempa{#1}% + \@ifundefined{bbtl@@\languagename @@\bbtl@meaning\bbtl@tempa}% + {#1}% + {\@nameuse{bbtl@@\languagename @@\bbtl@meaning\bbtl@tempa}}} + +% Select +% ---------------------- +\let\bbtl@o@shorthands\@empty + +% TO DO: package options are expanded by LaTeX, and ~ raises +% an error, but not \string~. Is there a way to fix it? + +% This is done after 'adaptive', if present. + +\def\bbl@doshorthands{% + \let\bbtl@s@initiate@active@char\initiate@active@char + \def\initiate@active@char##1{% + \bbtl@ifshorthand{\string##1}% + {\bbtl@s@initiate@active@char{##1}}% + {}}% + \let\bbtl@s@declare@shorthand\declare@shorthand + \def\declare@shorthand##1##2{% + \bbtl@ifshorthand{\expandafter\string\@firstoftwo##2\@empty}% + {\bbtl@s@declare@shorthand{##1}{##2}}% + {\def\bbtl@tempa{##2}% + \@namedef{bbtl@@##1@@\bbtl@meaning\bbtl@tempa}}}% + \let\bbtl@s@activate\bbl@activate + \def\bbl@activate##1{% + \bbtl@ifshorthand{\string##1}% + {\bbtl@s@activate{##1}}% + {}}% + \let\bbtl@s@deactivate\bbl@deactivate + \def\bbl@deactivate##1{% + \bbtl@ifshorthand{\string##1}% + {\bbtl@s@deactivate{##1}}% + {}}} + +% No config +% ~~~~~~~~~ +% Make sure an unexpected local config doesn't spoil your document. +% Use of config files is strongly discouraged, but some sites +% use them + +\DeclareOption{noconfig} + {\AfterBabel{\let\loadlocalcfg\@gobble}} + +% Captions +% ~~~~~~~~ + +% redefining names. Somewhat experimental. + +\def\bbtl@captions{% + \bbtl@elt\prefacename\bbtl@elt\refname\bbtl@elt\abstractname + \bbtl@elt\bibname\bbtl@elt\chaptername\bbtl@elt\appendixname + \bbtl@elt\contentsname\bbtl@elt\listfigurename + \bbtl@elt\listtablename\bbtl@elt\indexname + \bbtl@elt\figurename\bbtl@elt\tablename\bbtl@elt\partname + \bbtl@elt\enclname\bbtl@elt\ccname\bbtl@elt\headtoname + \bbtl@elt\pagename\bbtl@elt\seename\bbtl@elt\alsoname + \bbtl@elt\proofname\bbtl@elt\glossaryname} + +% 1: \captions... expanded #2 repl fun bbtl@f #3 \...name +% \lang...name +\def\bbtl@rep#1\@@\@@#2#3#4{% + \in@{#3}{#1}% + \ifin@ + #2#1\@@\@@#3#4% + \else + \PackageWarningNoLine{babeltools}% + {No \string#3 in \bbtl@l}% + \fi} + +% \bbtl@f is a helper macro: +% 1 \...name +% bbtl@f: +% #1 prev, #2 def of \...name, #3 after +% #4 \...name, #5 \lang...name +\DeclareOption{langcaptions} + {\def\bbtl@repdef#1{% + \def\bbtl@f##1#1##2##3\@@\@@##4##5{% + \def##5{##2}% + \@namedef{captions\bbtl@l}{##1##4{##5}##3}}}% + \def\bbtl@elt#1{% + \bbtl@repdef#1% + \@temptokena\expandafter\expandafter\expandafter{% + \csname captions\bbtl@l\endcsname}% + % If \lang...name undefined + \edef\bbtl@t{% + \noexpand\bbtl@rep + \the\@temptokena + \noexpand\@@\noexpand\@@ + \noexpand\bbtl@f + \noexpand#1 + \expandafter\noexpand + \csname\bbtl@l\expandafter\@gobble\string#1\endcsname}% + \bbtl@t}% + \def\bbtl@repdo{% + \@for\bbtl@l:=\bbtl@options\do{% + \@ifundefined{captions\bbtl@l}{}{% + \bbtl@captions}}}% + \AtEndOfBabel{\bbtl@repdo}} + +% Key=value package options +% ~~~~~~~~~~~~~~~~~~~~~~~~~ + +\def\bbtl@process#1=#2\bbtl@process#3{% + \expandafter\ifx\csname bbtl@o@#1\endcsname\@empty + \expandafter\edef\csname bbtl@o@#1\endcsname{#2}% + \DeclareOption{\CurrentOption}{}% + \fi} + +\DeclareOption*{% + \@expandtwoargs\in@{\string=}{\CurrentOption}% + \ifin@ + \expandafter\bbtl@process\CurrentOption\bbtl@process\CurrentOption + \fi} + +% Process options +% ~~~~~~~~~~~~~~~~ + +\ProcessOptions + +% shorthands=... option is handled here. + +\show\bbtl@o@shorthands + +\ifx\bbtl@o@shorthands\@empty\else + \edef\bbtl@o@shorthands{\bbtl@meaning\bbtl@o@shorthands}% + \bbtl@ifshorthand{'}% + {\PassOptionsToPackage{activeacute}{babel}}{} + \bbtl@ifshorthand{`}% + {\PassOptionsToPackage{activegrave}{babel}}{} + \bbtl@ifshorthand{:}{}% + {\g@addto@macro\bbtl@ignorepackages{,hhline,}} +% After any redefinition, the shorthand mechanism comes. + \AfterBabel{\bbl@doshorthands} +\fi + +% The first \LdfInit loads the babel core (the sty file doesn't!) +% That means babeltools is not compatible with classes loading +% a language: + +\@ifundefined{ldf@finish}% + {\def\LdfInit{% + \expandafter\let\expandafter\bbtl@options + \csname opt@babel.sty\endcsname + \bbtl@beforebabelhook + \AtBeginDocument{% + \let\bbtl@ifpackageloaded\@ifpackageloaded + \def\@ifpackageloaded##1{% + \@expandtwoargs\in@{,##1,}{\bbtl@ignorepackages}% + \ifin@ + \expandafter\@gobbletwo + \else + \expandafter\bbtl@ifpackageloaded + \fi + {##1}}}% + \chardef\atcatcode =\catcode`\@ + \catcode`\@=11\relax + \input babel.def\relax + \catcode`\@ =\atcatcode + \let\atcatcode\relax + \bbtl@afterbabelhook + \AtEndOfPackage{\bbtl@atendofbabelhook}% + \LdfInit}} + {\PackageError{babeltools}% + {Too late -- babel has been loaded}% + {babeltools can be used only before babel.\MessageBreak + Very likely a package or the class has loaded it.}} + +\AtEndOfBabel{% + \AtBeginDocument{\let\@ifpackageloaded\bbtl@ifpackageloaded}} + +\bbtl@savedcatcodes + +\endinput + +============================== +============================== + +- Attributes? +- Quotes '' + + + + diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index d20b3ab214a..0e8555d0d91 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -114,7 +114,7 @@ $Master = "$mydir/../.."; 'bengali-omega', "die 'skipping, duplicates odev.sty et al.'", 'bera', "&MAKEunzipandflatten", 'berenisadf', "&MAKEcopy", - 'bezos', "die 'skipping, replaced by babeltools'", + 'babeltools', "die 'skipping, use bezos'", 'bgreek', "&MAKEcopy", 'bib2ml', "die 'skipping, no self-locate?, etc.'", 'biber', "die 'skipping, arch-dependent perl, etc.'", @@ -261,7 +261,7 @@ $Master = "$mydir/../.."; 'eqexam', "die 'skipping, per author request'", 'eqmark', "die 'skipping, latex 2.09, was never in TL'", 'eqnarray', "die 'skipping, nonfree'", - 'esindex', "die 'skipping, use bezos instead'", + 'esindex', "die 'skipping, use bezos'", 'eskdx', "&MAKEeskdx", 'esvect', "&MAKEflatten", 'ethiop', "&MAKEflatten", @@ -453,6 +453,7 @@ $Master = "$mydir/../.."; 'metauml', "&MAKEmetauml", 'mflogo', "die 'skipping, TL conflates distinct mflogo pkgs on CTAN'", 'mfpic', "&MAKEcopy", + 'milstd', "die 'skipping, have milstd.sty from logic'", 'miniltx', "die 'skipping, use graphics-pln'", 'minionpro', "die 'skipping, requires nonfree minion'", 'misc', "&MAKEmisc", diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index 26636b8ad9f..fc46cec90fa 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -36,13 +36,13 @@ depend attachfile depend authoraftertitle depend authorindex depend autotab -depend babeltools depend background depend beamer-contrib depend beamerposter depend begriff depend beton depend bez123 +depend bezos depend bigfoot depend bigints depend bizcard -- cgit v1.2.3