summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/gmutils/gmnotonlypream.sty
blob: 1578aba3d9f43702d190436921b61e228d45eeb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
%% 
%% \iffalse ^^A we skip the debug setting
\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{}
%% \fi
%% ^^A $Id: TheUltimateMaster.gmd,v 0.352 2011/10/12 15:19:42 natror Exp natror $
%% This is file “gmnotonlypream.sty” generated with the DocStrip utility.
%% 
%%
%% The original source files were:
%%
%% gmutils/gmutils.gmd  (with options: `notonlypream')
%%
%% 
%% Copyright ©  
%% by Grzegorz ‘Natror’ Murzynowski
%% natror (at) gmail (dot) com
%% 
%% This program is subject to the LaTeX Project Public License.
%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
%% for the details of that license.
%%
%% LPPL status: "author-maintained".
%%
%% 
%% 
%% For documentation please refer to the file(s)
%% gmutils.{gmd,pdf}.
%% 
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gmnotonlypream}
    [2011/10/12 v0.996 modification of the 'only preamble' clause (GM)]


%%
%%
%%     ^^A\typeout{\unexpanded{#4}}%%

\RequirePackage{gmampulex}


\newcommand\not@onlypreamble[1]{{%
  \def\do##1{\ifx#1##1\else\@nx\do\@nx##1\fi}%
  \xdef\@preamblecmds{\@preamblecmds}}}

\not@onlypreamble\@preamblecmds
\not@onlypreamble\@ifpackageloaded
\not@onlypreamble\@ifclassloaded
\not@onlypreamble\@ifl@aded
\not@onlypreamble\@pkgextension

\not@onlypreamble\@pushfilename
\not@onlypreamble\@popfilename

\not@onlypreamble\@currnamestack


\def\gmu@notprerr{ can be used only in preamble (\on@line)}

\AtBeginDocument{%
  \def\do#1{\@nx\do\@nx#1}%
  \edef\@preamblecmds{%
    \def\@nx\do##1{%
      \def##1{\@nx\gmno@NotprerrMessage##1}\@nx\@eha}}%
    \@preamblecmds}

\def\gmno@NotprerrMessage#1{%
  \PackageError{gmutils/LaTeX}%
  {\@nx\string#1 \@nx\gmu@notprerr}{}%
}


\def\gmu@nocite@ampulex{% we wrap the stuff in a~macro to hide an open
  % \incs{if}. And not to make the begin-input hook too large.
  % \label{ampulexset} the first optional argument is the
  % parameters string and the second the argument for one-level
  % expansion of \incs{nocite}. Both hash strings are doubled to pass
  % the  % first \incs{def}.
  \ampulexdef\nocite[##1][##1]
  \ifx
  {\@onlypreamble\document}%
  \iftrue}

\AtBeginDocument{\gmu@nocite@ampulex}%

\endinput
%%
%% End of file `gmnotonlypream.sty'.