From e16ae21498b4050f8b5da37be8d641b0bb82836d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 11 Sep 2010 23:11:32 +0000 Subject: mylatexformat 2.9 (11aug10) git-svn-id: svn://tug.org/texlive/trunk@19664 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/mylatexformat/mylatexformat.ltx | 96 +++++++++++----------- 1 file changed, 46 insertions(+), 50 deletions(-) (limited to 'Master/texmf-dist/tex/latex/mylatexformat') diff --git a/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx b/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx index 90656e39f6b..3d1ce36b4fb 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 : 2010/06/20 v2 - Use mylatexformat.ltx to make a format based on the preamble of any LaTeX file +%% mylatexformat : 2010/06/30 v2.1 - 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 -%%% © lppl 2010 - F Chervet - 2010/04/25 +%%% © lppl 2010 - F Chervet - 2010/08/09 %%% _____________________________________________________________________ %%% %%% Use this file to make a format based on the preamble of any LaTeX @@ -165,7 +165,9 @@ %% commands can be placed after such a comment and they will be %% executed. %% -------------------------------------------------------------------- +%% %%\RequirePackage{etex}% RequirePackage may be used before the class +%% %% In principle \openout stream= filename need not be space terminated, %% and need not be immediate, but this covers \makeindex \makeglossary %% and index package's \newindex which are all the cases of \openout @@ -178,22 +180,21 @@ \makeatletter \let\etex@primitive@openout\openout \let\ltx@listfiles\listfiles -\def\openout#1 {\g@addto@macro\MYLATEXopens{\immediate\openout#1 }} -\def\MYLATEXopens{% +\def\openout#1 {\g@addto@macro\MYLATEX@opens{\immediate\openout#1 }} +\def\MYLATEX@opens{% \let\openout\etex@primitive@openout - \let\etex@primitive@openout\ltx@undefined -}% \MYLATEXopens + \let\etex@primitive@openout\@undefined +}% \MYLATEX@opens %% \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.) -\let\MYLATEX@latex@begin\begin -\def\begin#1{% - \expandafter\ifx\csname#1\endcsname\document - \expandafter\expandafter\expandafter\endofdump\expandafter\@gobble - \else\expandafter\MYLATEX@latex@begin - \fi{#1}} +\let\MYLATEX@ltx@begin\begin +\def\begin#1{\csname @\expandafter\ifx\csname#1\endcsname\document first\else second\fi oftwo\endcsname + \endofdump + {\MYLATEX@ltx@begin{#1}}% +}% \begin %% 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, @@ -214,19 +215,20 @@ \ifdefined\tiny\tiny\fi }}% \let\openout\etex@primitive@openout% just in case - normally not necessary - \let\begin\MYLATEX@latex@begin - \let\MYLATEX@latex@begin\@undefined - \the\MYLATEX@hook\MYLATEX@hook{}% + \let\begin\MYLATEX@ltx@begin + \let\MYLATEX@ltx@begin\@undefined \makeatother \everyjob\expandafter{\the\everyjob \begingroup \listfiles\let\listfiles\ltx@listfiles \expandafter\MYLATEXcustomised\@dofilelist - \endgroup}% - \catcode`\\=13\relax% + \endgroup + \MYLATEX@scan@preamble + }% \let\endofdump\relax \dump } +%% Banner for \everyjob. \edef\MYLATEXcustomised#1#2#3\typeout#4{% \noexpand\typeout{==============================================================================}% \noexpand\typeout{JOB NAME\noexpand\@spaces\noexpand\@spaces\noexpand\space\noexpand\space:% @@ -237,7 +239,7 @@ \noexpand\typeout{==============================================================================}% \noexpand\typeout{(mylatexformat)Info: starting reading document% \string"\noexpand\jobname\string"}% -} +}% \MYLATEXcustomised %% While the preamble is being skipped (inside a group) %% the EOL is active and defined to grab each line and %% inspect it looking for : @@ -250,39 +252,33 @@ %% 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`\/=0 % - /catcode`\\=13 % - /catcode`/& 8 % - /gdef\{/catcode`/\=0 /catcode`/^^M=13 ^^M}% /catcode`/%=9 ^^M}% -%% - /long/gdef^^M{/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/def/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% - /MYLATEXopens##2}% - /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}% + \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}% }% Leaving simple groupe (level 1) => start reading document -\newtoks\MYLATEX@hook -\def\AtEndOfDump{\addto@hook\MYLATEX@hook} -\AtEndOfDump{\let\AtEndOfDump\@undefined} %% 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% -- cgit v1.2.3