diff options
Diffstat (limited to 'macros/latex/contrib/mylatexformat/mylatexformat.dtx')
-rw-r--r-- | macros/latex/contrib/mylatexformat/mylatexformat.dtx | 991 |
1 files changed, 991 insertions, 0 deletions
diff --git a/macros/latex/contrib/mylatexformat/mylatexformat.dtx b/macros/latex/contrib/mylatexformat/mylatexformat.dtx new file mode 100644 index 0000000000..05d5d7e8cd --- /dev/null +++ b/macros/latex/contrib/mylatexformat/mylatexformat.dtx @@ -0,0 +1,991 @@ +% \iffalse meta-comment +% 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 +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% +% This work consists of the main source file mylatexformat.dtx +% and the derived files +% mylatexformat.ltx, mylatexformat.pdf, mylatexformat.ins +% +% Unpacking: +% (a) If mylatexformat.ins is present: +% etex mylatexformat.ins +% (b) Without mylatexformat.ins: +% etex mylatexformat.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{mylatexformat.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (pdf)latex mylatexformat.dtx +% Copyright (C) 2010-2011 by Florent Chervet <florent.chervet@free.fr> +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package 2011/02/12 v3.4 - Use mylatexformat.ltx to make a format based on the preamble of any LaTeX file*} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated 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 +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt + +This work consists of the main source file mylatexformat.dtx +and the derived files + 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-2011 by Florent Chervet <florent.chervet@free.fr> + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{mylatexformat.ins}{\from{mylatexformat.dtx}{install}}% + \file{mylatexformat.ltx}{\from{mylatexformat.dtx}{package}}% +} + +\askforoverwritefalse +\generate{% + \file{mylatexformat.drv}{\from{mylatexformat.dtx}{driver}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* mylatexformat.ltx} +\Msg{*} +\Msg{* To produce the documentation run the file `mylatexformat.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\edef\thisfile{\jobname} +\def\thisinfo{Make a format based on the preamble of any \texorpdfstring{\LaTeX{}}{LaTeX} file} +\def\thisdate{2011/02/12} +\def\thisversion{3.4} +\let\loadclass\LoadClass +\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}} +{\makeatletter{\endlinechar`\^^J\obeyspaces + \gdef\ErrorUpdate#1=#2,{\@ifpackagelater{#1}{#2}{}{\let\CheckDate\errmessage\toks@\expandafter{\the\toks@ + \thisfile-documentation: updates required ! + package #1 must be later than #2 + to compile this documentation.}}}}% + \gdef\CheckDate#1{{\let\CheckDate\relax\toks@{}\@for\x:=#1\do{\expandafter\ErrorUpdate\x,}\CheckDate\expandafter{\the\toks@}}}} +\AtBeginDocument{\DeleteShortVerb{\|}\CheckDate{interfaces=2011/01/26,tabu=2011/01/26}} +\PassOptionsToPackage{svgnames}{xcolor} +\PassOptionsToPackage{hyperfootnotes}{hyperref} +\documentclass[a4paper,oneside]{ltxdoc} +\usepackage[latin1]{inputenc} +\usepackage[american]{babel} +\usepackage[T1]{fontenc} +\usepackage{etex,etoolbox,geometry,lastpage,xspace,xcolor,bbding,txfonts,atveryend,moresize,relsize} +\usepackage{tocloft,titlesec,graphicx,fancyhdr,framed,multirow,makecell,tabu,enumitem,needspace} +\usepackage{holtxdoc,bookmark,embedfile,tabu,keycommand} +\usepackage{microtype} +\usepackage{interfaces} +\usetikz{basic} +\csname endofdump\endcsname +\CodelineNumbered +\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}} +\lastlinefit999 +\geometry{top=0pt,includeheadfoot,headheight=7mm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=14mm} +\hypersetup{% + pdftitle={The mylatexformat package}, + pdfsubject={Use mylatexformat.ltx to make a format based on the preamble of any LaTeX file}, + pdfauthor={Florent CHERVET}, + colorlinks,linkcolor=reflink, + pdfstartview={FitH}, + pdfkeywords={tex, e-tex, latex, package, format, formats, pdfTeX}, + bookmarksopen=true,bookmarksopenlevel=2} +\embedfile{\thisfile.dtx} +\begin{document} + \DocInput{\thisfile.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{317} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs,\~,\@ifpackagelater} +% \DoNotIndex{\ttfamily,\tiny,\sffamily,\small,\normalfont,\newindex,\makeindex,\makeglossary,\LARGE,\Large,\large,\itshape,\immediate} +% \DoNotIndex{\&,\/,\=,\@dofilelist,\@spaces,\@undefined,\^,\active,\bfseries,\boldmath,\etex@primitive@openout,\footnotesize,\g@addto@macro,\Huge} +% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo} +% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} +% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} +% \DoNotIndex{\filename,\fileversion,\filedate,\let} +% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter} +% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography} +% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment} +% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi} +% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup} +% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine} +% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem} +% \DoNotIndex{\z@,\wd,\wheremsg,\vrule,\voidb@x,\verb,\bibitem} +% \DoNotIndex{\FrameCommand,\MakeFramed,\FrameRestore,\hskip,\hfil,\hfill,\hsize,\hspace,\hss,\hbox,\hb@xt@,\endMakeFramed,\escapechar} +% \DoNotIndex{\do,\date,\if@tempswa,\@tempdima,\@tempboxa,\@tempswatrue,\@tempswafalse,\ifdefined,\ifhmode,\ifmmode,\cr} +% \DoNotIndex{\box,\author,\advance,\multiply,\Command,\outer,\next,\leavevmode,\kern,\title,\toks@,\trcg@where,\tt} +% \DoNotIndex{\the,\width,\star,\space,\section,\subsection,\textasteriskcentered,\textwidth} +% \DoNotIndex{\",\:,\@empty,\@for,\@gtempa,\@latex@error,\@namedef,\@nameuse,\@tempa,\@testopt,\@width,\\,\m@ne,\makeatletter,\makeatother} +% \DoNotIndex{\maketitle,\parindent,\setbox,\x,\kernel@ifnextchar} +% \DoNotIndex{\KVS@CommaComma,\KVS@CommaSpace,\KVS@EqualsSpace,\KVS@Equals,\KVS@Global,\KVS@SpaceEquals,\KVS@SpaceComma,\KVS@Comma} +% \DoNotIndex{\DefineShortVerb,\DeleteShortVerb,\UndefineShortVerb,\MakeShortVerb,\endinput} +% +% \let\ClearPage\clearpage +% \makeatletter +% \catcode`\§ \active \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}} +% \newrobustcmd\Xspace{\ifnum\catcode`\ =\active\else\expandafter\xspace\fi} +% \newrobustcmd*\stform{\ifincsname\else\expandafter\@stform\fi} +% \newrobustcmd*\@stform{\@ifnextchar*{\@@stform[]\textasteriskcentered\@gobble}\@@stform} +% \newrobustcmd*\@@stform[2][\string]{\textttbf{#1#2}\Xspace} +% +% \newrobustcmd*\thispackage{\@ifstar +% {\xpackage{{\thisfile}}\Xspace} +% {\xpackage{{\pkgcolor\thisfile}}\Xspace}} +% \def\ThisPackage{\Xpackage{\thisfile}\xspace} +% \def\CTANpackage#1{\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/#1.html}{\xpackage{#1}}} +% \def\Xpackage{\@dblarg\X@package} +% \def\X@package[#1]#2{\@testopt{\X@@package{#1}{#2}}{}} +% \def\X@@package#1#2[#3]{% +% \xpackage{#2\footnote{\noindent\xpackage{#2}: \href{http://www.ctan.org/tex-archive/macros/latex/contrib/#1}{\nolinkurl{CTAN:macros/latex/contrib/#1}}#3}}} +% \def\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$} +% \newrobustcmd*\FC[1][\color{copper}]{{#1\usefont{T1}{fts}xn FC}} +% +% \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@ +% \g@addto@macro\macro@font{\macrocodecolor\let\AltMacroFont\macro@font} +% \g@addto@macro\@list@extra{\parsep\parskip\topsep\z@\itemsep\z@} +% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} +% \newrobustcmd\verbfont{\usefont{T1}{\ttdefault}{\f@series}{n}} \let\vb\verbfont +% \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}} +% \newrobustcmd\csred[1]{\textcolor{red}{\cs{#1}}} +% \renewrobustcmd\cs[2][]{\mbox{\vb#1\expandafter\@gobble\string\\#2}} +% \newrobustcmd\CSbf[1]{\textbf{\CS{#1}}} +% \newrobustcmd\csbf[2][]{\textbf{\cs[{#1}]{#2}}} +% \newrobustcmd\textttbf[1]{\textbf{\texttt{#1}}} +% \renewrobustcmd*\bf{\bfseries}\newcommand\nnn{\normalfont\mdseries\upshape}\newcommand\nbf{\normalfont\bfseries\upshape} +% \newrobustcmd*\blue{\color{blue}}\newcommand*\red{\color{dr}}\newcommand*\green{\color{green}}\newcommand\rred{\color{red}} +% \newrobustcmd\rrbf{\color{red}\bfseries} +% \newcommand\textt[1]{\texorpdfstring{\texttt{#1}}{#1}} +% \newrobustcmd\texttbf[1]{\textbf{\texttt{#1}}} +% \colorlet{pkgcolor}{teal}\def\pkgcolor{\color{pkgcolor}} +% \definecolor{copper}{rgb}{0.67,0.33,0.00} \newcommand\copper{\color{copper}} +% \definecolor{dg}{rgb}{0.16,0.33,0.00} \newcommand\dg{\color{dg}} +% \definecolor{db}{rgb}{0,0,0.502} \newcommand\db{\color{db}} +% \definecolor{dr}{rgb}{0.49,0.00,0.00} \let\dr\red +% \definecolor{lk}{rgb}{0.25,0.25,0.25} \newrobustcmd\lk{\color{lk}} +% \newrobustcmd\bk{\color{black}}\newcommand\md{\mdseries} +% \def\M{\@ifstar{\M@i\@firstofone}{\M@i\meta}} +% \def\M@i#1{\@ifnextchar[^^A] +% {\M@square#1} +% {\@ifnextchar(^^A) +% {\M@paren#1} +% {\M@brace#1}}^^A +% } +% \def\M@square#1[#2]{\M@Bracket[{#1{#2}}]} +% \def\M@paren#1(#2){\M@Bracket({#1{#2}})} +% \def\M@brace#1#2{\M@Bracket\{{#1{#2}}\}} +% \def\M@Bracket#1#2#3{{\ttfamily#1#2#3}} +% \newrobustcmd*\thisyear{\begingroup +% \def\thisyear##1/##2\@nil{\endgroup +% \oldstylenums{\ifnum##1=2010\else 2010\,\textendash\,\fi ##1}^^A +% }\expandafter\thisyear\thisdate\@nil +% } +% +% \def\declmargin{\hspace*\declmarginwidth } +% \def\declmarginwidth{\dimexpr -\leftmargini +\arrayrulewidth +\tabcolsep\relax} +% \renewrobustcmd\declcs[2][]{^^A +% \if@nobreak \par\nobreak +% \else \par\addvspace\parskip +% \Needspace{.08\textheight}\fi +% \changefont{size+=2.5pt,spread=1,fam=\ttdefault}^^A +% \newcommand*\csanchor[2][]{\raisedhyperdef[14pt]{declcs}{##2}{\cs[{##1}]{##2}}}^^A +% \def\*{\unskip\,\texttt{*}}\noindent +% \hskip-\leftmargini +% \begin{tabu}{|l|}\hline +% \expandafter\SpecialUsageIndex\csname #2\endcsname +% \csanchor[{#1}]{#2}} +% \renewcommand\enddeclcs{% +% \crcr \hline \end{tabu}\nobreak +% \par \nobreak \noindent +% \ignorespacesafterend +% } +% \newrobustcmd*\csref[2][]{\hyperref{}{declcs}{#2}{\cs[{#1}]{#2}}} +% +% \let\plainllap\llap +% \newrobustcmd\macro@llap[1]{{\global\let\llap\plainllap +% \setbox0=\hbox\bgroup \raisedhyperdef{macro}{\saved@macroname}{#1}\egroup +% \ifdim\wd0>2.4cm +% \hbox to\z@ \bgroup\hss \hbox to2.4cm{\unhcopy0\hss}\egroup +% \edef\@tempa{\hskip\dimexpr\the\wd0-2.4cm}\global\everypar\expandafter{\the\expandafter\everypar +% \@tempa \global\everypar{}}^^A +% \else \llap{\unhbox0}\fi}} +% \pretocmd\macro{\if@nobreak\else\Needspace{2\baselineskip}\fi +% \MacrocodeTopsep\z@skip \MacroTopsep\z@skip \parsep\z@ \topsep\z@ \itemsep\z@ \partopsep\z@ +% \let\llap\macro@llap}{}{} +% \apptocmd\endmacro{\goodbreak\vskip.3\parskip}{}{} +% \newrobustcmd\macroref[2][]{\hyperref{}{macro}{#2}{\cs[{#1}]{#2}}} +% +% \DefineVerbatimEnvironment{Verb}{Verbatim}{gobble=1} +% \DefineVerbatimEnvironment{VerbLines}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=txtt,fontseries=b} +% \newkeyenvironment+[\|]{dblruled}[first=.4pt,second=.4pt,sep=1pt,left=\z@]% +% {|\def\FrameCommand|{% +% \vrule\@width\commandkey{first} +% \hskip\commandkey{sep} +% \vrule\@width\commandkey{second} +% |\hspace|{\commandkey{left}}} +% |\MakeFramed| {\advance\hsize-|\width \FrameRestore|}% +% }{% +% |\endMakeFramed|% +% } +% +% \colorlet{HeadBand}{BlanchedAlmond} +% \newcommand*\topheader{\tikz[remember picture,overlay]{ +% \coordinate (A) at (current page.north west); +% \coordinate (B) at ($(current page.north east)+(0cm,-\headheight)$); +% \fill [color=HeadBand,fill opacity=.6] (A) rectangle (B); +% }% +% } +% +% \pagesetup[plain]{ +% norules, +% foot/right=\oldstylenums{\thepage} / \oldstylenums{\pageref{LastPage}}, +% foot/font=\lk\scriptsize, +% foot/left/offset=3cm, +% foot/right/offset=1cm, +% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC\quad \xemail{florent.chervet at free.fr}}}}}, +% } +% \pagesetup{ +% foot/right={\oldstylenums{\thepage} / \oldstylenums{\pageref{LastPage}}}, +% foot/font=\lk\scriptsize, +% foot/left/offset=3cm, +% foot/right/offset=1cm, +% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC}}}}, +% head/font=\small\sffamily, +% head/right/offset=1cm, +% head/right=\noindent\raise.4ex\hbox{\thispackage : \thisinfo}, +% head/left=\topheader, +% } +% \sectionformat\section{ +% top=\medskipamount, +% bottom=.5\smallskipamount, +% bookmark={color=MidnightBlue}, +% } +% \sectionformat\subsubsection{ +% top=\smallskipamount,bottom=0pt, +% bookmark={color=lk}, +% } +% \bookmarksetup{openlevel=3} +% +% \newcommand\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.05,0.02,0.07} +% \newcommand\reflinkcolor{\color{reflink}}\definecolor{reflink}{rgb}{0.49,0.00,0.00} +% \newrobustcmd*\IMPLEMENTATION{% +% \bookmarksetup{openlevel=1} +% ^^A\geometry{top=0pt,includeheadfoot,headheight=7mm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm} +% \newgeometry{top=0pt,includeheadfoot,headheight=7mm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=3cm,right=5mm} +% \pagesetup*{left/offset-=1cm,right/offset-=1.5cm-2mm} +% \section{Implementation} \label{sec:implementation} +% } +% +% \makeatother +% +% \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em} +% +% \title{\vspace*{-28pt}\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/mylatexformat.html}{\HUGE\bfseries\sffamily\pkgcolor mylatexformat}\vspace*{6pt}} +% \date{} +% \subtitle{\LARGE\begin{tabu}{X[c]} +% Use \thispackage* to make a format \\ +% based on the preamble of any LaTeX file \\[-1ex] +% \small\FC +% \end{tabu} +% \vspace*{-12pt}} +% \author{\smaller\thisdate~--~\hyperref[\thisversion]{version \thisversion}} +% +% \maketitle +% +% {\makeatletter\let\@thefnmark\@empty\let\@makefntext\@firstofone +% \footnotetext{\noindent\parskip=0pt\scriptsize +% This documentation is produced with the \textt{DocStrip} utility.\par +% \begin{tabu}{X[-3]X[-1]X} +% \smex To get the package, &run: &\texttt{etex \thisfile.dtx} \\ +% \smex To get the documentation &run (thrice): &\textt{pdflatex \thisfile.dtx} \\ +% \leavevmode\hphantom\smex To get the index, &run: &\texttt{makeindex -s gind.ist \thisfile.idx} +% \end{tabu}§ +% The \xext{dtx} file is embedded into this pdf file thank to \Xpackage{embedfile} by H. Oberdiek.} +% } +% +% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em} +% +% {\let\quotation\relax\let\endquotation\relax\vspace*{-1cm}% +% \begin{abstract}\parskip\smallskipamount\parindent0pt\lastlinefit0\leftskip.7cm\rightskip\leftskip +% +% \thispackage can be used to make a format from the preamble of any \LaTeX{} file. +% The use of formats helps to speed up compilations: packages which have been +% dumped in the format are loaded at very high speed. A format (also known as \emph{dump}) is therefore very suitable: +% \begin{itemize}[label=\textendash,leftmargin=3em] +% \item if you have many documents that share the same preamble, +% \item if you have a document which loads a large amount of packages (like \xpackage{TikZ} graphics libraries). +% \end{itemize} +% +% \medskip +% +% \thispackage will dump all definitions until \cs{begin}\M*{document} or \csref{endofdump}, more precisely: +% +% \csdef{tabu*}{\begingroup\tabcolsep0pt\begin{tabu}} +% \csdef{endtabu*}{\end{tabu}\endgroup} +% \definecolor{ly}{rgb}{1,1,.35} +% +% \hskip-2em +% \begin{tabu}to \linewidth{XXX[1.2]} +% +% \fcolorbox{black}{ly}{% +% \begin{tabu*}{X} +% \cs{RequirePackage}\M*{...} \\ +% \cs{documentclass}\M*{...} \\ +% \cs{usepackage}\M*{...} \\ +% \noindent\,\,... \\ +% \noindent\,\,... \\ +% \csbf{begin}{\bfseries\M*{document}} +% \end{tabu*}} +% & +% \begin{tabu*}{X} +% \fcolorbox{black}{ly}{% +% \begin{tabu}{X} +% \cs{RequirePackage}\M*{...} \\ +% \cs{documentclass}\M*{...} \\ +% \cs{usepackage}\M*{...} \\ +% \csbf{endofdump} \\ +% \end{tabu}} \\ +% \noindent\,\, ... \\ +% \noindent\,\,\cs{begin}\M*{document} +% \end{tabu*} +% & +% \begin{tabu*}{X} +% \fcolorbox{black}{ly}{% +% \begin{tabu*}{X} +% \cs{RequirePackage}\M*{...} \\ +% \cs{documentclass}\M*{...} \\ +% \cs{usepackage}\M*{...} \\ +% \csbf{csname} \texttbf{endofdump}\csbf{endcsname} \\ +% \end{tabu*}} \\ +% \noindent\,\, ... \\ +% \noindent\,\,\cs{begin}\M*{document} +% \end{tabu*} +% \end{tabu} +% \medskip +% +% The colored parts correspond to the format. The \xext{log} file will report: +% +% \begin{tabu}{@{}X|[pkgcolor]X} +% \begin{tabu}{>{\ttfamily}X[l]} +% start reading document "my document" \\ +% on input line *** (\cs{begin}\M*{document}) +% \end{tabu} +% & +% \begin{tabu}{>{\ttfamily}X[l]} +% start reading document "my document" \\ +% on input line *** (\cs{endofdump}) +% \end{tabu} +% \end{tabu} +% \medskip +% +% \thispackage was primarily written from \CTANpackage{mylatex} +% by David Carlisle, but it is different in many points (see \ref{mylatex}). In particular, \thispackage allows to put almost +% any package in the format, with one exception: the package \CTANpackage{minitoc} +% cannot be included in the format (you must use \csref{endofdump} before \cs{usepackage}\M*{minitoc}). +% +% \end{abstract} +% } +% +% \tocsetup{ +% section/skip=4pt plus2pt minus2pt, +% subsection/skip=4pt plus2pt minus2pt, +% title=Contents, +% title/skip=2pt, +% title/after={\pkgcolor\quad\leaders\vrule height3.4pt depth-3pt\hfill\null}, +% multicols/afterend=\leavevmode{\pkgcolor\hrule}, +% twocolumns, +% bookmark={text=Contents,bold}, +% } +% \tableofcontents +% \clearpage +% +% +% \MakeShortVerb{\+} +% +% \section{Creating a format} +% +% \subsection{Using MikTeX} +% +% \subsubsection{With preloaded pdflatex format (pdf output)} +% +% Use the following command line: +% +% \quad+etex -initialize [opts] "&pdflatex" mylatexformat.ltx """abc.tex"""+ +% +% You need 3 quotes around your \xext{tex} file if its name contains space +% (only one quote if it does not contain any space, but 3 quotes is more general...) +% \medskip +% +% Full example:§§ +% \begin{VerbLines} +% etex -initialize -save-size=20000 -stack-size=20000 +% -jobname="The-Name-Of-The-.fmt-File(without .fmt extension)" +% "&pdflatex" mylatexformat.ltx """Mon Fichier TeX.tex""" +% \end{VerbLines} +% +% +% \subsubsection{With preloaded latex format (dvi output)} +% +% Use the following command line: +% +% \quad+etex -initialize [opts] "&latex" mylatexformat.ltx """abc.tex"""+ +% +% +% \subsubsection{With preloaded format xelatex (pdf output)} +% +% Use the following command line: +% +% \quad+xetex -initialize [opts] "&xelatex" mylatexformat.ltx """abc.tex"""+ +% +% +% \subsection{Using other distributions} +% +% As I pointed out in the \texttt{abstract}, I have not been able to test the file on other distributions. +% +% Some users told me they typed the following command line: +% +% +latex -ini -jobname="fmt-file-name" "&latex" mylatexformat.ltx """abc.tex"""+ +% +% \section{Using a format} +% +% \subsection{Using MikTeX} +% +% Add the format to the very first line of your LaTeX file : +% +% \quad+%&"Mon Beau Format"+ +% +% You may use the $\varepsilon$-\TeX{} option : +-dont-parse-first-line+ \quad to avoid loading the format. +% +% \subsection{Using other distributions} +% +% As I pointed out in the \texttt{abstract}, I have not been able to test the file on other distributions. +% +% \clearpage +% \section[How does it work ? (and why it is different from mylatex.ltx)]{How does it work ? (and why it is different from \xpackage{mylatex.ltx})} +% \label{mylatex} +% +% \xpackage{mylatex.ltx} has three important limitations: +% \begin{enumerate}[label=\arabic*)~] +% \item The end of the format is either \verb+\begin{document}+ or the comment \verb+%mylatex+\\ +% Therefore, after the format has been loaded, \TeX{} checks the commentaries in the preamble +% in order to skip everything before \verb+%mylatex+. \\ +% But this way, braces \textbf{must match inside commentaries !} +% \item \xpackage{mylatex.ltx} temporarily redefines the command \cs{document} in order to stop +% the creation of the format (execution of \cs{dump}) at begin document. \\ +% However, the \textbf{initial definition of the macro \csbf{document}} is saved +% and reloaded after the format has been loaded. \\ +% Therefore, packages that modifies this macro (such as \Xpackage[oberdiek/auxhook]{auxhook}[ H. Oberdiek] or +% \Xpackage{etoolbox}[ P. Lehman] cannot be included in the format! +% \item If your document starts with :\\ +% \verb+\begin{document}% commentary+ or with :\\ +% \verb+\begin{document}\makeatletter+ \\ +% the format is not stopped at \verb+\begin{document}+ and an error occurs. +% \end{enumerate} +% +% \begin{dblruled}[first=2pt,sep=1pt,second=.6pt,left=4pt] +% With \xpackage{mylatexformat.ltx}, those limitations are lifted. +% +% \xpackage{mylatexformat.ltx}: +% \begin{enumerate}[label=\arabic*)~] +% \item Temporarily redefines \cs{begin} in order to check if its argument is \meta{document}. \\ +% Therefore, packages like \xpackage{auxhook} or \xpackage{etoolbox} can be included in the format. +% \item Stops the format when it encounters \verb+\begin{document}+ or \cs{endofdump}. +% \item Does not read inside commentaries +% \item After the format has been loaded, each line is checked to see if it \textbf{contains} either: +% \begin{description}[align=left,labelsep=1cm,font=\bfseries,labelindent=1cm] +% \item[] {\dr\verb+\begin{document}+} +% \item[or: ] {\dr\verb+\endofdump+} +% \item[or: ] {\dr\verb+\csname endofdump\endcsname+}\textsuperscript{\bfseries\textasteriskcentered} +% \end{description} +% Report is written in the \xext{log} file, with the job name, the name of the preloaded format, +% the list of preloaded files and the first input line read after loading of format. +% \end{enumerate} +% +% {\footnotesize\textsuperscript{\bfseries\textasteriskcentered} this way, the command \verb+\csname endofdump\endcsname+ is silently ignored +% (equiv. to \cs{relax}) in case the format is not used.} +% \end{dblruled} +% +% +% +% +% \StopEventually{ +% } +% +% \IMPLEMENTATION\DeleteShortVerb{\+} +% +% \begin{macrocode} +%<*package> +%%% _____________________________________________________________________ +%%% mylatexformat.ltx +%%% ^^^^^^^^^^^^^^^^^ +%%% From an original idea by David Carlisle - mylatex.ltx 1994/09/27 +%%% © lppl 2010-2011 - F Chervet - 2011/02/12 v3.4 +%%% _____________________________________________________________________ +%%% +%%% Use this file to make a format based on the preamble of any LaTeX +%%% file. +%%% +%%% The format is made from the very beginning of the file up to either: +%%% i) the command : \endofdump +%%% placed in the preamble +%%% ii) the command : \csname endofdump\endcsname +%%% placed in the preamble +%%% iii) \begin{document} +%%% if \endofdump nor \csname endofdump\endcsname +%%% haven't been found in the preamble. +%%% +%%% A format helps to speed up compilations, packages which have been +%%% dumped in the format are loaded at very high speed. +%%% -------------------------------------------------------------------- +%%% There are no restrictions on the distribution or modification of +%%% this file, except that other people should not attempt to alter +%%% the master copy on the ctan archives. +%%% +%%% Making the format -------------------------------------------------- +%%% ^^^^^^^^^^^^^^^^^ USING MikTeX +%%% * With preloaded pdflatex format (pdf output) : +%%% etex -initialize [opts] "&pdflatex" mylatexformat.ltx """abc.tex""" +%%% => compile your document using : +%%% pdflatex +%%% or texify --tex-option=-output-format=pdf +%%% +%%% * With preloaded latex format (dvi output) : +%%% etex -initialize [opts] "&latex" mylatexformat.ltx """abc.tex""" +%%% => compile your document using +%%% latex +%%% or texify --tex-option=-output-format=dvi +%%% +%%% * With preloaded format xelatex (pdf output) : +%%% xetex -initialize [opts] "&xelatex" mylatexformat.ltx """abc.tex""" +%%% => compile your document using xelatex +%%% +%%% NOTA BENE: Please, notice the 3 quotes ! +%%% ^^^^^^^^^^ +%%% +%%% In fact, 3 quotes are necessary only if you "file name.tex" contains a space ! +%%% +%%% -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +%%% Exemple of a command line for making format using pdfTeX : +%%% +%%% etex -initialize -interaction=nonstopmode +%%% -save-size=20000 -stack-size=20000 +%%% -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 +%%% (or overwritten) in the current working directory. +%%% +%%% Using the format --------------------------------------------------- +%%% ^^^^^^^^^^^^^^^^^ USING MikTeX +%%% Add the format to the very first line of your LaTeX file : +%%% --> first line : %&"format file name" +%%% without the .fmt extension. +%%% [You may use the option : -dont-parse-first-line option +%%% to avoid loading the format] +%%% -------------------------------------------------------------------- +%% ____________________________________________________________________ +%% The following informations come from mylatex.ltx from David Carlisle: +%% Given a LaTeX file `abc.tex', use initex as follows: +%% +%% initex &latex mylatexformat.ltx abc (Generic TeX) +%% initex \&latex mylatexformat.ltx abc (unix and other TeX's) +%% tex /i &latex mylatexformat.ltx abc (emtex) +%% +%% If you are on a Mac or using some shell that makes it inconvenient +%% to use a command line such as the above examples then you may +%% make a file `mylatex.tex' with the single line +%% \input mylatex.ltx abc +%% and then pass the file mylatex.tex to your (ini)tex shell to produce +%% the format, ie something equivalent to initex &latex mylatex.tex. +%% +%% If you are using OzTeX, see the separate instructions below. +%% +%% This should make a format file mylatex.fmt which you can then use +%% as follows +%% +%% Using the new format +%% ^^^^^^^^^^^^^^^^^^^^ +%% +%% tex &mylatex abc (generic TeX) +%% virtex \&mylatex abc (Unix TeX) +%% +%% This will process your document, abc.tex, just as LaTeX does, but +%% quicker as the contents of the preamble will be stored in the +%% format file and will not need to be run each time. +%% +%% If (vir)tex fails to find your mylatex.fmt then it is not searching +%% in the current directory, either modify your TEXFORMATS path (or +%% equivalent) to search `.' or (on unix/dos) use ./ as in: +%% virtex \&./mylatex abc +%% +%% Making and using the format with OzTeX +%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +%% +%% Given a LaTeX file `abc.tex', do this: select `TeX...' from OzTeX's +%% TeX menu, and go to the folder containing the file `abc.tex' as if you +%% were selecting the file `abc.tex'. Then hit the Cancel button - this +%% procedure sets OzTeX's working folder to the one containing abc.tex. +%% Next, select iniTeX from the TeX menu, and type: +%% +%% &latex mylatex.ltx abc +%% +%% This should make a format file mylatex.fmt which you can save in the +%% same folder as the file you're working on. +%% +%% To use the new format, put this at the very start of the very first +%% line of your document: +%% +%% %&mylatex +%% +%% Further Notes +%% +%% The file abc.tex must contain a line *just* with +%% \begin{document} +%% Everything up to (but not including) the \begin{document} will +%% be saved in the format and not executed in subsequent runs. +%% +%% If you are modifying the document (or working on a similar document) +%% you may wish to add new commands to your document preamble. +%% The `mylatex' format normally skips the whole preamble (believing +%% it to be pre-loaded) and so such new commands do not take effect. +%% You could re-make the format, preloading the new preamble, but that +%% might be inconvenient to do every time, and so an alternative scheme +%% has been introduced. +%% If the preamble contains a comment mylatex (ie a line just +%% containing a % white space and the word mylatex) then the mylatex +%% format will start reading the preable at that point so any new +%% 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 +%% that occur before \begin{document} that I could see. +%% 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. +\makeatletter +% \end{macrocode} +% +% +% \begin{macro}{\begin} +% +% \cs{begin} is overloaded in order to stop \cs{dump} at begin document +% if the macro \cs{endofdump} is not given somewhere in the preamble. +% Rem: it is NOT POSSIBLE to redefine \cs{document}, for the macro +% \cs{document} is changed or patched by some classes or packages +% (\xpackage{auxhook}, \xpackage{etoolbox} etc.) +% +% With \Xpackage{etoolbox} version \textt{2.1} and earlier, \cs{begin} is patched, +% in order to insert the hooks \cs{AtBeginEnvironment} and \cs{AtEndEnvironment}. +% +% Therefore, it's not possible to restore, at end of dump, the orginal definition +% of \cs{begin} in the \LaTeX{} kernel. Instead, \thispackage inserts a reversible +% patch of the \cs{begin} command: the patched is reversed at end of dump by +% \macroref{MYLATEX@cleanup}. +% +% \begin{macrocode} +%% \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.) +\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 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\openout} +% +% Files cannot be opened out during the building of the format. +% Instead, \cs{openout} is delayed until the end of the dump. +% +% \begin{macrocode} +\let\MYLATEX@openout \openout +\def\openout#1 {\g@addto@macro\MYLATEX@opens{\immediate\openout#1 }} +\def\MYLATEX@opens {\let\MYLATEX@opens \@undefined} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\MYLATEX@cleanup} +% +% Final clean up done at \cs{endofdump}: reverse the path for \cs{begin} +% and restores \cs{openout} primitive. +% +% \begin{macrocode} +\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 +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\MYLATEX@fontpreloading} +% +% Some font can be preloaded: this gives an advantage to the format. +% +% A hook for \CTANpackage{cmap} is necessary. +% +% \begin{macrocode} +\def\MYLATEX@fontpreloading{\let\MYLATEX@fontpreloading \@undefined + \begingroup \setbox0=\hbox {% + $$% math (not bold, some setups don't have \boldmath) + \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 +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\endofdump} +% +% +% \begin{macrocode} +\let\MYLATEX@listfiles \listfiles +\def\endofdump{\let\endofdump \relax + \MYLATEX@cleanup + \MYLATEX@fontpreloading + \makeatother + \everyjob\expandafter{\the\everyjob + \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 +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\MYLATEX@banner} +% \begin{macro}{\MYLATEX@start} +% +% Set to be expanded at \cs{everyjob}: displays a banner in the log file. +% +% \begin{macrocode} +%% Banner for \everyjob. +{\@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% + \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% + ==============================================================================}% + \endgroup + \MYLATEX@opens\relax #2% +}% \MYLATEX@start +}% \catcode group + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\MYLATEX@scanpreamble} +% +% While the preamble is being skipped (inside a group) +% the EOL is active and defined to grab each line and +% inspect it looking for : +% \begin{Verbatim} +% \endofdump +% or \csname endofdump\endcsname +% or \begin{document} +% \end{Verbatim} +% +% \begin{macrocode} +%% While the preamble is being skipped (inside a group) +%% the EOL is active and defined to grab each line and +%% inspect it looking for : +%% \endofdump +%% or \csname endofdump\endcsname +%% or \begin{document}. +%% +%% The special catcodes required are not enabled until after the +%% 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. +{% 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 +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%% 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% +%</package> +% \end{macrocode} +% +% \restoregeometry\pagesetup*{left/offset+=1cm,right/offset+=1.5cm-2mm} +% \begin{History} +% \sectionformat\subsection{font+=\smaller,bottom=\smallskipamount,top=\medskipamount} +% +% \begin{Version}{2011/02/12 v3.4}\HistLabel{3.4} +% \item Reorganisation of the code + optimisation. +% \end{Version} +% +% \begin{Version}{2011/01/19 v3.3}\HistLabel{3.3} +% \item Modification of the code for \cs{begin} in order to keep the patching introduced by +% \CTANpackage{etoolbox} version \textt{2.1} for the hooks \cs{AtBeginEnvironment}...\cs{AtEndEnvironement}. +% \end{Version} +% +% \begin{Version}{2011/01/14 v3.1}\HistLabel{3.1} +% \item \cs{@for} loop introduced for compatibility with the \xpackage{cmap} package had the bad side effect to define a control sequence \cs{x}. Fixed. +% \end{Version} +% +% \begin{Version}{2011/01/12 v3.0}\HistLabel{3.0} +% \item Fix a problem with package \CTANpackage{cmap} which could not be +% included in the format. +% \item Documentation revisited after Users' feedback (and the \CTANpackage{interfaces} package). +% \end{Version} +% +% \begin{Version}{2010/08/09 v2.9}\HistLabel{2.9} +% \item Modification of the macros that scan the preamble when the \xext{tex} file is compiled with its format.\\ +% It is now possible to start a file with \cs{begin}\texttt{\{document\}} just after the format specification (\texttt{\&myformat}). +% \item[To do:] Command line to make the format on Linux (\texttt{-ini} instead of \texttt{-initialize} ???). +% \end{Version} +% +% \begin{Version}{2010/06/30 v2.1}\HistLabel{2.1} +% \item Added: \cs{listfiles} is now available in the preamble, after \cs{endofdump}, when the document is compiled with its format. +% \item Documentation update. +% \end{Version} +% +% \begin{Version}{2010/05/20 v1.2}\HistLabel{1.2} +% \item Fixed a bug in \cs{MYLATEXopens} \\ +% (There was problems when including an index in the format for example...) +% \end{Version} +% +% \begin{Version}{2010/04/30 v1.0}\HistLabel{1.0} +% \item First version. +% \end{Version} +% +% \end{History} +% +% ^^A\restoregeometry\pagesetup*{left/offset+=1cm,right/offset+=1.5cm-2mm} +% \clearpage +% \PrintIndex +% +% \Finale
\ No newline at end of file |