summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/microtype/microtype.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/microtype/microtype.sty')
-rw-r--r--Master/texmf-dist/tex/latex/microtype/microtype.sty98
1 files changed, 80 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/microtype/microtype.sty b/Master/texmf-dist/tex/latex/microtype/microtype.sty
index fb4c267d40f..a236b0af526 100644
--- a/Master/texmf-dist/tex/latex/microtype/microtype.sty
+++ b/Master/texmf-dist/tex/latex/microtype/microtype.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% microtype.dtx (with options: `package')
+%% microtype.dtx (with options: `package,lua')
%%
%% ------------------------------------------------------------------------
%%
@@ -28,7 +28,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage
{microtype}
- [2008/06/04 v2.3b
+ [2008/11/11 v2.3c
Micro-typography with pdfTeX (RS)%
]
\def\MT@MT
@@ -222,15 +222,10 @@
\def\MT@requires@pdftex#1{%
\ifnum\MT@pdftex@no<#1 \expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi
}
-\ifx\directlua\@undefined\else
- \MT@error
- {`\MT@MT'
- only works with luatex if you generate%
- \MessageBreak
- the package with the `lua' option%
- }
- {}
-\fi
+\def\MT@requires@luatex{%
+ \ifx\directlua\@undefined\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi
+}
+\def\MT@lua{\directlua0}
\def\MT@glet{\global\let}
\def\MT@exp@cs#1#2{\expandafter#1\csname#2\endcsname}
\def\MT@exp@gcs#1#2{\begingroup\expandafter\endgroup\expandafter#1\csname#2\endcsname}
@@ -270,13 +265,16 @@
^^Q \expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi
}
\def\MT@detokenize@n#1{%
-^^X \detokenize\expandafter{%
- \string#1%
-^^X }%
+^^X \expandafter\MT@rem@last@space\detokenize{#1} \@nil
+^^Q \string#1%
}
\def\MT@detokenize@c#1{%
-^^X \detokenize\expandafter\expandafter\expandafter{\expandafter\string#1}%
-^^Q \MT@exp@two@c\zap@space\strip@prefix\meaning#1 \@empty
+^^X \MT@exp@one@n\MT@detokenize@n#1%
+^^Q \MT@exp@two@c\MT@rem@last@space\strip@prefix\meaning#1 \@nil
+}
+\def\MT@rem@last@space#1 #2{#1%
+ \ifx\@nil#2\else \space
+ \expandafter\MT@rem@last@space\expandafter#2\fi
}
\begingroup
\catcode`\%=12
@@ -290,6 +288,16 @@
}
\endgroup
\MT@requires@pdftex6{
+ \MT@requires@luatex{
+ \def\MT@ifint#1{%
+ \csname \MT@lua{
+ if string.find("\luaescapestring{#1}","^-*[0-9]+ *$")
+ then tex.write("@firstoftwo")
+ else tex.write("@secondoftwo")
+ end}%
+ \endcsname
+ }
+ }{
\def\MT@ifint#1{%
\ifcase\pdfmatch{^-*[0-9]+ *$}{#1}\relax
\expandafter\@secondoftwo
@@ -297,6 +305,7 @@
\expandafter\@firstoftwo
\fi
}
+ }
}{
\def\MT@ifint#1{%
\if!\ifnum9<1#1!\else?\fi
@@ -307,6 +316,17 @@
}
}
\MT@requires@pdftex6{
+ \MT@requires@luatex{
+ \def\MT@ifdimen#1{%
+ \csname \MT@lua{
+ if (string.find("\luaescapestring{#1}","^-*[0-9]+(\@percentchar a*) *$") or
+ string.find("\luaescapestring{#1}","^-*[0-9]*[.,][0-9]+(\@percentchar a*) *$"))
+ then tex.write("@firstoftwo")
+ else tex.write("@secondoftwo")
+ end}%
+ \endcsname
+ }
+ }{
\def\MT@ifdimen#1{%
\ifcase\pdfmatch{^([0-9]+([.,][0-9]+)?|[.,][0-9]+)%
(em|ex|cm|mm|in|pc|pt|dd|cc|bp|sp|nd|nc|px)? *$}{#1}\relax
@@ -315,6 +335,7 @@
\expandafter\@firstoftwo
\fi
}
+ }
}{
\def\MT@ifdimen#1{%
\setbox\z@=\hbox{%
@@ -335,6 +356,16 @@
\fi
}
\MT@requires@pdftex5{
+ \MT@requires@luatex{
+ \def\MT@ifstreq#1#2{%
+ \csname \MT@lua{
+ if "\luaescapestring{#1}" == "\luaescapestring{#2}"
+ then tex.write("@firstoftwo")
+ else tex.write("@secondoftwo")
+ end}%
+ \endcsname
+ }
+ }{
\def\MT@ifstreq#1#2{%
\ifcase\pdfstrcmp{#1}{#2}\relax
\expandafter\@firstoftwo
@@ -342,6 +373,7 @@
\expandafter\@secondoftwo
\fi
}
+ }
}{
\def\MT@ifstreq#1#2{%
\edef\MT@res@a{#1}%
@@ -1512,7 +1544,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\def\MT@temp*##1{\ifhmode\hskip\MT@outer@space
\fi}%
\ifcat\egroup\noexpand\MT@tr@outer@next
- \unkern\egroup
+ \ifhmode\unkern\fi\egroup
\MT@set@curr@ok
\MT@set@curr@os
\def\MT@temp*{\afterassignment\MT@tr@outer@r\let\x=}%
@@ -2610,6 +2642,13 @@ time will almost certainly lead to undesired results. Have your choice!}%
\define@key{MT@#1@c}{context}[]{\MT@ifempty{##1}\relax{\def\MT@extra@context{##1}}}%
}
\MT@requires@pdftex7{
+ \MT@requires@luatex{
+ \define@key{MT@ex@c}{context}[]{%
+ \MT@error{Expansion contexts currently don't work with luatex.\MessageBreak
+ Ignoring `context' key\on@line}%
+ {Use pdftex instead.}%
+ }
+ }{
\define@key{MT@ex@c}{context}[]{%
\MT@ifempty{#1}\relax{%
\MT@glet\MT@copy@font\MT@copy@font@
@@ -2643,6 +2682,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\fi
}
}
+ }
}{
\define@key{MT@ex@c}{context}[]{%
\MT@error{Expansion contexts only work with pdftex 1.40.4\MessageBreak
@@ -3042,6 +3082,14 @@ time will almost certainly lead to undesired results. Have your choice!}%
\fi
}
\MT@requires@pdftex7{
+ \MT@requires@luatex{
+ \MT@def@bool@opt{copyfonts}{%
+ \csname if\@tempa\endcsname
+ \MT@error{The `copyfonts' option doesn't work with luatex}
+ {Use pdftex instead.}%
+ \fi
+ }
+ }{
\MT@def@bool@opt{copyfonts}{%
\csname if\@tempa\endcsname
\MT@glet\MT@copy@font\MT@copy@font@
@@ -3049,6 +3097,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@glet\MT@copy@font\relax
\fi
}
+ }
}{
\MT@def@bool@opt{copyfonts}{%
\csname if\@tempa\endcsname
@@ -3211,6 +3260,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@define@optionX{protrusion}\pdfprotrudechars
\MT@define@optionX{expansion}\pdfadjustspacing
\MT@requires@pdftex6{
+ \MT@requires@luatex\@firstofone{
\def\MT@define@optionX@#1#2{%
\define@key{MTX}{#1}[true]{%
\MT@map@clist@n{##1}{%
@@ -3243,6 +3293,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@define@optionX@{kerning}{\pdfprependkern\@tempcnta
\pdfappendkern \@tempcnta}
\@gobble
+ }
}\@firstofone
{\define@key{MTX}{tracking}[true]{\MT@warning{Ignoring tracking setup}}
\define@key{MTX}{kerning}[true]{\MT@warning{Ignoring kerning setup}}
@@ -3279,7 +3330,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
}
\def\MT@getkey#1=#2\@nil{#1}
\MT@ProcessOptionsWithKV{MT}
-\MT@addto@setup{%
+\MT@addto@setup{
\ifMT@draft
\MT@warning@nl{`draft' option active.\MessageBreak
Disabling all micro-typographic extensions.\MessageBreak
@@ -3422,31 +3473,42 @@ time will almost certainly lead to undesired results. Have your choice!}%
\fi
}
\MT@requires@pdftex6{
+ \def\MT@warn@lua#1{%
+ \MT@error{The `#1' feature doesn't currently work\MessageBreak with luatex}
+ {Use pdftex instead.}%
+ \MT@let@nc{MT@#1}\relax
+ }
\MT@addto@setup{%
\ifMT@tracking
+ \MT@requires@luatex{\MT@warn@lua{tracking}}{
\edef\MT@active@features{\MT@active@features,tr}
\MT@info@nl{Tracking enabled}
\MT@check@active@set{tr}
\ifMT@protrusion\else\pdfprotrudechars\@ne\fi
+ }
\else
\let\MT@tracking\relax
\MT@info@nl{No tracking}
\fi
\ifMT@spacing
+ \MT@requires@luatex{\MT@warn@lua{spacing}}{
\edef\MT@active@features{\MT@active@features,sp}
\pdfadjustinterwordglue\@ne
\MT@info@nl{Adjustment of interword spacing enabled}
\MT@check@active@set{sp}
+ }
\else
\let\MT@spacing\relax
\MT@info@nl{No adjustment of interword spacing}
\fi
\ifMT@kerning
+ \MT@requires@luatex{\MT@warn@lua{kerning}}{
\edef\MT@active@features{\MT@active@features,kn}
\pdfprependkern\@ne
\pdfappendkern\@ne
\MT@info@nl{Adjustment of character kerning enabled}
\MT@check@active@set{kn}
+ }
\else
\let\MT@kerning\relax
\MT@info@nl{No adjustment of character kerning}