diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-02 01:30:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-02 01:30:05 +0000 |
commit | 966c8c981c3264bf82e6c256dc35c7d2d27f49ba (patch) | |
tree | 303845f3b25af7fe42b44c815726a100ad607c51 /Master/texmf-dist/tex/latex/microtype/microtype.sty | |
parent | f385fb50ed694e9ae7173d5f82f78994a0a610b0 (diff) |
microtype (30apr16)
git-svn-id: svn://tug.org/texlive/trunk@40825 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/microtype/microtype.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/microtype/microtype.sty | 239 |
1 files changed, 141 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/latex/microtype/microtype.sty b/Master/texmf-dist/tex/latex/microtype/microtype.sty index 8f3a382b467..75d2aa3ea44 100644 --- a/Master/texmf-dist/tex/latex/microtype/microtype.sty +++ b/Master/texmf-dist/tex/latex/microtype/microtype.sty @@ -10,7 +10,7 @@ %% %% The `microtype' package %% Subliminal refinements towards typographical perfection -%% Copyright (c) 2004--2013 R Schlicht <w.m.l@gmx.net> +%% Copyright (c) 2004--2016 R Schlicht <w.m.l@gmx.net> %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License, either version 1.3c of this license or (at @@ -21,17 +21,17 @@ %% This work has the LPPL maintenance status `author-maintained'. %% %% This work consists of the files microtype.dtx and microtype.ins and the -%% derived files microtype.sty, microtype-pdftex.def, microtype-xetex.def, -%% microtype-luatex.def, microtype.lua and letterspace.sty. +%% derived files microtype.sty, microtype-pdftex.def, microtype-luatex.def, +%% microtype-xetex.def, microtype.lua and letterspace.sty. %% %% ------------------------------------------------------------------------ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage {microtype} - [2013/05/23 v2.5a + [2016/05/01 v2.6 Micro-typographical refinements - (RS)] + (RS)] \def\MT@MT {microtype} \let\MT@restore@catcodes\@empty @@ -134,11 +134,11 @@ \ifx\pdftexversion\@undefined \else \ifx\pdftexversion\relax \else \def\MT@engine{pdf} - \ifx\directlua\@undefined \else - \ifx\directlua\relax \else - \def\MT@engine{lua} - \fi - \fi + \fi +\fi +\ifx\directlua\@undefined \else + \ifx\directlua\relax \else + \def\MT@engine{lua} \fi \fi \ifx\MT@engine\relax @@ -396,13 +396,13 @@ \def\MT@rbba@tracking{tr} \def\MT@features{pr,ex,sp,kn,tr} \def\MT@features@long{protrusion,expansion,spacing,kerning,tracking} -\def\MT@is@feature#1{% - \MT@exp@one@n\MT@in@clist\@tempa\MT@features@long +\def\MT@is@feature#1#2{% + \MT@in@clist{#1}\MT@features@long \ifMT@inlist@ \expandafter\@firstofone \else - \MT@error{`\@tempa' is not an available micro-typographic\MessageBreak - feature. Ignoring #1}{Available features are: `\MT@features@long'.}% + \MT@error{`#1' is not an available micro-typographic\MessageBreak + feature. Ignoring #2}{Available features are: `\MT@features@long'.}% \expandafter\@gobble \fi } @@ -422,9 +422,16 @@ } \def\MT@restore@p@h{\chardef\%`\% \chardef\#`\# } \newif\ifMT@xunicode -\newif\ifMT@fontspec \MT@with@package@T{xunicode}\MT@xunicodetrue +\newif\ifMT@fontspec \MT@with@package@T{fontspec}\MT@fontspectrue +\let\MT@if@fontspec@font\@secondoftwo +\def\MT@fontspec@setup{% + \@ifpackagelater{fontspec}{2013/05/23}{ + \MT@let@cn\MT@if@fontspec@font{fontspec_if_fontspec_font:TF}% + }\relax +} +\ifMT@fontspec\MT@fontspec@setup\fi \def\MT@setupfont@hook{% \ifMT@fontspec\MT@font\fi \MT@if@false @@ -448,11 +455,12 @@ The `pdfcprot' package provides an interface to character protrusion.\MessageBre So does the `\MT@MT' package. Using both packages at the same\MessageBreak time will almost certainly lead to undesired results. Have your choice!}% }% - \MT@with@package@T{ledmac}\MT@ledmac@setup - \MT@with@package@T{eledmac}\MT@ledmac@setup + \MT@with@package@T {ledmac}\MT@ledmac@setup + \MT@with@package@T {eledmac}\MT@ledmac@setup + \MT@with@package@T{reledmac}\MT@ledmac@setup \MT@with@package@T{xunicode}\MT@xunicodetrue - \MT@with@package@T{fontspec}\MT@fontspectrue - \let\MT@setupfont@hook\@empty + \MT@with@package@T{fontspec}{\MT@fontspectrue\MT@fontspec@setup}% + \MT@glet\MT@setupfont@hook\@empty \ifMT@fontspec \g@addto@macro\MT@setupfont@hook{\MT@font}% \fi @@ -1092,11 +1100,16 @@ time will almost certainly lead to undesired results. Have your choice!}% /MT@ifstreq/MT@charstring{##3##4}/relax/MT@norestfalse /else /edef/MT@char@{/number"##2##3}% - /MT@ifstreq/MT@charstring{##4}/relax/MT@norestfalse + /MT@ifstreq/MT@charstring{##4}/relax + {/MT@is@xchar##2##3|##4\CHAR"/relax}% /fi /fi /fi }% + /def/MT@is@xchar##1|##2\CHAR"##3##4/relax{% + /MT@ifstreq/MT@charstring{##3##4}% + {/edef/MT@char@{/number"##1##2}}/MT@norestfalse + }% /def/MT@charxstring{\CHAR "}% /def/MT@strip@prefix##1>##2/relax{##2}% /def/MT@is@charx##1\CHAR "##2##3##4##5##6/relax{% @@ -1160,36 +1173,48 @@ time will almost certainly lead to undesired results. Have your choice!}% { (input encoding `\@nameuse {MT@\MT@feat @\MT@cat @\csname MT@\MT@feat @\MT@cat @name\endcsname @inputenc}')}% } +\def\MT@warn@unknown@once#1{% + \def\MT@warn@unknown{% + \MT@warning@nl{One or more slots in the configuration are unknown.\MessageBreak + Make sure that no text commands are used.\MessageBreak + See the documentation for details (the note\MessageBreak + on `#1' in section 9: `Hints and caveats')}% + \MT@glet\MT@warn@unknown\relax}% +} \let\MT@font@list\@empty \let\MT@font\@empty \MT@addto@setup{% + \MT@with@package@T{luatexja}{\MT@warn@unknown@once{luatexja}}% + \MT@with@package@T{xeCJK} {\MT@warn@unknown@once{xeCJK}}% \@ifpackageloaded{CJK}{% - \@ifpackagelater{CJK}{2006/10/17}% 4.7.0 - {\def\MT@orig@pickupfont{\CJK@ifundefined\CJK@plane}}% - {\def\MT@orig@pickupfont{\@ifundefined{CJK@plane}}}% - \g@addto@macro\MT@orig@pickupfont - {{\expandafter\ifx\font@name\relax\define@newfont\fi}}% - \@ifpackageloaded{CJKutf8}% - {\@ifpackagelater{CJKutf8}{2008/05/22}% 4.8.0 - {\ifpdf\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}% - {\@firstoftwo}}% - {\@firstoftwo}% - {\g@addto@macro\MT@orig@pickupfont{% - {\expandafter\ifx\csname\curr@fontshape/\f@size/\CJK@plane\endcsname\relax - \define@newfont\else\xdef\font@name{% + \@ifpackageloaded{xeCJK}{\@firstofone}{% + \@ifpackagelater{CJK}{2006/10/17}% 4.7.0 + {\def\MT@orig@pickupfont{\CJK@ifundefined\CJK@plane}}% + {\def\MT@orig@pickupfont{\@ifundefined{CJK@plane}}}% + \g@addto@macro\MT@orig@pickupfont + {{\expandafter\ifx\font@name\relax\define@newfont\fi}}% + \@ifpackageloaded{CJKutf8}% + {\@ifpackagelater{CJKutf8}{2008/05/22}% 4.8.0 + {\ifpdf\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}% + {\@firstoftwo}}% + {\@firstoftwo}% + {\g@addto@macro\MT@orig@pickupfont{% + {\expandafter\ifx\csname\curr@fontshape/\f@size/\CJK@plane\endcsname\relax + \define@newfont\else\xdef\font@name{% + \csname \curr@fontshape/\f@size/\CJK@plane\endcsname}\fi}}}% + {\g@addto@macro\MT@orig@pickupfont{% + {\expandafter\ifx\csname \curr@fontshape/\f@size/\CJK@plane\endcsname\relax + \define@newfont\def\CJK@temp{v}% + \ifx\CJK@temp\CJK@plane + \expandafter\ifx\csname CJK@cmap@\f@family\CJK@plane\endcsname\relax + \else\csname CJK@cmap@\f@family\CJK@plane\endcsname\fi + \else \CJK@addcmap\CJK@plane \fi + \else\xdef\font@name{% \csname \curr@fontshape/\f@size/\CJK@plane\endcsname}\fi}}}% - {\g@addto@macro\MT@orig@pickupfont{% - {\expandafter\ifx\csname \curr@fontshape/\f@size/\CJK@plane\endcsname\relax - \define@newfont\def\CJK@temp{v}% - \ifx\CJK@temp\CJK@plane - \expandafter\ifx\csname CJK@cmap@\f@family\CJK@plane\endcsname\relax - \else\csname CJK@cmap@\f@family\CJK@plane\endcsname\fi - \else \CJK@addcmap\CJK@plane \fi - \else\xdef\font@name{% - \csname \curr@fontshape/\f@size/\CJK@plane\endcsname}\fi}}}% - }{% - \def\MT@orig@pickupfont{\expandafter\ifx\font@name\relax\define@newfont\fi}% - }% + \@gobble + }% + }{\@firstofone}% + {\def\MT@orig@pickupfont{\expandafter\ifx\font@name\relax\define@newfont\fi}}% \ifx\pickup@font\MT@orig@pickupfont \else \MT@warning@nl{% Command \string\pickup@font\space is not defined as expected.% @@ -1276,7 +1301,7 @@ time will almost certainly lead to undesired results. Have your choice!}% \DeclareRobustCommand\microtypecontext[1]{% \MT@setup@contexts \let\MT@reset@context\relax - \let\glb@currsize\@empty + \MT@glet\glb@currsize\@empty \setkeys{MTC}{#1}% \selectfont \MT@reset@context @@ -1318,31 +1343,35 @@ time will almost certainly lead to undesired results. Have your choice!}% \fi }% } +\define@key{MTC}{activate}[]{% + \setkeys{MT}{protrusion={#1}}% + \setkeys{MT}{expansion={#1}}% +} \MT@exp@one@n\MT@map@clist@n{\MT@features,nl}{% \MT@def@n{MT@#1@context}{@}% \MT@def@n{MT@#1@doc@contexts}{{@}}% } \let\MT@extra@context\@empty \def\DeclareMicrotypeSet{% + \MT@begin@catcodes \@ifstar \MT@DeclareSetAndUseIt \MT@DeclareSet } \newcommand\MT@DeclareSet[3][]{% - \KV@@sp@def\@tempa{#1}% - \MT@ifempty\@tempa{% + \MT@ifempty{#1}{% \MT@map@clist@c\MT@features{{\MT@declare@sets{##1}{#2}{#3}}}% }{% - \MT@map@clist@c\@tempa{{% - \KV@@sp@def\@tempa{##1}% - \MT@ifempty\@tempa\relax{% - \MT@is@feature{set declaration `#2'}{% + \MT@map@clist@n{#1}{{% + \MT@ifempty{##1}\relax{% + \MT@is@feature{##1}{set declaration `#2'}{% \MT@exp@one@n\MT@declare@sets - {\csname MT@rbba@\@tempa\endcsname}{#2}{#3}% + {\csname MT@rbba@##1\endcsname}{#2}{#3}% }% }% }}% }% + \MT@end@catcodes } \newcommand\MT@DeclareSetAndUseIt[3][]{% \MT@DeclareSet[#1]{#2}{#3}% @@ -1350,10 +1379,12 @@ time will almost certainly lead to undesired results. Have your choice!}% } \let\MT@curr@set@name\@empty \def\MT@declare@sets#1#2#3{% - \KV@@sp@def\MT@curr@set@name{#2}% + \def\MT@curr@set@name{#2}% \MT@ifdefined@n@T{MT@#1@set@@\MT@curr@set@name}{% \MT@warning{Redefining \@nameuse{MT@abbr@#1} set `\MT@curr@set@name'}% - \MT@glet@nc{MT@#1list@size@\MT@curr@set@name}\@empty + \MT@map@clist@n{font,encoding,family,series,shape,size}{% + \MT@glet@nc{MT@#1list@##1@\MT@curr@set@name}\@undefined + }% }% \MT@glet@nc{MT@#1@set@@\MT@curr@set@name}\@empty \setkeys{MT@#1@set}{#3}% @@ -1384,16 +1415,18 @@ time will almost certainly lead to undesired results. Have your choice!}% } \let\MT@font@sets\@empty \def\MT@fix@font@set#1{% - \xdef#1{#1}% - \ifMT@fontspec - \xdef#1{\expandafter\MT@scrubfeatures#1()\relax}% - \fi - \global\@onelevel@sanitize#1% + \MT@ifdefined@c@T{#1}{% + \xdef#1{#1}% + \ifMT@fontspec + \xdef#1{\expandafter\MT@scrubfeatures#1()\relax}% + \fi + \global\@onelevel@sanitize#1% + }% } \def\MT@define@set@key@size#1{% \define@key{MT@#1@set}{size}[]{% \MT@map@clist@n{##1}{% - \KV@@sp@def\MT@val{####1}% + \def\MT@val{####1}% \expandafter\MT@get@range\MT@val--\@nil \ifx\MT@val\relax \else \MT@exp@cs\MT@xadd @@ -1467,7 +1500,7 @@ time will almost certainly lead to undesired results. Have your choice!}% \define@key{MT@#1@set}{font}[]{% \MT@glet@nc{MT@#1list@font@\MT@curr@set@name}\@empty \MT@map@clist@n{##1}{% - \KV@@sp@def\MT@val{####1}% + \def\MT@val{####1}% \MT@ifstreq\MT@val*{\def\MT@val{*/*/*/*/*}}\relax \expandafter\MT@get@font\MT@val/////\@nil \MT@exp@two@n\g@addto@macro @@ -1521,87 +1554,97 @@ time will almost certainly lead to undesired results. Have your choice!}% \MT@define@set@key@size {#1}% \MT@define@set@key@font {#1}% } -\renewcommand*\UseMicrotypeSet[2][]{% - \KV@@sp@def\@tempa{#1}% - \MT@ifempty\@tempa{% +\def\UseMicrotypeSet{% + \MT@begin@catcodes + \MT@UseMicrotypeSet +} +\newcommand*\MT@UseMicrotypeSet[2][]{% + \MT@ifempty{#1}{% \MT@map@clist@c\MT@features{{\MT@use@set{##1}{#2}}}% }{% - \MT@map@clist@c\@tempa{{% - \KV@@sp@def\@tempa{##1}% - \MT@ifempty\@tempa\relax{% - \MT@is@feature{activation of set `#2'}{% + \MT@map@clist@n{#1}{{% + \MT@ifempty{##1}\relax{% + \MT@is@feature{##1}{activation of set `#2'}{% \MT@exp@one@n\MT@use@set - {\csname MT@rbba@\@tempa\endcsname}{#2}% + {\csname MT@rbba@##1\endcsname}{#2}% }% }% }}% }% + \MT@end@catcodes } \def\MT@use@set#1#2{% - \KV@@sp@def\@tempa{#2}% - \MT@ifdefined@n@TF{MT@#1@set@@\@tempa}{% - \MT@xdef@n{MT@#1@setname}{\@tempa}% + \MT@ifdefined@n@TF{MT@#1@set@@#2}{% + \MT@xdef@n{MT@#1@setname}{#2}% }{% \MT@ifdefined@n@TF{MT@#1@setname}\relax{% \MT@xdef@n{MT@#1@setname}{\@nameuse{MT@default@#1@set}}% }% \MT@error{% - The \@nameuse{MT@abbr@#1} set `\@tempa' is undeclared.\MessageBreak + The \@nameuse{MT@abbr@#1} set `#2' is undeclared.\MessageBreak Using set `\@nameuse{MT@#1@setname}' instead}{}% }% } -\renewcommand*\DeclareMicrotypeSetDefault[2][]{% - \KV@@sp@def\@tempa{#1}% - \MT@ifempty\@tempa{% +\def\DeclareMicrotypeSetDefault{% + \MT@begin@catcodes + \MT@DeclareMicrotypeSetDefault +} +\newcommand*\MT@DeclareMicrotypeSetDefault[2][]{% + \MT@ifempty{#1}{% \MT@map@clist@c\MT@features{{\MT@set@default@set{##1}{#2}}}% }{% - \MT@map@clist@c\@tempa{{% - \KV@@sp@def\@tempa{##1}% - \MT@ifempty\@tempa\relax{% - \MT@is@feature{declaration of default set `#2'}{% + \MT@map@clist@n{#1}{{% + \MT@ifempty{##1}\relax{% + \MT@is@feature{##1}{declaration of default set `#2'}{% \MT@exp@one@n\MT@set@default@set - {\csname MT@rbba@\@tempa\endcsname}{#2}% + {\csname MT@rbba@##1\endcsname}{#2}% }% }% }}% }% + \MT@end@catcodes } \def\MT@set@default@set#1#2{% - \KV@@sp@def\@tempa{#2}% - \MT@ifdefined@n@TF{MT@#1@set@@\@tempa}{% - \MT@xdef@n{MT@default@#1@set}{\@tempa}% + \MT@ifdefined@n@TF{MT@#1@set@@#2}{% + \MT@xdef@n{MT@default@#1@set}{#2}% }{% \MT@error{% - The \@nameuse{MT@abbr@#1} set `\@tempa' is not declared.\MessageBreak + The \@nameuse{MT@abbr@#1} set `#2' is not declared.\MessageBreak Cannot make it the default set. Using set\MessageBreak `all' instead}{}% \MT@xdef@n{MT@default@#1@set}{all}% }% } \let\MT@variants\@empty \def\DeclareMicrotypeVariants{% + \MT@begin@catcodes \@ifstar \MT@DeclareVariants {\let\MT@variants\@empty\MT@DeclareVariants}% } \def\MT@DeclareVariants#1{% \MT@map@clist@n{#1}{% - \KV@@sp@def\@tempa{##1}% + \def\@tempa{##1}% \@onelevel@sanitize\@tempa \xdef\MT@variants{\MT@variants{\@tempa}}% }% + \MT@end@catcodes } -\renewcommand*\DeclareMicrotypeAlias[2]{% - \edef\@tempa{\zap@space#1 \@empty}% - \edef\@tempb{\zap@space#2 \@empty}% +\def\DeclareMicrotypeAlias{% + \MT@begin@catcodes + \MT@DeclareMicrotypeAlias +} +\newcommand*\MT@DeclareMicrotypeAlias[2]{% + \def\@tempb{#2}% \@onelevel@sanitize\@tempb - \MT@ifdefined@n@T{MT@\@tempa @alias}{% + \MT@ifdefined@n@T{MT@#1@alias}{% \MT@warning{Alias font family `\@tempb' will override - alias `\@nameuse{MT@\@tempa @alias}'\MessageBreak - for font family `\@tempa'}}% - \MT@xdef@n{MT@\@tempa @alias}{\@tempb}% + alias `\@nameuse{MT@#1@alias}'\MessageBreak + for font family `#1'}}% + \MT@xdef@n{MT@#1@alias}{\@tempb}% \MT@ifdefined@c@T\MT@family{% \MT@glet\MT@familyalias\@tempb }% + \MT@end@catcodes } \def\LoadMicrotypeFile#1{% \edef\@tempa{\zap@space#1 \@empty}% @@ -1616,8 +1659,8 @@ time will almost certainly lead to undesired results. Have your choice!}% \edef\MT@curr@file{mt-\@tempa.cfg}% \MT@vinfo{... Loading configuration file \MT@curr@file}% }{% - \MT@warning{... Configuration file mt-\@tempa.cfg\MessageBreak - does not exist}% + \MT@warning{Configuration file mt-\@tempa.cfg\MessageBreak + does not exist}% }% \MT@end@catcodes \fi @@ -2068,9 +2111,9 @@ time will almost certainly lead to undesired results. Have your choice!}% } \let\MT@endinput\relax \ifx\MT@engine\relax - \MT@warning@nl{You don't seem to be using either pdftex, luatex, or xetex.\MessageBreak + \MT@warning@nl{You don't seem to be using pdftex, luatex or xetex.\MessageBreak `\MT@MT' only works with these engines.\MessageBreak - I will quit now.} + I will quit now} \MT@clear@options \else \input{microtype-\MT@engine tex.def} |