| 1 |
|
| 2 |
Bst modification and other code listings for the mciteplus package |
| 3 |
Version 1.2, 2013/09/13 |
| 4 |
|
| 5 |
Copyright (c) 2008-2013 Michael Shell |
| 6 |
Support site: |
| 7 |
http://www.michaelshell.org/tex/mciteplus/ |
| 8 |
|
| 9 |
|
| 10 |
************************************************************************* |
| 11 |
Legal Notice: |
| 12 |
This code is offered as-is without any warranty either expressed or |
| 13 |
implied; without even the implied warranty of MERCHANTABILITY or |
| 14 |
FITNESS FOR A PARTICULAR PURPOSE! User assumes all risk. |
| 15 |
In no event shall any contributor to this code be liable for any damages |
| 16 |
or losses, including, but not limited to, incidental, consequential, or |
| 17 |
any other damages, resulting from the use or misuse of any information |
| 18 |
contained here. |
| 19 |
|
| 20 |
All comments are the opinions of their respective authors. |
| 21 |
|
| 22 |
This work is distributed under the LaTeX Project Public License (LPPL) |
| 23 |
( http://www.latex-project.org/ ) version 1.3, and may be freely used, |
| 24 |
distributed and modified. A copy of the LPPL, version 1.3, is included |
| 25 |
in the base LaTeX documentation of all distributions of LaTeX released |
| 26 |
2003/12/01 or later. |
| 27 |
Retain all contribution notices and credits. |
| 28 |
** Modified files should be clearly indicated as such, including ** |
| 29 |
** renaming them and changing author support contact information. ** |
| 30 |
********************************************************************** |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
***** start mciteplus begin.bib **** |
| 37 |
|
| 38 |
FUNCTION {begin.bib} |
| 39 |
{ preamble$ empty$ |
| 40 |
'skip$ |
| 41 |
{ preamble$ write$ newline$ } |
| 42 |
if$ |
| 43 |
"\ifx\mcitethebibliography\mciteundefinedmacro" |
| 44 |
write$ newline$ |
| 45 |
"\PackageError{unsrtM.bst}{mciteplus.sty has not been loaded}" |
| 46 |
write$ newline$ |
| 47 |
"{This bibstyle requires the use of the mciteplus package.}\fi" |
| 48 |
write$ newline$ |
| 49 |
"\begin{mcitethebibliography}{" longest.label * "}" * write$ newline$ |
| 50 |
} |
| 51 |
|
| 52 |
***** end mciteplus begin.bib **** |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
***** start mciteplus begin.bib, more advanced example **** |
| 58 |
|
| 59 |
FUNCTION {begin.bib} |
| 60 |
{ preamble$ empty$ |
| 61 |
'skip$ |
| 62 |
{ preamble$ write$ newline$ } |
| 63 |
if$ |
| 64 |
"\ifx\mcitethebibliography\mciteundefinedmacro" |
| 65 |
write$ newline$ |
| 66 |
"\PackageError{unsrtM.bst}{mciteplus.sty has not been loaded}" |
| 67 |
write$ newline$ |
| 68 |
"{This bibstyle requires the use of the mciteplus package.}\fi" |
| 69 |
write$ newline$ |
| 70 |
"\begin{mcitethebibliography}{" longest.label * "}" * write$ newline$ |
| 71 |
"\mciteSetBstSublistMode{b}" |
| 72 |
write$ newline$ |
| 73 |
"\mciteSetBstMaxWidthForm{subitem}{\alph{mcitesubitemcount})}" |
| 74 |
write$ newline$ |
| 75 |
"\mciteSetBstSublistLabelBeginEnd{\mcitemaxwidthsubitemform\space}" |
| 76 |
write$ newline$ |
| 77 |
"{\relax}{\relax}" |
| 78 |
write$ newline$ |
| 79 |
} |
| 80 |
|
| 81 |
***** end mciteplus begin.bib, more advanced example **** |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
***** start mciteplus end.bib **** |
| 87 |
|
| 88 |
FUNCTION {end.bib} |
| 89 |
{ newline$ |
| 90 |
"\end{mcitethebibliography}" write$ newline$ |
| 91 |
} |
| 92 |
|
| 93 |
***** end mciteplus end.bib **** |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
***** start mciteplus fin.entry **** |
| 100 |
|
| 101 |
% mciteplus fin.entry |
| 102 |
% |
| 103 |
% pushes true (1), if add.period$ would add a period to the string on the stack |
| 104 |
% pushes false (0), otherwise |
| 105 |
% Uses text.length$ to avoid full string comparison and two copies of string. |
| 106 |
% Requires one copy of string on stack. |
| 107 |
INTEGERS {would.add.period.textlen} |
| 108 |
FUNCTION {would.add.period} |
| 109 |
{ duplicate$ |
| 110 |
add.period$ |
| 111 |
text.length$ |
| 112 |
'would.add.period.textlen := |
| 113 |
duplicate$ |
| 114 |
text.length$ |
| 115 |
would.add.period.textlen = |
| 116 |
{ #0 } |
| 117 |
{ #1 } |
| 118 |
if$ |
| 119 |
} |
| 120 |
|
| 121 |
FUNCTION {fin.entry} |
| 122 |
{ would.add.period |
| 123 |
{ "\relax" * write$ newline$ |
| 124 |
"\mciteBstWouldAddEndPuncttrue" write$ newline$ |
| 125 |
"\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}" |
| 126 |
write$ newline$ |
| 127 |
"{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax" |
| 128 |
} |
| 129 |
{ "\relax" * write$ newline$ |
| 130 |
"\mciteBstWouldAddEndPunctfalse" write$ newline$ |
| 131 |
"\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}" |
| 132 |
write$ newline$ |
| 133 |
"{}{\mcitedefaultseppunct}\relax" |
| 134 |
} |
| 135 |
if$ |
| 136 |
write$ |
| 137 |
newline$ |
| 138 |
"\EndOfBibitem" write$ |
| 139 |
} |
| 140 |
% end mciteplus fin.entry |
| 141 |
|
| 142 |
***** end mciteplus fin.entry **** |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
***** start mciteplus mcitetail field and sort key adjust support **** |
| 149 |
|
| 150 |
% mciteplus mcitetail field and sort key adjust support |
| 151 |
INTEGERS {mcitetailcnt is.mcitetail} |
| 152 |
STRINGS {mciteheadsortkey} |
| 153 |
% convert the strings "yes" or "no" to #1 or #0 respectively |
| 154 |
FUNCTION {mciteplus.yes.no.to.int} |
| 155 |
{ "l" change.case$ duplicate$ |
| 156 |
"yes" = |
| 157 |
{ pop$ #1 } |
| 158 |
{ duplicate$ "no" = |
| 159 |
{ pop$ #0 } |
| 160 |
{ "unknown boolean " quote$ * swap$ * quote$ * |
| 161 |
" in " * cite$ * warning$ |
| 162 |
#0 |
| 163 |
} |
| 164 |
if$ |
| 165 |
} |
| 166 |
if$ |
| 167 |
} |
| 168 |
FUNCTION {mciteplustail.adj.sort.key} |
| 169 |
{ mcitetail |
| 170 |
empty$ |
| 171 |
{ #0 'is.mcitetail := } |
| 172 |
{ mcitetail |
| 173 |
mciteplus.yes.no.to.int |
| 174 |
'is.mcitetail := |
| 175 |
} |
| 176 |
if$ |
| 177 |
is.mcitetail |
| 178 |
{ #1 mcitetailcnt + |
| 179 |
'mcitetailcnt := |
| 180 |
mciteheadsortkey |
| 181 |
"__" * |
| 182 |
"000000000" |
| 183 |
mcitetailcnt |
| 184 |
int.to.str$ |
| 185 |
* |
| 186 |
#-1 #10 substring$ |
| 187 |
* |
| 188 |
'sort.key$ := |
| 189 |
} |
| 190 |
{ #0 'mcitetailcnt := |
| 191 |
sort.key$ 'mciteheadsortkey := |
| 192 |
} |
| 193 |
if$ |
| 194 |
} |
| 195 |
% END mciteplus mcitetail field support |
| 196 |
|
| 197 |
***** end mciteplus mcitetail field and sort key adjust support **** |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
***** REVTeX Patch code to prevent BibTeX from seeing endnotes ***** |
| 204 |
|
| 205 |
|
| 206 |
% Patch REVTeX to prevent BibTeX from seeing endnotes as citations |
| 207 |
% Insert just after REVTeX is loaded |
| 208 |
\makeatletter |
| 209 |
\let\@ORGREVTEXendnotemark\@endnotemark |
| 210 |
\let\@ORGREVTEX@makefnmark@cite\@makefnmark@cite |
| 211 |
\def\@endnotemark{\bgroup\@fileswfalse\@ORGREVTEXendnotemark\egroup} |
| 212 |
\def\@makefnmark@cite{\bgroup\@fileswfalse\@ORGREVTEX@makefnmark@cite\egroup} |
| 213 |
\makeatother |
| 214 |
|
| 215 |
|
| 216 |
***** END REVTeX Patch Code ***** |
| 217 |
|
| 218 |
EOF |