diff options
author | Karl Berry <karl@freefriends.org> | 2011-01-14 00:25:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-01-14 00:25:16 +0000 |
commit | 4ea37220f304500ab9573224da04ca00682233e1 (patch) | |
tree | adc99eee671e835d2b8fd650e85210d169eaf2ea /Master/texmf-dist/tex/latex/mylatexformat | |
parent | d22dfbf7f3c5bfdfb94fb2828a92136d1f8ab821 (diff) |
mylatexformat
git-svn-id: svn://tug.org/texlive/trunk@21058 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mylatexformat')
-rw-r--r-- | Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx | 106 |
1 files changed, 63 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx b/Master/texmf-dist/tex/latex/mylatexformat/mylatexformat.ltx index 3d1ce36b4fb..53947dad0f8 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/30 v2.1 - Use mylatexformat.ltx to make a format based on the preamble of any LaTeX file +%% mylatexformat : 2011/01/12 v3.0 - 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 @@ -21,13 +21,13 @@ %% mylatexformat.ltx, mylatexformat.pdf, mylatexformat.ins %% %% mylatexformat - Use mylatexformat.ltx to make a format based on the preamble of any LaTeX file -%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr> +%% Copyright (C) 2010-2011 by Florent Chervet <florent.chervet@free.fr> %% %%% _____________________________________________________________________ %%% mylatexformat.ltx %%% ^^^^^^^^^^^^^^^^^ %%% From an original idea by David Carlisle - mylatex.ltx 1994/09/27 -%%% © lppl 2010 - F Chervet - 2010/08/09 +%%% ^^a9 lppl 2010-2011 - F Chervet - 2011/01/12 %%% _____________________________________________________________________ %%% %%% Use this file to make a format based on the preamble of any LaTeX @@ -80,7 +80,7 @@ %%% -jobname="Mon Beau Format Perso" %%% "&pdflatex" mylatexformat.ltx "Mon Fichier TeX.tex" %%% -%%% "Mon Beau Format Perso.fmt" (en Français dans le texte) will be created +%%% "Mon Beau Format Perso.fmt" (en Fran^^e7ais dans le texte) will be created %%% (or overwritten) in the current working directory. %%% %%% Using the format --------------------------------------------------- @@ -178,22 +178,37 @@ %% %% Save the original definition. \makeatletter -\let\etex@primitive@openout\openout +\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.) -\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}}% +\let\MYLATEX@ltx@begin \begin +\def\begin#1{% + \expandafter \ifx\csname#1\endcsname\document + \expandafter\expandafter\expandafter\endofdump + \expandafter\@gobble + \else \expandafter\MYLATEX@ltx@begin + \fi{#1}% }% \begin %% The version of \document to use on the initex run. %% Just preloads some fonts, puts back \document and \openout, @@ -214,9 +229,10 @@ \ifdefined\footnotesize\footnotesize\fi \ifdefined\tiny\tiny\fi }}% - \let\openout\etex@primitive@openout% just in case - normally not necessary - \let\begin\MYLATEX@ltx@begin - \let\MYLATEX@ltx@begin\@undefined + \let\openout \etex@primitive@openout% just in case - normally not necessary + \let\begin \MYLATEX@ltx@begin + \let\MYLATEX@ltx@begin \@undefined + \MYLATEX@cmap@hook \makeatother \everyjob\expandafter{\the\everyjob \begingroup @@ -230,14 +246,17 @@ } %% Banner for \everyjob. \edef\MYLATEXcustomised#1#2#3\typeout#4{% - \noexpand\typeout{==============================================================================}% - \noexpand\typeout{JOB NAME\noexpand\@spaces\noexpand\@spaces\noexpand\space\noexpand\space:% + \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:}% #3% - \noexpand\typeout{==============================================================================}% - \noexpand\typeout{(mylatexformat)Info: starting reading document% + \noexpand\typeout{% + ==============================================================================}% + \noexpand\typeout{(mylatexformat)Info: start reading document \string"\noexpand\jobname\string"}% }% \MYLATEXcustomised %% While the preamble is being skipped (inside a group) @@ -252,33 +271,34 @@ %% 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}% -}% Leaving simple groupe (level 1) => start reading document +\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 %% 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% |