Highlighting without Dynamic Keywords: | Highlighting with Dynamic Keywords: | |
%% -*- BibStyle -*- %% %% This is a sample bibliography style %% for the BibStyle mode for WinEdt 5.4. %% %% It won't do anything useful (though it works). %% %% R Schlicht <w.m.l@gmx.net> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ENTRY { address author journal month number note pages publisher title year volume } {} { label } INTEGERS { stringfield stringitem stringbibliography stringlen } STRINGS { string } FUNCTION {init.string} { "WinEdt" 'string := string text.length$ 'stringlen := } FUNCTION {output.bibitem} { newline$ "\bibitem{" write$ cite$ write$ "}" write$ newline$ "This entry " write$ "" #0 'stringitem := } FUNCTION {fin.entry} { write$ stringitem #0 = { "does not contain the word `" string * "'." * } { ". That makes a total of " stringitem int.to.str$ * " occurences." * stringbibliography stringitem + 'stringbibliography := } if$ write$ newline$ } INTEGERS { start end } FUNCTION {check.for.string} { duplicate$ #0 'stringfield := text.length$ stringlen - #2 + 'end := #0 'start := { start end < } { duplicate$ start stringlen substring$ string = { stringfield #1 + 'stringfield :=} 'skip$ if$ start #1 + 'start := } while$ stringfield #0 = { pop$ pop$ } { pop$ stringitem #0 = { "contains of " stringfield int.to.str$ * " occurences of the word `" * string * "' in the \emph{" * swap$ "} field" * * } { ", " stringfield int.to.str$ * " in the \emph{" * swap$ "} field" * * } if$ write$ } if$ stringfield stingitem + 'stringitem := } FUNCTION {check} { duplicate$ empty$ { pop$ pop$ } { check.for.string } if$ } % the only entry this bibliography style knows: FUNCTION {article} { output.bibitem "Author" author check "Title" title check "Journal" journal check "Publisher" publisher check "Address" adress check "Month" month check "Note" note check "Pages" pages check "Year" year check "Volume" volume check fin.entry } READ STRINGS { longest.label } INTEGERS { number.label longest.label.width } FUNCTION {initialize.longest.label} { "" 'longest.label := #1 'number.label := #0 'longest.label.width := } FUNCTION {longest.label.pass} { number.label int.to.str$ 'label := number.label #1 + 'number.label := label width$ longest.label.width > { label 'longest.label := label width$ 'longest.label.width := } 'skip$ if$ } EXECUTE {initialize.longest.label} ITERATE {longest.label.pass} FUNCTION {begin.bib} { "% This bibliography has been generated by sample.bst," write$ newline$ "% the bibliography style that is a sample for the" write$ newline$ "% BibStyle mode for WinEdt 5.4." write$ newline$ newline$ "\begin{thebibliography}{" longest.label * "}" * write$ newline$ } EXECUTE {begin.bib} EXECUTE {init.string} ITERATE {call.type$} FUNCTION {end.bib} { newline$ "\end{thebibliography}" write$ newline$ "Your bibliography contains of " stringbibliography int.to.str$ * " occurences of the word `" string * "'." * * write$ newline$ } EXECUTE {end.bib} |
%% -*- BibStyle -*- %% %% This is a sample bibliography style %% for the BibStyle mode for WinEdt 5.4. %% %% It won't do anything useful (though it works). %% %% R Schlicht <w.m.l@gmx.net> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ENTRY { address author journal month number note pages publisher title year volume } {} { label } INTEGERS { stringfield stringitem stringbibliography stringlen } STRINGS { string } FUNCTION {init.string} { "WinEdt" 'string := string text.length$ 'stringlen := } FUNCTION {output.bibitem} { newline$ "\bibitem{" write$ cite$ write$ "}" write$ newline$ "This entry " write$ "" #0 'stringitem := } FUNCTION {fin.entry} { write$ stringitem #0 = { "does not contain the word `" string * "'." * } { ". That makes a total of " stringitem int.to.str$ * " occurences." * stringbibliography stringitem + 'stringbibliography := } if$ write$ newline$ } INTEGERS { start end } FUNCTION {check.for.string} { duplicate$ #0 'stringfield := text.length$ stringlen - #2 + 'end := #0 'start := { start end < } { duplicate$ start stringlen substring$ string = { stringfield #1 + 'stringfield :=} 'skip$ if$ start #1 + 'start := } while$ stringfield #0 = { pop$ pop$ } { pop$ stringitem #0 = { "contains of " stringfield int.to.str$ * " occurences of the word `" * string * "' in the \emph{" * swap$ "} field" * * } { ", " stringfield int.to.str$ * " in the \emph{" * swap$ "} field" * * } if$ write$ } if$ stringfield stingitem + 'stringitem := } FUNCTION {check} { duplicate$ empty$ { pop$ pop$ } { check.for.string } if$ } % the only entry this bibliography style knows: FUNCTION {article} { output.bibitem "Author" author check "Title" title check "Journal" journal check "Publisher" publisher check "Address" adress check "Month" month check "Note" note check "Pages" pages check "Year" year check "Volume" volume check fin.entry } READ STRINGS { longest.label } INTEGERS { number.label longest.label.width } FUNCTION {initialize.longest.label} { "" 'longest.label := #1 'number.label := #0 'longest.label.width := } FUNCTION {longest.label.pass} { number.label int.to.str$ 'label := number.label #1 + 'number.label := label width$ longest.label.width > { label 'longest.label := label width$ 'longest.label.width := } 'skip$ if$ } EXECUTE {initialize.longest.label} ITERATE {longest.label.pass} FUNCTION {begin.bib} { "% This bibliography has been generated by sample.bst," write$ newline$ "% the bibliography style that is a sample for the" write$ newline$ "% BibStyle mode for WinEdt 5.4." write$ newline$ newline$ "\begin{thebibliography}{" longest.label * "}" * write$ newline$ } EXECUTE {begin.bib} EXECUTE {init.string} ITERATE {call.type$} FUNCTION {end.bib} { newline$ "\end{thebibliography}" write$ newline$ "Your bibliography contains of " stringbibliography int.to.str$ * " occurences of the word `" string * "'." * * write$ newline$ } EXECUTE {end.bib} |
Note there are two errors in this file. You'll spot them relatively quickly if you look on the right side, while on the left side you'd probably have problems to find them.