diff options
author | Karl Berry <karl@freefriends.org> | 2011-02-13 23:32:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-02-13 23:32:50 +0000 |
commit | 0fe0153ae1f041e1e5e21dc0079587f5dc9612c2 (patch) | |
tree | 0796bff32d697b34ba3dccf8865bf706d3e0a521 /Master/texmf-dist/tex/latex | |
parent | 8c01e7e9bb109cc006bac6234088ef1c55a7d072 (diff) |
mylatexformat 3.4 (13feb11)
git-svn-id: svn://tug.org/texlive/trunk@21392 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx | 199 |
1 files changed, 92 insertions, 107 deletions
diff --git a/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx b/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx index 629824038d0..cb5a76ae676 100644 --- a/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx +++ b/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% mylatexformat : 2011/01/19 v3.3 - Use mylatexformat.ltx to make a format based on the preamble of any LaTeX file +%% mylatexformat : 2011/02/12 v3.4 - Use mylatexformat.ltx to make a format based on the preamble of any LaTeX file %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -27,7 +27,7 @@ %%% mylatexformat.ltx %%% ^^^^^^^^^^^^^^^^^ %%% From an original idea by David Carlisle - mylatex.ltx 1994/09/27 -%%% ^^a9 lppl 2010-2011 - F Chervet - 2011/01/19 v3.3 +%%% ^^a9 lppl 2010-2011 - F Chervet - 2011/02/12 v3.4 %%% _____________________________________________________________________ %%% %%% Use this file to make a format based on the preamble of any LaTeX @@ -175,96 +175,90 @@ %% Thanks to Ross Moore for pointing out \AtBeginDocument is too late %% eg changebar package *closes* the stream in \AtBeginDocument, so need %% to make sure it is opened before that. Make a special purpose hook. -%% -%% Save the original definition. \makeatletter -\let\etex@primitive@openout \openout -\let\ltx@listfiles\listfiles -\def\openout#1 {\g@addto@macro\MYLATEX@opens{\immediate\openout#1 }} -\def\MYLATEX@opens{% - \let\openout\etex@primitive@openout - \let\etex@primitive@openout\@undefined -}% \MYLATEX@opens -\def\MYLATEX@cmap@hook{% - {\@for\x:={lae,lfe,lgr,ot1,ot1tt,ot6,t1,t2a,t2b,t2c,t5}\do{% - \expandafter\MYLATEX@cmap@h@@k \x\@nil - \uppercase\expandafter{\expandafter\MYLATEX@cmap@h@@k \x\@nil}}}% - \global\let\MYLATEX@cmap@h@@k \@undefined - \global\let\MYLATEX@cmap@hook \@undefined -}% \MYLATEX@cmap@hook -\def\MYLATEX@cmap@h@@k #1\@nil{% - \ifcsname cmap@set@#1\endcsname - \global\expandafter\let\csname cmap@set@#1\endcsname \@undefined - \fi -}% \MYLATEX@cmap@h@@k %% \begin is overloaded in order to stop \dump at begin document %% if the macro \endofdump is not given somewhere in the preamble. %% Rem: it is NOT POSSIBLE to redefine \document, for the macro %% \document is changed or patched by some classes or packages %% (auxhook, etoolbox etc.) -{ - \def\x #1{\gdef\begin ##1{\MYLATEX@StopAtdocument{##1}#1}% - }\expandafter\x\expandafter{\begin{#1}}% -} -\def\MYLATEX@restore@begin{% - \long\def\MYLATEX@restore@begin##1\MYLATEX@StopAtdocument##2##3\@nil{% - \gdef\begin ####1{##1##3}% - }\expandafter\MYLATEX@restore@begin\begin{##1}\@nil - \global\let\MYLATEX@restore@begin \@undefined - \global\let\MYLATEX@StopAtdocument \@undefined -}% \MYLATEX@restore@begin -\def\MYLATEX@StopAtdocument#1{% - \expandafter\ifx\csname#1\endcsname\document - \expandafter\endofdump\fi +\begingroup \def\x #1{\endgroup + \gdef\begin ##1{\MYLATEX@StopAtdocument{##1}#1} +}\expandafter\x\expandafter{\begin{#1}} +\def\MYLATEX@StopAtdocument #1{\expandafter + \ifx\csname #1\endcsname\document \expandafter\endofdump \fi }% \MYLATEX@StopAtdocument -%% The version of \document to use on the initex run. -%% Just preloads some fonts, puts back \document and \openout, -%% sets up the banner to display the file list of files preloaded, -%% then sets up some special catcodes so the preamble will be -%% skipped on normal runs with the new format. -\def\endofdump{% -%% Force some font preloading. - {\setbox\z@\hbox{% +\let\MYLATEX@openout \openout +\def\openout#1 {\g@addto@macro\MYLATEX@opens{\immediate\openout#1 }} +\def\MYLATEX@opens {\let\MYLATEX@opens \@undefined} +\def\MYLATEX@cleanup {\let\MYLATEX@cleanup \@undefined + \def\MYLATEX@StopAtdocument ##1\MYLATEX@StopAtdocument ##2##3\@nil{% + \gdef\begin ####1{##1##3}% + }\expandafter\MYLATEX@StopAtdocument \begin{##1}\@nil + \let\openout \MYLATEX@openout + \let\MYLATEX@openout \@undefined + \let\MYLATEX@StopAtdocument \@undefined +}% \MYLATEX@cleanup +\def\MYLATEX@fontpreloading{\let\MYLATEX@fontpreloading \@undefined + \begingroup \setbox0=\hbox {% $$% math (not bold, some setups don't have \boldmath) - \normalfont% normal - {\bfseries\itshape}{\itshape}\ttfamily\sffamily - \ifdefined\large\large\fi - \ifdefined\Large\Large\fi - \ifdefined\LARGE\LARGE\fi - \ifdefined\Huge\Huge\fi - \ifdefined\small\small\fi - \ifdefined\footnotesize\footnotesize\fi - \ifdefined\tiny\tiny\fi - }}% - \let\openout \etex@primitive@openout% just in case - normally not necessary - \MYLATEX@restore@begin - \MYLATEX@cmap@hook + \def\x {\bfseries\itshape}{\itshape}\ttfamily\sffamily + \normalfont \x + \ifdefined\large \large \x \fi + \ifdefined\Large \Large \x \fi + \ifdefined\LARGE \LARGE \x \fi + \ifdefined\Huge \Huge \x \fi + \ifdefined\small \small \x \fi + \ifdefined\footnotesize \footnotesize \x \fi + \ifdefined\tiny \tiny \x \fi}% + \@for\x:={lae,lfe,lgr,ot1,ot1tt,ot6,t1,t2a,t2b,t2c,t5}\do{% + \ifcsname cmap@set@\x\endcsname \global\expandafter + \let\csname cmap@set@\x\endcsname \@undefined \fi + \uppercase\expandafter{\expandafter\def\expandafter\x\expandafter{\x}}% + \ifcsname cmap@set@\x\endcsname \global\expandafter + \let\csname cmap@set@\x\endcsname \@undefined \fi}% + \endgroup +}% \MYLATEX@fontpreloading +\let\MYLATEX@listfiles \listfiles +\def\endofdump{\let\endofdump \relax + \MYLATEX@cleanup + \MYLATEX@fontpreloading \makeatother \everyjob\expandafter{\the\everyjob - \begingroup - \listfiles\let\listfiles\ltx@listfiles - \expandafter\MYLATEXcustomised\@dofilelist - \endgroup - \MYLATEX@scan@preamble - }% - \let\endofdump\relax + \let\MYLATEX@temp \listfiles + {% + \MYLATEX@listfiles + \global\let\MYLATEX@listfiles \@undefined + \expandafter\MYLATEX@banner \@dofilelist + }% + \let\listfiles \MYLATEX@temp % to be able to used \listfiles once after the format + \let\MYLATEX@temp \@undefined + \MYLATEX@scanpreamble}% \dump - } +}% \endofdump %% Banner for \everyjob. -\edef\MYLATEXcustomised#1#2#3\typeout#4{% - \noexpand\typeout{% - ==============================================================================}% - \noexpand\typeout{% - JOB NAME\noexpand\@spaces\noexpand\@spaces\noexpand\space\noexpand\space:% - \string"\noexpand\jobname\string"}% - \noexpand\typeout{CUSTOMISED FORMAT :\string"\jobname\string"}% - \noexpand\typeout{PRELOADED FILES:}% +{\@makeother\" % just in case +\xdef\MYLATEX@banner #1#2#3\typeout #4{% + \global\let\noexpand\MYLATEX@banner \noexpand\@undefined + \newlinechar`\noexpand\^^J\message{% + ==============================================================================^^J% + JOB NAME\@spaces\@spaces\space: "\noexpand\jobname"^^J% + CUSTOMISED FORMAT: "\jobname"^^J% + PRELOADED FILES:^^J}% #3% - \noexpand\typeout{% + \message{% + ==============================================================================}% +}% \MYLATEX@banner +\long\gdef\MYLATEX@start #1#2{\global\let\MYLATEX@start \@undefined + \message{% + (mylatexformat)Info: start reading document "\jobname"^^J% + (mylatexformat)\@spaces\space\on@line. + (\ifcase#1 \string\endofdump\else\string\begin{document}\fi)^^J% ==============================================================================}% - \noexpand\typeout{(mylatexformat)Info: start reading document - \string"\noexpand\jobname\string"}% -}% \MYLATEXcustomised + \endgroup + \MYLATEX@opens\relax #2% +}% \MYLATEX@start +}% \catcode group + %% While the preamble is being skipped (inside a group) %% the EOL is active and defined to grab each line and %% inspect it looking for : @@ -276,35 +270,26 @@ %% first TeX command in the file, so as to avoid problems with %% the special processing that TeX does on the first line, choosing %% the format, or the file name etc. -{% Entering simple groupe (level 1) => skip the preamble -\catcode`\^^M=\active -\catcode`\& 8 % -\long\gdef\MYLATEX@start#1#2{% - \typeout{(mylatexformat)\@spaces\space\on@line.\space(% - \ifcase#1 \string\endofdump\else\string\begin{document}\fi)}% - \typeout{% - ==============================================================================}% - \endgroup% - \catcode`\^^M=5\relax \let^^M\par% - \MYLATEX@opens#2% -}% \MYLATEX@start -\long\gdef\MYLATEX@scan@preamble{\catcode`\^^M=13\relax% - \begingroup% - \long\def\MYLATEX@endofdump##1\endofdump##2##3&##4##5##6\MYLATEX{##5}% - \long\def\MYLATEX@endofdump@cs##1\csname endofdump\endcsname##2##3&##4##5##6\MYLATEX{##5}% - \long\def\MYLATEX@document ##1document##2##3&##4##5##6\MYLATEX{##5}% - \long\def\MYLATEX@begindocument##1\begin##2##3\MYLATEX##4{% - \MYLATEX@document ##2document&&{\MYLATEX@start1{##4}}{^^M}\MYLATEX}% - \long\gdef^^M##1^^M{% - \MYLATEX@endofdump##1\endofdump&&% - {\MYLATEX@start0{##1}}% - {\MYLATEX@endofdump@cs##1\csname endofdump\endcsname&&% - {\MYLATEX@start0{##1}}% - {\MYLATEX@begindocument##1\begin\relax\MYLATEX{##1}}% - \MYLATEX}% - \MYLATEX}% -^^M}% \MYLATEX@scan@preamble -}% Leaving simple group (level 1) => start reading document +{% catcode group +\catcode`\^^M=13 \catcode`\& =8 % +\long\gdef\MYLATEX@scanpreamble {% + \begingroup \catcode`\^^M=13% + \long\def\MYLATEX@endofdump ##1\endofdump##2##3&##4##5##6\MYLATEX {##5}% + \long\def\MYLATEX@csendofdump ##1\csname endofdump\endcsname##2##3&##4##5##6\MYLATEX {##5}% + \long\def\MYLATEX@document ##1document##2##3&##4##5##6\MYLATEX {##5}% + \long\def\MYLATEX@begindocument ##1\begin##2##3\MYLATEX##4{% + \MYLATEX@document ##2document&&{\MYLATEX@start1{##4}}{^^M}\MYLATEX}% + \long\def^^M##1^^M{% + \MYLATEX@endofdump##1\endofdump&&% + {\MYLATEX@start 0{##1}}% + {\MYLATEX@csendofdump ##1\csname endofdump\endcsname&&% + {\MYLATEX@start 0{##1}}% + {\MYLATEX@begindocument ##1\begin\relax\MYLATEX{##1}}% + \MYLATEX}% + \MYLATEX}% + ^^M% +}% \MYLATEX@scanpreamble +}% catcode group %% Trick lookahead to allow mylatex.ltx and the document filename to be %% given on the same command line. (initex &latex mylatex.ltx {abc.tex}) \expandafter\input\endinput% |