-
Notifications
You must be signed in to change notification settings - Fork 0
/
natmove.sty
152 lines (151 loc) · 4.18 KB
/
natmove.sty
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
%%
%% This is file `natmove.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% achemso.dtx (with options: `natmove')
%% ----------------------------------------------------------------
%% achemso --- Support for submissions to American Chemical Society
%% journals
%% E-mail: [email protected]
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{natmove}
[2010/01/15 v1.1a Automatic citation moving with natbib]
\RequirePackage{natbib}
\newcommand*\nmv@ifmtarg{}
\newcommand*\nmv@xifmtarg{}
\begingroup
\catcode`\Q 3\relax
\long\gdef\nmv@ifmtarg#1{%
\nmv@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil
}
\long\gdef\nmv@xifmtarg#1#2Q#3#4#5\@nil{#4}
\endgroup
\newif\ifnmv@cite
\newcommand*\nmv@citex{%
\ifnmv@cite
\expandafter\nmv@citex@moving
\else
\expandafter\nmv@citex@nat
\fi
}
\newcommand*\nmv@after{}
\newcommand*\nmv@citex@moving{}
\def\nmv@citex@moving[#1][#2]#3{%
\leavevmode
\skip@\lastskip\relax
\unskip
\begingroup
\def\nmv@after{\nmv@citex@nat[#1][#2]{#3}}%
\global\nmv@citefalse
\nmv@citex@get@next\relax
}
\newcommand*\nmv@citex@end{%
\nmv@after
\endgroup
}
\newcommand*\nmv@citex@get@next[1]{%
\futurelet\nmv@citex@next\nmv@citex@punct
}
\newcommand*\nmv@citex@punct{%
\let\nmv@citex@loop\nmv@citex@end
\ifx\nmv@citex@next.\relax
\ifnum\spacefactor<\nmv@citex@sfac\else
\expandafter\expandafter\expandafter\nmv@citex@punct@undouble
\fi
\fi
\expandafter\nmv@citex@punct@aux\natmovechars\@nil
\nmv@citex@loop
}
\newcommand*\nmv@citex@punct@undouble{%
\let\nmv@citex@next\relax
\let\nmv@citex@loop\nmv@citex@get@next
}
\newcommand*\nmv@citex@loop{}
\newcommand*\nmv@citex@punct@aux[1]{%
\ifx\nmv@citex@next#1\@empty
#1%
\let\nmv@citex@loop\nmv@citex@get@next
\fi
\ifx#1\@nil\else
\expandafter\nmv@citex@punct@aux
\fi
}
\mathchardef\nmv@citex@sfac3000\relax
\expandafter\def\expandafter\frenchspacing\expandafter{%
\frenchspacing
\mathchardef\nmv@citex@sfac1001\relax
\sfcode`\.\nmv@citex@sfac
\sfcode`\?\nmv@citex@sfac
\sfcode`\!\nmv@citex@sfac
}
\ifnum\sfcode`\.=\@m
\frenchspacing
\fi
\newcommand*\nmv@citex@nat{}
\newcommand*\nmv@activate{%
\let\nmv@citex@nat\@citex
\let\@citex\nmv@citex
\let\nmv@cite\cite
\renewcommand*{\cite}[2][]{%
\nmv@ifmtarg{##1}{%
\nmv@citetrue
\nmv@cite{##2}%
}{%
\nmv@citefalse
\nmv@cite[##1]{##2}}%
}%
}
\newcommand*\nmv@natbib@detect{%
\@ifpackageloaded{natbib}{%
\ifNAT@super
\expandafter\nmv@activate
\fi
}{%
\PackageInfo{natmove}{%
The natbib package is not loaded.\MessageBreak
Loading natmove will do nothing
}%
}%
}
\AtBeginDocument{\nmv@natbib@detect}
\newcommand*\natmovechars{.,;:}
%%
%% Originally developed by Mats Dahlgren
%% Copyright (C) 1996-1998 by Mats Dahlgren
%% Copyright (C) 2008-2014 by
%% Joseph Wright <[email protected]>
%%
%% Part of this bundle is derived from cite.sty, to which the
%% following license applies:
%% Copyright (C) 1989-2009 by Donald Arseneau
%% These macros may be freely transmitted, reproduced, or
%% modified provided that this notice is left intact.
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Joseph Wright.
%%
%% This work consists of the file achemso.dtx
%% and the derived files achemso.cls,
%% achemso.ins,
%% achemso.pdf,
%% achemso.sty,
%% achemso-demo.bib,
%% achemso-demo.tex,
%% natmove.sty and
%% a number of configuration files.
%%
%%
%% End of file `natmove.sty'.