diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-30 21:18:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-30 21:18:46 +0000 |
commit | f3bfe79d0b938997f051a018e20b5398f379d5d7 (patch) | |
tree | 120f444c3d49ffce43c16110ca86b9dcfd5c82bb /Master | |
parent | dd46297c9435a2d46d4cfa54a70052bebeb0035c (diff) |
csplain (30apr14)
git-svn-id: svn://tug.org/texlive/trunk@33770 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac-bib-iso690.tex | 900 | ||||
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac-bib-simple.tex | 174 | ||||
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac-bib.tex | 303 | ||||
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac.tex | 111 |
4 files changed, 1443 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac-bib-iso690.tex b/Master/texmf-dist/tex/csplain/opmac/opmac-bib-iso690.tex new file mode 100644 index 00000000000..983e748f569 --- /dev/null +++ b/Master/texmf-dist/tex/csplain/opmac/opmac-bib-iso690.tex @@ -0,0 +1,900 @@ +% opmac-bib-iso690 ... the OPmac bib style for reading .bib databases +% Petr Olsak, Apr. 2014c (beta) +% +% The bibliography printing from .bib files by ISO 690 standard is defied here. +% See the end of this file and the file opmac-bib.tex for more information. + +\ifx\opmacbibstyle\undefined \errmessage + {This file can be read by ``\string\usebib/? (simple) bibfiles'' command only} + \endinput \fi + +% misc: + +\def\maybedot{\ifnum\spacefactor=\sfcode`\.\relax\else.\fi} +\tmpnum=\sfcode`\. \advance\tmpnum by-2 \sfcode`\.=\tmpnum \sfcode`\?=\tmpnum \sfcode`\!=\tmpnum +\let\.=\maybedot % prevents from double periods + +\CreateField {option} +\def\isbiboption#1#2{\edef\tmp{\noexpand\isbiboptionA{#1}}\tmp} +\def\isbiboptionA#1{\def\tmp##1 #1 ##2\relax{% + \if^##2^\csname iffalse\expandafter\endcsname \else\csname iftrue\expandafter\endcsname \fi}% + \expandafter\tmp\biboptionsi #1 \relax} +\def\bibopt[#1]#2#3{\isbiboption{#1}\iftrue\def\tmp{#2}\else\def\tmp{#3}\fi\tmp} +\def\biboptionvalue#1#2{\def\tmp##1 #1:##2 ##3\relax{\def#2{##2}}% + \expandafter\tmp\biboptionsi #1: \relax} + +\def\readbiboptions{% + \RetrieveFieldIn{option}\biboptionsi + \toks1=\expandafter{\biboptionsi}% + \ifx\biboptions\undefined \toks2={}\else \toks2=\expandafter{\biboptions}\fi + \edef\biboptionsi{\space \the\toks1 \space \the\toks2 \space}% +} + +% Formating of Author/Editor lists: + +\def\firstauthorformat{% + \upper{\Lastname}\bprintc\Firstname{, *}\bprintc\Von{ *}\bprintc\Junior{, *}% +} +\def\otherauthorformat{% + \bprintc\Firstname{* }\bprintc\Von{* }\upper{\Lastname}\bprintc\Junior{, *}% +} +\def\commonname{% + \ifnum\NameCount=1 + \firstauthorformat + \ifx\dobibmark\undefined \edef\dobibmark{\Lastname}\fi + \else + \ifnum0\namecount=\NameCount + \ifx\maybeetal\empty \bibconjunctionand\else , \fi + \else , \fi + \otherauthorformat + \fi +} +\def\authorname{% + \ifnum\NameCount>0\namecount\relax\else \commonname \fi + \ifnum\NameCount=0\namecount\relax \maybeetal \fi +} +\let\editorname=\authorname + +\def\prepareauedoptions#1{% + \def\mabyetal{}\csname lb@abbreviatefalse\endcsname + \biboptionvalue{#1max}\authormax + \biboptionvalue{#1min}\authormin + \biboptionvalue{#1pre}\authorpre + \biboptionvalue{#1print}\authorprint + \isbiboption{#1etal}\iftrue \def\maybeetal{\Mtext{bib.etal}}\fi + \biboptionvalue{#1trim}\autrim + \let\namecountraw=\namecount + \ifx\authormax\empty \else + \ifnum 0\authormax<0\namecount + \edef\namecount{\ifx\authormin\empty\authormax\else\authormin\fi}% + \def\maybeetal{\Mtext{bib.etal}}% + \fi\fi + \ifx\autrim\empty \def\autrim{10000}\fi + \ifnum\autrim=0 \def\autrim{10000}\fi + \ifnum 0\namecount<\autrim\relax \else \AbbreviateFirstname \fi +} +\def\maybeetal{} + +\ifx\upper\undefined + \ifx\sc\undefined \def\upper{\uppercase\expandafter}\else \def\upper#1{{\sc#1}}\fi +\fi + +% Multilinguals: English Czech Slovak + +\mtdef{bib.and} {, and } { a } {} +\mtdef{bib.etal} { et al.} { a~kol.} {} +\mtdef{bib.edition} { ed.} { vyd.} {} +\mtdef{bib.bachthesis} {Bachelor's Thesis} {Bakalářská práce} {Bakalárska práca} +\mtdef{bib.masthesis} {Master's Thesis} {Diplomová práce} {Diplomová práca} +\mtdef{bib.phdthesis} {Ph.D. Thesis} {Dizertační práce} {Dizertačná práca} +\mtdef{bib.available} {Available from } {Dostupné na } {} +\mtdef{bib.availablealso} {Available also from } {Dostupné též na } {Dotupné tiež na } +\mtdef{bib.citedate} {cit.~} {vid.~} {} +\mtdef{bib.volume} {Vol.~} {ročník~} {} +\mtdef{bib.number} {No.~} {č.~} {} +\mtdef{bib.prepages} {pp.~} {s.~} {} +\mtdef{bib.postpages} {~p.} {~s.} {} +\mtdef{bib.editor} {,~ed.} {,~editor} {} +\mtdef{bib.editors} {,~eds.} {,~editoři} {,~editori} + + +\def\bibconjunctionand{\Mtext{bib.and}} +\def\preurl{\Mtext{bib.available}} +\let\predoi=\preurl +\def\postedition{\mtext{bib.edition}} +\def\Inclause{In:~} +\def\prevolume{\mtext{bib.volume}} +\def\prenumber{\mtext{bib.number}} +\def\prepages{\mtext{bib.prepages}} +\def\posteditor{\ifnum0\namecountraw>1 \Mtext{bib.editors}\else\Mtext{bib.editor}\fi} + + +\chardef\documentlanguage=\language +\def\Mtext#1{\csname mt:#1:\csname lan:\the\documentlanguage\endcsname\endcsname} + +\CreateField {lang} +\def\setlang#1{\ifx#1\empty \else + \expandafter \ifx \csname #1Patt\endcsname \relax + \opwarning{The language "#1" used in .bib file is unknown} + \else \language=\csname #1Patt\endcsname + \fi\fi +} +\ifx\USenglish\undefined \chardef\USenglish=0 \fi +\let\enPatt=\USenglish \let\usPatt=\USenglish +\ifx\csPatt \undefined \let\csPatt=\czPatt \else \let\czPatt=\csPatt \fi + +% Non-standard fieldnames: + +\CreateField {ednote} +\CreateField {citedate} +\CreateField {numbering} +\CreateField {isbn} +\CreateField {issn} +\CreateField {doi} +\CreateField {url} + +% Sorting: + +\SortingOrder{name,year}{lfvj} +\SpecialSort {key} + +% Misc: + +\def\bibwarninga{\bibwarning} +\def\bibwarningb{\bibwarning} + +\def\docitedate #1/#2/#3/#4\relax{[\Mtext{bib.citedate}% + \if^#2^#1\else + \if^#3^#1/#2\else + \docitedateA{#1}{#2}{#3}% + \fi\fi ]% +} +\def\docitedateA#1#2#3{% + \ifx\csPatt\undefined \mathchardef\csPatt=10000 \fi + \ifx\skPatt\undefined \mathchardef\skPatt=10000 \fi + \ifnum\documentlanguage=\csPatt \docitedateCS{#1}{#2}{#3}% + \else \ifnum\documentlanguage=\skPatt \docitedateSK{#1}{#2}{#3}% + \else \docitedateEN{#1}{#2}{#3}% + \fi\fi +} +\def\docitedateEN#1#2#3{#1-#2-#3} +\def\docitedateCS#1#2#3{\hbox{\tmpnum=#3 \the\tmpnum. \tmpnum=#2 \the\tmpnum. #1}} +\let\docitedateSK=\docitedateCS + +\def\doyear#1{ + \biboptionvalue{yearprint}\yearprint + \ifx\yearprint\empty#1\else\def\YEAR{#1}\yearprint\fi +} +\def\preparenumbering{% + \def\VOL{\RetrieveField{volume}}% + \def\NO{\RetrieveField{number}}% + \def\PP{\RetrieveField{pages}}% +} +\def\prepareednote{% + \def\EDN{\RetrieveField{edition}}% + \def\ADDR{\RetrieveField{address}}% + \def\PUBL{\RetrieveField{publisher}}% + \def\YEAR{\RetrieveField{year}}% + \def\AU{\bprintb[!author]{\doauthor0{####1}}{}}% + \def\ED{\bprintb[!editor]{\doeditor0{####1}}{}}% + \preparenumbering +} +\def\doedition#1{% + \biboptionvalue{editionprint}\editionprint + \ifx\editionprint\empty#1\postedition\else\def\ED{#1}\editionprint\fi +} +\def\doauthor#1#2{\prepareauedoptions{au}\let\iseditorlist=\undefined + \if1#1\def\AU{#2}\else\let\authorprint=\empty\fi + \ifx\authorprint\empty #2\else \authorprint\fi +} +\def\doeditor#1#2{\prepareauedoptions{ed}\let\firstauthorformat=\otherauthorformat + \if1#1\def\ED{#2}\else\let\authorprint=\empty\fi + \ifx\authorprint\empty #2\posteditor\else \authorprint\fi +} + +% Entry types: + +\sdef{print:BEGIN}{% + \readbiboptions + \biboptionvalue{titlepost}\titlepost + \isbiboption{unpublished}\iftrue \let\bibwarninga=\relax \let\bibwarningb=\relax \fi + \isbiboption{nowarn}\iftrue \let\bibwarning=\relax \fi + \isbiboption{urlalso}\iftrue \def\preurl{\Mtext{bib.availablealso}}\fi + \RetrieveFieldIn{lang}\langentry \setlang\langentry +} +\sdef{print:END}{% + \bprinta [note] {*.}{}% + \ifx\dobibmark\undefined \def\dobibmark{}\fi + \def\lowercase##1{##1}% + \edef\tmp{\bibmark ={\dobibmark, \RetrieveField{year}}}\tmp +} +\def\bookgeneric#1{% + \bprinta [howpublished] {[*].\ }{}% + \bprintb [edition] {\doedition{##1}\.\ }{}% + \bprinta [ednote] {*.\ }{}% + \bprinta [address] {*\bprintv[publisher]{:}{\bprintv[year]{,}{.}}\ }{\bibwarninga}% + \bprinta [publisher] {*\bprintv[year]{,}{.}\ }{\bibwarninga}% + \bprintb [year] {\doyear{##1}\bprintv[citedate]{\bprintv[numbering]{.}{}}{.}\ }{\bibwarning}% + \bprinta [numbering] {\preparenumbering*\bprintv[citedate]{}{\.}\ }{}% + \bprinta [citedate] {\docitedate*///\relax.\ }{}% + #1% + \bprinta [series] {*.\ }{}% + \bprinta [isbn] {ISBN~*.\ }{\bibwarningb}% + \bprinta [issn] {ISSN~*.\ }{}% + \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:book}{% + \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}% + \bookgeneric{}% +} +\sdef{print:article}{% + \biboptionvalue{journalpost}\journalpost + \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}% + \bprinta [title] {*.\ \bprintc\titlepost{*.\ }}{\bibwarning}% + \bprintb [journal] {{\em##1}\bprintc\journalpost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarninga}% + \bprinta [howpublished] {[*].\ }{}% + \bprinta [address] {*\bprintb[publisher]{:}{,}\ }{}% + \bprinta [publisher] {*, }{}% + \bprinta [month] {*, }{}% + \bprintb [year] {\doyear{##1}\bprintv[volume,number,pages]{,}{\.}\ }{}% + \bprinta [numbering] {\preparenumbering*\bprintv[citedate]{}{\.}\ } + {\bprinta [volume] {\prevolume*\bprintv[number,pages]{,}{\.}\ }{}% + \bprinta [number] {\prenumber*\bprintv[pages]{,}{\.}\ }{}% + \bprintb [pages] {\prepages\hbox{##1}\bprintv[citedate]{}{\.}\ }{\bibwarninga}}% + \bprinta [citedate] {\docitedate*///\relax.\ }{}% + \bprinta [issn] {ISSN~*.\ }{}% + \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:inbook}{% + \let\bibwarningb=\relax + \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}% + \bprinta [title] {*.\ }{\bibwarning}% + \Inclause + \bprintb [!editor] {\doeditor1{##1}\.\ }{}% + \bprintb [booktitle] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}% + \bookgeneric{\bprintb [pages] {\prepages\hbox{##1}. }{}}% +} +\slet{print:inproceedings}{print:inbook} +\slet{print:conference}{print:inbook} + +\sdef{print:thesis}{% + \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}% + \bprinta [howpublished] {[*].\ }{}% + \bprinta [address] {*\bprintv[school]{:}{\bprintv[year]{,}{.}}\ }{\bibwarning}% + \bprinta [school] {*\bprintv[year]{,}{.}\ }{\bibwarning}% + \bprinta [month] {*, }{}% + \bprintb [year] {\doyear{##1}\bprintv[citedate]{}{.}\ }{\bibwarninga}% + \bprinta [citedate] {\docitedate*///\relax.\ }{}% + \bprinta [type] {*\bprintv[ednote]{,}{.}\ }% + {\ifx\thesistype\undefined\bibwarning\else\thesistype\bprintv[ednote]{,}{.}\ \fi}% + \bprinta [ednote] {*.\ }{}% + \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:phdthesis}{\def\thesistype{\Mtext{bib.phdthesis}}\csname print:thesis\endcsname} +\sdef{print:mastershesis}{\def\thesistype{\Mtext{bib.masthesis}}\csname print:thesis\endcsname} +\sdef{print:bachelorsthesis}{\def\thesistype{\Mtext{bib.bachthesis}}\csname print:thesis\endcsname} + +\sdef{print:generic}{% + \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}% + \bprinta [howpublished] {[*].\ }{}% + \bprinta [ednote] {\prepareednote*\bprintv[citedate]{}{.}\ }{\bibwarning}% + \bprinta [year] {}{\bibwarning}% + \bprinta [citedate] {\docitedate*///\relax.\ }{}% + \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\slet{print:booklet}{print:generic} +\slet{print:incolleciton}{print:generic} +\slet{print:manual}{print:generic} +\slet{print:proceedings}{print:generic} +\slet{print:techreport}{print:generic} +\slet{print:unpublished}{print:generic} + +\sdef{print:misc}{\let\bibwarning=\relax \csname print:generic\endcsname} + +\endinput + + +opmac-bib-iso690.tex +==================== + +This is the iso690 bibliographic style used by opmac-bib.tex package. + +See op-example.bib for an example of the .bib input. You can try it by: + +\input opmac-bib +\nocite[*] +\usebib/s (iso690) op-example +\end + + +Common rules in .bib files: +-------------------------- + +There are entries of type @FOO{...} in the .bib file. Each entry consists of +fields in the form name = "value", or name = {value}. No matter which form is +used. If the value is pure numeric then you can say simply name = value. +Warning: the comma after each field value is mandatory! If it is missing then the +next field is ignored or bad interpreted. + +The entry names and field names are case insensitive. If there exist a data +field no mentioned here then it is simply ignored. You can use it to store +more information (abstract, for example). + +There are ``standard fields'' used in ancient bibTeX (author, title, editor, edition, +etc., see http://en.wikipedia.org/wiki/BibTeX). The iso690 style introduces +several ``non-standard'' fields: ednote, numbering, isbn, issn, doi, url, +citedate. They are documented here. + +Moreover, there are two optional special fields: + +lang = language of the entry. The hyphenation plus autogenerated phrases and + abbreviations will be typeset by this language. +option = options by which you can control special printing of vairous fields. + +There can be only one option field per each entry with (may be) more options +separated by spaces. You can declare the global option(s) in your document +applied for each entry by \def\biboptions{...}. + + +The author field +---------------- + +All names in the author list have to be separated by " and ". Each author +can be written by various formats (the ``von'' part is typically missing): + + Firstname(s) von Lastname + or + von Lastname, Firstname(s) + or + von Lastname, After, Firstname(s) + +Only the Lastname part is mandatory. Examples: + + Petr Olšák + or + Olšák, Petr + + Leonardo Piero da Vinci + or + da Vinci, Leonardo Piero + or + da Vinci, painter, Leonardo Piero + +The separator " and " between authors will be converted to comma during +printing, but between semifinal and final author the word "and" (or something +different depending on current language) is printed. + +The first author is printed in reverse order: ``LASTNAME, Firstname(s) von, +After'' and the others author are printed in normal order: ``Firstname(s) +von LASTNAME, After''. This feature follows the ISO 690 norm. The Lastname +is capitalised using uppercase letters, but if the \sc command is defined, +then it is used as an font switcher in the form {\sc Lastname}. You can +declare the ``Caps and small caps'' font here. + +You can specify the option "aumax:<number>". The <number> denotes the +maximum authors to be printed. The rest of authors are ignored and the +"et~al." is appended to the list of printed authors. This text is +printed only if the "aumax" value is less than the real number of authors. +If you have the same number of authors in the .bib file as you need to print +but you want to append "et~al." then you can use "auetal" option. + +There is a "aumin:<number>" option which denotes the definitive number of +printed authors if the author list is not fully printed due to "aumax". +If "aumin" is unused then "aumax" authors is printed in such case. + +All authors are printed if "aumax:<number>" option isn't given. +There is no internal limit. But you can set the global options in +your document by setting the \biboptions macro. For example: + + \def\biboptions {aumax:7 aumin:1} + % if there is 8 or more authors then only first author is printed. + +Examples: + + author = "John Green and Bob Brown and Alice Black", + +output: GREEN, John, Bob BROWN, and Alice BLACK. + + author = "John Green and Bob Brown and Alice Black", + option = "aumax:1", + +output: GREEN, John~et~al. + + author = "John Green and Bob Brown and Alice Black", + option = "aumax:2", + +output: GREEN, John, Bob BROWN~et~al. + + author = "John Green and Bob Brown and Alice Black", + option = "aumax:3", + +output: GREEN, John, Bob BROWN, and Alice BLACK. + + author = "John Green and Bob Brown and Alice Black", + option = "auetal", + +output: GREEN, John, Bob BROWN, Alice BLACK~et~al. + +If you need to add a text before or after authors list, you can use +the "auprint:{<value>}" option. The <value> will be printed instead of the +authors list. The <value> can include \AU macro which expands to the authors +list. Example: + + author = "Robert Calbraith", + option = "auprint:{\AU\space [pseudonym of J. K. Rowling]}", + +output: CALBRAITH Robert [pseudonym of J. K. Rowling]. + +You can use the "autrim:<number>" option. All Firstnames of all authors +are trimmed (i. e. reduced to initials) iff the number of authors in the +author field is greater than or equal to <number>. There is an exception: +"autrim:0" means that no Firstnames are trimmed. This is default behavior. +Another example: "autrim:1" means that all Firstnames are trimmed. + + author = "John Green and Bob Brown and Alice Black", + option = "auetal autrim:1", + +output: GREEN, J., B. BROWN, A. BLACK~et~al. + +If you need to write a team name or institution instead authors, replace all +spaces by \<space> in this name. Such text is interpreted as Lastname. You +can add the secondary name (interpreted as Firstname) after comma. Example: + + author = "Czech\ Technical\ University\ in\ Prague, Faculty\ of\ Electrical\ Engeneering", + +output: CZECH TECHNICAL UNIVERSITY IN PRAGUE, Faculty of Electrical Engeneering. + + +The editor field +---------------- + +The editor field is used for list of the authors of the collection. The +analogous rules as in author field are used here. It means that the +authors are separated by " and ", the Firstnames, Lastnames etc. are +interpreted and you can use the options "edmax:<number>", "edmin:<number>", +"edetal", "edtrim:<number>" and "edprint:<value>" (with \ED macro). +Example: + + editor = "Jan Tomek and Petr Karas", + option = "edprint:{\ED, editors.} edtrim:1", + +Output: J. TOMEK and P. KARAS, editors. + +If edprint option is not set then {\ED, eds.} or {\ED, ed.} is used +depending on the entry language and on the singular or plural of +the editor(s). + + +The ednote field +---------------- + +The ednote is used as the secondary authors and more editional info. The +value is read as raw data without any interpretation of Lastname, Firstname +etc. + + ednote = "Illustrations by Robert \upper{Agarwal}, edited by Tom \upper{Nowak}", + +output: Illustrations by Robert AGARWAL, edited by Tom NOWAK. + +The \upper command have to be used for Lastnames in ednote field. + + +The title field +--------------- + +This is the title of the work. It will be printed (in common entry types) by +italics. The ISO 690 norm declares, that the title plus optional subtitle +are in italics and they are separated by colon. Next, the optional secondary +title have to be printed in upright font. This can be added by +"titlepost:{<value>}". Example: + + title = "The Simple Title of The Work", +or + title = "Main Title: Subtitle", +or + title = "Main Title: Subtitle", + option = "titlepost:{Secondary title}", + +The output of the last example: + +{\it Main Title: Subtitle}. Secondary title. + + +The edition field +----------------- + +This field is used only for second or more edition of cited work. Write +only the number without the word "edition". The shortcut "ed." (or something +else depending on current language) is added automatically. Examples: + + edition = "Second", + edition = "2nd", + edition = "2$^{\rm nd}$", + edition = "2.", + +Output of the last example: 2. ed. + + edition = "2." + lang = "cs", + +Output: 2. vyd. + +Note, that the example edition = "Second" may cause problems. If you are +using language "cs" then the output is bad: Second vyd. So, you need to +say: + + edition = "Second", + lang = "en", + +You can use "ednprint:{<value>}" option. The the <value> is printed +instead of edition field and shortcut. The edition field must be set. Example: + + edition = "whatever", + option = "ednprint:{Second full revised edition}", + +Output: Second full revised edition. + +You can use \EDN macro in "ednprint" value. This macro is expanded +to the edition value. Example: + + edition = "Second", + option = "ednprint:{\EDN\space full revised edition}", + +or + + edition = "Second full revised edition", + option = "ednprint:{\EDN}", + + +The address, publisher, year fields +----------------------------------- + +This is an anachronism from ancient BibTeX (unfortunately no exclusive) that +the address field includes only the city of the publisher residence. No more +data are here. The publisher field includes the name of the publisher. + + address = "Berlin", + publisher = "Springer Verlag", + year = 2012, + +Output: Berlin: Springer Verlag, 2012. + +Note, that the year needn't to be inserted into quotes because it is pure +numeric. + +The letter a, b etc. are appended to the year automatically, if two or more +subsequent entries in the bibliography list are not distinct by the first +author and year fields. If you needn't this feature, you can use the +"noautoletters" option. + +You can use "yearprint:{<value>}" option. If it is set then the <value> +is used for printing year instead the real field value. The reason: year is +sort sensitive, may be you need to print something else than sorting key. +Example: + + year = 2000, + option = "yearpint:{\copyright 2000}", + +Output: \copyright 2000, sorted by: 2000. + + year = "2012a", + option = "yearprint:{2012}", + +Output: 2012, sorted by: 2012a. + +The address, publisher and year are typically mandatory fields. If they are +missing then the OPmac warning occurs. But you can set "unpublished" +option. Then this warning is suppressed. There is no difference in the +printed output. + + +The url field +------------- + +Use it without \url macro, but with http:// prefix. Example: + + url = "http://petr.olsak.net/opmac.html", + +The ISO 690 norm recommends to add the text ``Available from'' (or +something else if different current language is used) before URL. +It means, that the output of previous example is: + +Available from \url{http://petr.olsak.net/opmac.html}. + +If the "cs" language is the current one than the output is: + +Dostupné z: \url{http://petr.olsak.net/opmac.html}. + +If the "urlalso" option is used, then the added text has the form +``Available also from'' or ``Dostupné také z:'' (if "cs" language is +current). + + +The citedate field +------------------ + +This is the citation date. The field must be in the form year/month/day. It +means, that the two slashes must be written here. The output depends on the +current language. Example: + + citedate = "2004/05/21", + +Output when "en" is current: [cit. 2004-05-21]. +Output when "cs" is current: [vid. 21.~5.~2004]. + + +The howpublished field +---------------------- + +This declares the available medium for cited document if it is not in printed +form. Alternatives: online, CD, DVD, etc. Example: + + howpublished = "online", + +Output: [online]. + + +The volume, number, pages and numbering fields +---------------------------------------------- + +The volume is the ``big mark'' of the journal issue and the number is the +``small mark'' of the journal issue and pages includes the page range of +the cited article in the journal. The volume is prefixed by Vol.~, +the number by No.~ and the pages by pp.~. But these prefixes depends on the +language of the entry. + +Example: + + volume = 31, + number = 3, + pages = "37--42", + +Output: Vol.~31, No.~3, pp.~37--42. + + volume = 31, + number = 3, + pages = "37--42", + lang = "cs", + +Output: ročník~31, č.~3, s.~37--42. + +If you disagree with the default prefixes, you can use the numbering field. +When it is set then it is is used instead of volume, number, pages fields +and instead of any mentioned prefixes. The numbering can include macros \VOL, +\NO, \PP, which are expanded to the respective values of fields. Example: + + volume = 31, + number = 3, + pages = "37--42" + numbering = "Issue~\VOL/\NO, pages~\PP", + +Output: Issue~31/3, pages~37--42 + +Note: The volume, numbers and pages fields are printed without numbering +filed only in the @ARTICLE entry. It means, that if you need to visible them +in the @INBOOK, @INPROCEEDINGS etc. fields, then you must to use numbering field. + + +Common notes about entries +-------------------------- + +The order of the fields in the entry is irrelevant. We use the printed order +in this manual. The exclamation mark (!) denotes the mandatory field. If +such field is missing then the warning occurs during processing. + +If the "unpublished" option is set then the fields address, publisher, year, +isbn and pages are not mandatory. If the "nowarn" option is set then no +warnings about missing mandatory fields occurs. + +If the field is used but not mentioned in the entry documentation below then +it is silently ignored. + +The @BOOK entry +--------------- + +This is used for book-like entries. + +Fields: author(!), title(!), howpublished, edition, ednote, address(!), +publisher(!), year(!), citedate, series, isbn(!), doi, url, note. + +The ednote field here means the secondary authors (illustrator, cover design +etc.). + + +The @ARTICLE entry +------------------ + +This is used for articles published in a journal. + +Fields: author(!), title(!), journal(!), howpublished, address, publisher, +month, year, [numbering or volume, number, pages(!)], citedate, issn, +doi, url, note. + +If the numbering is used then it is used instead volume, number, pages. + + +The @INBOOK entry +----------------- + +This is used for the part of a book. + +Fields: author(!), title(!), booktitle(!), howpublished, edition, ednote, +address(!), publisher(!), year(!), numbering, citedate, series, isbn or +issn, doi, url, note. + +The author field is used for author(s) of the part, the editor field +includes author(s) or editor(s) of whole document. The pages field specifies +the page range of the part. The series field can include more information +about the part (chapter numbers etc.). + +The @INPROCEEDINGS and @CONFERENCE entries are equivalent to @INBOOK entry. + + +The @THESIS entry +----------------- + +This is used for student's thesis. + +Fields: author(!), title(!), howpublished, address(!), school(!), +month, year(!), citedate, type(!), ednote, doi, url, note. + +The type field must include the text "Master's Thesis" or something +similar (depending on the language of the outer document). + +There are nearly equivalent entries: @BACHELORSTHESIS, @MASTERSTHESIS and +@PHDTHESIS. These entries sets the type field to an appropriate value +automatically. The type field is optional in such case. If it is used then +it has a precedence before default setting. + + +The @MISC entry +--------------- + +It is intended for various usage. + +Fields: author, title, howpublished, ednote, citedate, doi, url, note. + +You can use \AU, \ED, \EDN, \VOL, \NO, \PP, \ADDR, \PUBL, \YEAR +macros in ednote field. These macros print authors list, editors list, +edition, volume, number, pages, address, publisher and year field values +respecitively. If they are are missing then the appropriate macro is empty. + +The reason of this entry is to give to you the possibility to set the format of +entry by your own decision. The most of data are concentrated in ednote +field. + + +The @BOOKLET, @INCOLLECION, @MANUAL, @PROCEEDINGS, @TECHREPORT, @UNPUBLISHED entries +------------------------------------------------------------------------------------- + +These entries are equivalent to @MICS entry because we need to save the +simplicity. They are implemented only for (almost) backward compatibility +with the ancient BibTeX. But the ednote is mandatory field here, so you +cannot use these entries from the old databases without warnings and without +some additional work in the .bib file. + + +Sorting +------- + +If \usebib/c is used then entries are sorted by citation order in the text. +If \usebib/s is used then entries are sorted by ``Lastname, Firstname(s)'' of +the first author and if more entries have this value equal, then the year is +used (from older to newer). This feature follows the recommendation of the +ISO 690 norm. + +If you have the same authors and the same year, you can control the sorting +by setting years as 2013, 2013a, 2013b, etc. You can print something +different to the list using "yearprint{<value>}" option, see the section about +address, publisher and year above. The real value of year field (ie. not +yearprint value) is also used in citations when \nonumcitations is set. + +If you have some problems with name sorting, you can use the hidden field +"key", which is used for sorting instead of the ``Lastname Firstname(s)'' +of authors. If the "key" field is unset then the ``Lastname Firstname(s)'' +is used for sorting normally. Example: + + author = "Světla Čmejrková", + key = "Czzmejrkova Svetla", + +This entry is now sorted between C and D. + +The norm recommends to place the autocitations to the top of the list of +references. You can do this by setting key = "@", to each entry with your +name because the "@" character is sorted before A. + + +Languages +--------- + +There is the language of the outer document and the languages of each entry. +The ISO 690 norm recommends that the technical notes (the prefix before URL, +the media type, the ``and'' conjunction between semifinal and final author) +may be printed in the language of the outer document. The data of the entry +have to be printed in the entry language (edition ed./vyd., Vol./ročník, +No./č. etc.). Finally there are the phrases independent on the language +(for example In:). Unfortunately, the bibTeX supposes that the entry data +are not fully included in value parts of the fields (see edition, volume +etc. fields) so the automaton have to add some text during processing. +But what language have to be chosen? + +The current value of the \language register at the start of the .bib +processing is decided as the language of the outer document. This language +is used for technical notes regardless of the entry language. Each entry can +have the lang field with the two-letter mark of the entry language. This +language is used for ed./vyd., vol./ročník etc. and it is used for +hyphenation too. If the entry language is not set then the outer document +language is used. + +If the outer document language is know before creating of the .bib file, you +can store some language-dependent phrases into it. On the other hand, if the +main document language is unknown, you can use the \Mtext macro to +create the text multilingual. Example: + + howpublished = "\Mtext{bue-ray}" + +Now, you can set the variants of blue-ray into your macros: + + \mtdef {blue-ray} {Blue-ray disc} {Blue-ray disk} {} + + +Tips for using more languages +----------------------------- + +OPmac prefers English, Czech and Slovak languages. However, you can add +more languages. If you are using csplain, you can download the +hyphen-patterns for many languages, see the hyphen.lan file. For example, +you have had \dePatt and \plPatt downloaded (for German and Polish +languages). Now, you can do + +\sdef{lan:21}{de} \sdef{lan:121}{de} +\sdef{lan:23}{pl} \sdef{lan:123}{pl} +\def\mtdefx#1#2#3{\sdef{mt:#1:de}{#2}\sdef{mt:#1:pl}{#3}} + + % German % Polish +\mtdefx {bib.and} { und } { a } +\mtdefx {bib.phdthesis} {Ph.D. Dissertation} {Praca doktorska} +... + + +Summary of non-standard fields +------------------------------ + +This style uses the following fields unkown by bibTeX: + +option ... options separated by spaces +lang ... the language two-letter code of one entry +ednote ... editional info (secondary authors etc.) or + global data in @MISC-like entries +citedate ... the date of the citation in year/month/day format +numbering ... format for volume, number, pages +isbn ... ISBN +issn ... ISSN +doi ... DOI +url ... URL + + +Summary of options +------------------ + +aumax:<number> ... maximum number of printed authors +aumin:<number> ... number of printed authors if aumax exceedes +autrim:<number> ... full Firstnames iff number of authors are less than this +auprint:{<value>} ... text instead auhors list (\AU macro may be used) +edmax, edmin, edtrim ... similar as above for editors list +edprint:{<value>} ... text instead editors list (\ED macro may be used) +titlepost:{<value>} ... text after title +yearprint:{<value>} ... text instead real year (\YEAR macro may be used) +ednprint:{<value>} ... text instead real edition (\EDN macro may be used) +urlalso ... the ``available also from'' is used instead ``available from'' +unpublished ... the publisher etc. fields are not mandatory +nowarn ... no mandatory fields + +Another options in the option field are silently ignored. diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac-bib-simple.tex b/Master/texmf-dist/tex/csplain/opmac/opmac-bib-simple.tex new file mode 100644 index 00000000000..139e4ff6504 --- /dev/null +++ b/Master/texmf-dist/tex/csplain/opmac/opmac-bib-simple.tex @@ -0,0 +1,174 @@ +% opmac-bib-simple ... the OPmac bib style for reading .bib databases +% Petr Olsak, version Apr. 2014c (beta) +% See the end of the file opmac-bib.tex for more information. +% You can compare this file with the old Forth-like BibTeX .bst files. +% What seems to be more understandable? + +\ifx\opmacbibstyle\undefined \errmessage + {This file can be read by ``\string\usebib/? (simple) bibfiles'' command only} + \endinput \fi + +% misc: + +\def\maybedot{\ifnum\spacefactor=\sfcode`\.\relax\else.\fi} +\tmpnum=\sfcode`\. \advance\tmpnum by-2 \sfcode`\.=\tmpnum +\sfcode`\?=\tmpnum \sfcode`\!=\tmpnum +\let\.=\maybedot % prevents from double periods + +% Formating of Author/Editor lists: + +\def\authorname{% + \ifnum\NameCount>1 + \ifnum0\namecount=\NameCount \mtext{bib.and}\else , \fi + \else + \edef\dobibmark{\Lastname}% + \fi + \bprintc\Firstname{* }\bprintc\Von{* }\Lastname\bprintc\Junior{, *}% +} +\let\editorname=\authorname + +% Multilinguals: English Czech Slovak + +\mtdef{bib.and} {, and } { a } {} +\mtdef{bib.edition} {edition} {vydání} {vydanie} +\mtdef{bib.phdthesis} {Master's thesis} {Diplomová práce} {Diplomová práca} +\mtdef{bib.masterthesis} {Ph.D. thesis} {Dizertační práce} {Dizertačná práca} + +\def\preurl{\hfil\break} + +% Non-standard fieldnames: + +\CreateField {isbn} +\CreateField {doi} +\CreateField {url} + +% Sorting: + +\SortingOrder{name,year}{lfvj} +\SpecialSort {key} + +% Entry types: + +\sdef{print:END}{% + \bprinta [note] {*.}{}% + \ifx\dobibmark\undefined \def\dobibmark{}\fi + \def\lowercase##1{##1}% + \edef\tmp{\bibmark ={\dobibmark, \RetrieveField{year}}}\tmp +} +\sdef{print:book}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}.\ }{\bibwarning}% + \bprinta [edition] {*~\mtext{bib.edition}.\ }{}% + \bprinta [address] {*: }{\bibwarning}% + \bprinta [publisher] {*, }{\bibwarning}% + \bprinta [year] {*.\ }{\bibwarning}% + \bprinta [isbn] {ISBN~*.\ }{\bibwarning}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:article}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprinta [title] {*.\ }{\bibwarning}% + \bprintb [journal] {{\em##1}.\ }{\bibwarning}% + \bprinta [year] {*, }{}% + \bprinta [volume] {* }{}% + \bprinta [number] {(*), }{}% + \bprinta [pages] {*.\ }{}% + \bprintb [doi] {DOI~\ulink[http://dx.doi.org/##1]{##1}.\ }{}% +} +\sdef{print:inbook}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1.}\ }{\bibwarning}% + In:~% + \bprinta [!editor] {*,~eds.\ }{}% + \bprintb [booktitle] {{\em##1}.\ }{\bibwarning}% + \bprinta [address] {*: }{\bibwarning}% + \bprinta [publisher] {*, }{\bibwarning}% + \bprinta [year] {*.\ }{\bibwarning}% + \bprinta [chapter] {*.\ }{% + \bprinta [pages] {*.\ }{}}% + \bprinta [isbn] {ISBN~*.\ }{\bibwarning}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\slet{print:inproceedings}{print:inbook} + +\sdef{print:incolection}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}.\ }{\bibwarning}% + \bprinta [crossreff] {In~\cite[*]. }{% + \bprinta [booktitle] {*. }{\bibwarning}% + \bprinta [!editor] {*,~eds.\ }{\bibwarning}% + \bprinta [edition] {*~\mtext{bib.edition}.\ }{\bibwarning}% + \bprinta [address] {*: }{\bibwarning}% + \bprinta [publisher] {*, }{\bibwarning}% + \bprinta [year] {*.\ }{\bibwarning}% + \bprinta [pages] {*.\ }{}% + \bprintb [url] {\preurl\url{####1}. }{}}% +} +\sdef{print:conference}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\.\ }{\bibwarning}% + \bprinta [edition] {*~\mtext{bib.edition}.\ }{}% + \bprinta [address] {*: }{\bibwarning}% + \bprinta [publisher] {*, }{\bibwarning}% + \bprinta [year] {*.\ }{\bibwarning}% + \bprinta [isbn] {ISBN~*.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:phdthesis}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\.\ }{\bibwarning}% + \mtext{bib.phdthesis}, % + \bprinta [school] {*.\ }{}% + \bprinta [address] {*, }{}% + \bprinta [year] {*.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:mastersthesis}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\.\ }{\bibwarning}% + \mtext{bib.masterthesis}, % + \bprinta [school] {*.\ }{}% + \bprinta [address] {*, }{}% + \bprinta [year] {*.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:proceedings}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\.\ }{\bibwarning}% + \bprinta [publisher] {*.\ }{% + \bprinta [organization] {*.\ }{\bibwarning}}% +} +\sdef{print:techreport}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\.\ }{\bibwarning}% + \mtext{bib.techreport}. + \bprinta [institution] {*.\ }{}% +} +\sdef{print:booklet}{% + \bprinta [!author] {*\.\ }{\bibwarning}% + \bprintb [title] {{\em##1}\.\ }{\bibwarning}% + \bprinta [howpublished] {*.\ }{\bibwarning}% +} +\sdef{print:manual}{% + \bprinta [!author] {*\.\ }{}% + \bprintb [title] {{\em##1}\.\ }{\bibwarning}% + \bprinta [year] {*.\ }{}% + \bprinta [institution] {*.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} +\sdef{print:misc}{% + \bprinta [!author] {*\.\ }{}% + \bprintb [title] {{\em##1}\.\ }{}% + \bprinta [howpublished] {*.\ }{}% + \bprinta [institution] {*.\ }{}% + \bprinta [series] {*.\ }{}% + \bprinta [year] {*.\ }{}% + \bprintb [url] {\preurl\url{##1}. }{}% +} + +%%% end of the style file + +\endinput + +You can copy this file to opmac-bib-yourname.tex and modify it by your +needs... diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac-bib.tex b/Master/texmf-dist/tex/csplain/opmac/opmac-bib.tex new file mode 100644 index 00000000000..7269b8c25d9 --- /dev/null +++ b/Master/texmf-dist/tex/csplain/opmac/opmac-bib.tex @@ -0,0 +1,303 @@ +% opmac-bib +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Petr Olsak, version Apr. 2014h (beta) + +% This is module for OPmac macros, see http://petr.olsak.net/opmac.html +% The command: +% \usebib/<sorttype> (<style>) (bibfiles> +% for direct reading .bib files by OPmac macros (without bibTeX) is implemented here. +% The implementation depends on librarian.tex package by Paul Isambert. +% Use: +% \input opmac \input opmac-bib +% or simply: +% \input opmac-bib +% before using the command \usebib. +% For more information see the end of this file. + +\ifx\usebib\udefined \else \endinput \fi +\ifx\OPmacversion\undefined \input opmac \fi +\ifx\printbib\undefined + \errmessage{Please, upgrade OPmac to version Apr. 2014 or newer} + \endinput\fi + +% we needn't \errmessage when bad TeX engnine is detected during \input librarian: + +\def\tmp{} +\let\errmessageori=\errmessage +\def\errmessage#1{\def\tmp{error}} +\input librarian +\let\errmessage=\errmessageori +\ifx\tmp\empty\else + \def\usebib/#1 (#2) #3 {% + \opwarning{eTeX and (pdfTeX or XeTeX or LuaTeX) not detected}% + \immediate\write16{\space\space + But librarian package needs it. \noexpand\usebib ignored.}% + } + \endinput \fi + +% The \usebib command: + +\def\usebib/#1 (#2) #3 {% + \ifx\citelist\empty + \opwarning{No cited items. \noexpand\usebib ignored}% + \else + \bgroup \par + \ifx\bibpart\undefined \def\bibpart{none}\fi + \catcode`<=12 + \ifx\savedttchar\undefined\else \catcode\savedttchar=12 \fi + \def\opmacbibstyle{#2}% + \input opmac-bib-#2 + \bibtexhook + \let\citeI=\relax \xdef\citelist{\citelist\citelistB}% + \global\let\addcitelist=\writeXcite + \def\tmp##1[*]##2\relax{\def\tmp{##2}}\expandafter\tmp\citelist[*]\relax + \ifx\tmp\empty\else % there was \nocite[*] used. + \setbox0=\vbox{\def\citelist{}\adef@{\readentry}% + \input #3.bib + \expandafter}\expandafter\def\expandafter\citelist\expandafter{\citelist}% + \fi + \def\citeI[##1]{\csname lb@cite\endcsname{##1}{\bibpart}{}{}}\citelist + \BibFile{#3}% + \if s#1\def\warntwobytes{}\def\warnthreebytes{}% \scantokens is used during sorting + \SortList{\bibpart}\fi + \ReadList{\bibpart}% + \egroup + \fi +} +\def\readentry#1#{\readentryA} +\def\readentryA#1{\readentryB#1,,\relax!.} +\def\readentryB#1#2,#3\relax!.{\addto\citelist{\citeI[#1#2]}} + +% Corrections in librarian macros: + +\tmpnum=\catcode`\@ \catcode`\@=11 +\def\lb@checkmissingentries#1,{% we needn't \errmessage here, only \opmacwarning + \def\lb@temp{#1}% + \unless\ifx\lb@temp\lb@eoe + \lb@ifcs{#1}{fields}% + {}% + {\opwarning{\string\usebib: entry [#1] isn't found in .bib file(s)}}% + \expandafter\lb@checkmissingentries + \fi +} +\def\lb@readentry#1#2#3,{% space before key have to be ingnored + \def\lb@temp{#2#3}% we need case sensitive keys + \lb@ifcs\lb@temp{requested}% + {\let\lb@entrykey\lb@temp + \lb@defcs\lb@entrykey{fields}{}% + \lowercase{\lb@addfield{entrytype}{#1}}% + \let\lb@next\lb@analyzeentry}% + {\def\lb@next{\expandafter\lb@gotoat\lb@gobbletoeoe}}% + \lb@next +} +\let\lb@compareA=\lb@compare +\let\lb@preparesortA=\lb@preparesort +\def\lb@compare#1\lb@eoe#2\lb@eoe{% SpecialSort: + \ifx\lb@sorttype\lb@namestring + \ifx\sortfield\undefined \lb@compareA#1\lb@eoe#2\lb@eoe + \else + \expandafter\RetrieveFieldInFor\expandafter{\sortfield}\lb@entrykey\lb@temp + \ifx\lb@temp\empty \toks1={#1\lb@eoe}\else \toks1=\expandafter{\lb@temp\lb@eoe}\fi + \expandafter\RetrieveFieldInFor\expandafter{\sortfield}\lb@currententry\lb@temp + \ifx\lb@temp\empty \toks2={#2\lb@eoe}\else \toks2=\expandafter{\lb@temp\lb@eoe}\fi + \edef\lb@temp{\noexpand\lb@compareA\space\the\toks1 \space\the\toks2}\lb@temp + \fi + \else \lb@compareA#1\lb@eoe#2\lb@eoe \fi +} +\def\lb@preparesort#1#2\lb@eoe{% + \if#1-% + \def\lb@sorttype{#2}% + \else + \def\lb@sorttype{#1#2}% + \fi + \lb@preparesortA#1#2\lb@eoe +} +\def\SpecialSort#1{\def\sortfield{#1}} +\def\WriteImmediateInfo#1{} % the existence of .lbr file bocks new reading of .bib +\catcode`\@=\tmpnum + +% Main action per every entry: + +\def\MakeReference{\par \ifnum\bibnum>0 \bibskip \fi + \advance\bibnum by1 + \noindent \edef\tmpb{\EntryKey}% + \printbib \dest[cite:\the\bibnum]% + \bgroup + \RetrieveFieldIn{entrytype}\entrytype + \csname print:BEGIN\endcsname + \isdefined{print:\entrytype}\iftrue + \csname print:\entrytype\endcsname + \else + \ifx\entrytype\empty \else + \opwarning{Entrytype @\entrytype\space from [\EntryKey] undefined}% + \csname print:misc\endcsname + \fi\fi + \csname print:END\endcsname + \ifx\wref\wrefrelax\else \immediate\wref\Xbib{{\EntryKey}{\the\bibnum}{\the\bibmark}}\fi + \egroup \par +} + +% The \bprinta, \bprintb, \bprintc, \bprintv commands used in the style files: + +\def\bprinta {\bprintb*} +\def\bprintb #1[#2#3]{% + \def\bibfieldname{#2#3}% + \if!#2\relax + \def\bibfieldname{#3}% + \RetrieveFieldIn{#3}\bibfield + \ifx\bibfield\empty\else + \RetrieveFieldIn{#3number}\namecount + \def\bibfield{\csname Read#3\expandafter\endcsname\csname #3name\endcsname}% + \fi + \else + \RetrieveFieldIn{#2#3}\bibfield + \fi + \if^#1^% + \ifx\bibfield\empty \expandafter\expandafter\expandafter \doemptyfield + \else \expandafter\expandafter\expandafter \dofullfield \fi + \else \expandafter \bprintaA + \fi +} +\def\dofullfield#1#2{\def\dofield##1{#1}\expandafter\dofield\expandafter{\bibfield}} +\def\doemptyfield#1#2{\def\dofield##1{#2}\expandafter\dofield\expandafter{\bibfield}} +\let\Readauthor=\ReadAuthor \let\Readeditor=\ReadEditor +\def\bprintaA #1#2{\ifx\bibfield\empty #2\else\bprintaB #1**\eee\fi} +\def\bprintaB #1*#2*#3\eee{\if^#3^#1\else\expandafter\bprintaC\expandafter{\bibfield}{#1}{#2}\fi} +\def\bprintaC #1#2#3{#2#1#3} +\def\bprintc#1#2{\bprintcA#1#2**\relax} +\def\bprintcA#1#2*#3*#4\relax{\ifx#1\empty \else \if^#4^#2\else#2#1#3\fi\fi} +\def\bprintv [#1]#2#3{\def\tmpa{#2}\def\tmpb{#3}\bprintvA #1,,} +\def\bprintvA #1,{% + \if^#1^\tmpb\else + \RetrieveFieldIn{#1}\tmp + \ifx \tmp\empty + \else \tmpa \def\tmpb{}\def\tmpa{}% + \fi + \expandafter \bprintvA + \fi +} + +% Various macros + multilinguas: + +\def\bibwarning{\opwarning{Missing field ``\bibfieldname'' in [\EntryKey]}} + +\def\slet#1#2{\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname} +\def\mtdef#1#2#3#4{\sdef{mt:#1:en}{#2} \sdef{mt:#1:\czs}{#3} + \if$#4$\slet{mt:#1:sk}{mt:#1:\czs} + \else \sdef{mt:#1:sk}{#4} + \fi +} +\edef\czs{\csname lan:5\endcsname} % cz (old) or cs (new) + +\endinput + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The following command is implemented here: + + \usebib/<sorttype> (<style>) <bibfiles> + +where <sorttype> is one letter 'c' (references ordered by citation order in +the text) or 's' (references ordered by key in the style file), +<style> is the part of the name `opmac-bib-<style>.tex' of the style file +and <bibfiles> are one or more .bib file names without suffix separated by +comma without space. Example: + + \usebib/s (simple) mybase,yourbase + +This command reads the <bibfiles> directly and creates the list of +bibliographics references (only those declared by by \cite[] or \nocite[] +in the text). The formatting of such references is defined in the style +file. The usage is mentioned in OPmac documentation too. + +Notes for style writers: +------------------------ + +The opmac-bib-<style>.tex file must define the commands: + +\authorname ... formatting of one name in the authors list. The macro can + use the following data: \NameCount (the number of the currently + processed author name in the list), 0\namecount (the total number of the + authors in the list), \Lastname, \Firstname, \Von, \Junior (the parts of + the name). See the documentation of the librarian package for more info. + +\editorname ... the same as \authorname, but for editors list. + +print:<entrytype> (defined by \sdef) for formatting the entry of <entrytype>. + The <entrytype> have to be lowercase. This command can use the command: + +\bprinta [<fieldname>] {<if defined>} {<if not defined>}. The part <if defined> + is executed if <fieldname> is declared in .bib file for the entry which is + currently processed. Else the part <if not defined> is processed. + The part <if defined> can include the * parameter which is replaced + by the value of the <fieldname>. The part <if not defined> can include + the \bibwarning command if the <fieldname> is mandatory. +\bprintb [<fieldname>] {<if defined>} {<if not defined>}. The same as + \bprinta, but the ##1 parameter is used instead *. Differences: ##1 + parameter can be used more than once and can be enclosed in nested + braces. The * parameter can be used at most once and cannot be enclosed + in braces. Warning: if the \bprintb commands are nested (\bprintb in + \bprintb), then you need to write ####1 parameter for internal \bprintb. + But if \bprinta commands are nested then the * parameter is not dubbled. +\pbprintc \macro {<if non-empty>}. The <if non-empty> part is executed if + \macro is non-empty. The * parameter can be used, it is replaced by + the \macro. +\bprintv [<field1>,<field2>,...] {<if defined>} {<if not defined>}. + The part <if defined> is executed if <field1> or <filed2> or ... + is defined, else the second part <if not defined> is executed. + There is one filed name or the list field names separated by commas. + The parts cannot include any parameter. + +There are two special fieldnames: !author and !editor. The processed list of +authors or editors (by repeatedly calling \authorname or \editorname) are +used here insted of raw data. + +You can define print:BEGIN and/or print:END which is executed at the begin or +end of each <entrytype>. The formatting does not solve the numbering and +paragraph indentation of the entry. This is processed by \printbib macro +used in OPmac (and may be redefined by the author or document designer). + +The whole style file is read in the group during \usebib command is executed +before typesetting the reference list. Each definition or setting is local +here. + +If you are using non-standard fieldnames in .bib database and bib. style, +you has to declare them by \CreateField {<fieldname>}. + +You can declare \SortingOrder in the manner documented by librarian package. + +If your style adds some words or abbreviations you can make them +multilingual by saying \mtext{<label>} instead such word and +\mtdef{<label>} {<English>} {<Czech>} {<Slovak>} declaration. +The right part is printed by current value of the \language regiter. +You can add more languages by re-defining the \mtdef command +and by \sdef{lan:<language number>}{<language mark>}. See the opmac.tex +for inspiration. + +If you are using \nonumcitations, then the \bibmark toks register have to be +prepared in the style file (in print:BEGIN, print:END, in \authorname etc.) +This value will be used in the \cite[] places in the document. + +The example of the style file is in opmac-bib-simple.tex. + +User or author of the bib. style can create the hidden field which has a +precedence while sorting names. Example: + + \CreateField {sortedby} + \SpecialSort {sortedby} + +Suppose that the .bib file includes: + + ... + author = "Jan Chadima", + sortedby = "Hzzadima Jan", + ... + +Now, this author is sorted between H and I, because the Ch digraph in this +name has to be sorted by this rule. + +If you need (for example) to place the autocitations before other citations, +then you can mark your entries in .bib file by sortedby = "@", because this +character is sorted before A. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end of the opmac-bib.tex diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac.tex b/Master/texmf-dist/tex/csplain/opmac/opmac.tex index ece2e866a3c..d414231cf31 100644 --- a/Master/texmf-dist/tex/csplain/opmac/opmac.tex +++ b/Master/texmf-dist/tex/csplain/opmac/opmac.tex @@ -5,7 +5,7 @@ %% The history of versions is at the end of this file, after \endpinput \ifx\OPmacversion\undefined \else \endinput \fi -\def\OPmacversion{Mar. 2014} +\def\OPmacversion{Apr. 2014c} \immediate\write16{This is OPmac (Olsak's Plain macros), version <\OPmacversion>} @@ -96,6 +96,7 @@ \def\cnvhook{} % hook before conversion of outlines \def\pghook{} % hook in \output rutine \def\toclinehook{} % hook in \tocline +\def\fnotehook{} % hook in \fnote \def\mnotehook{} % hook in \mnote \def\captionhook#1{} % hook in \caption (#1 is "t" or "f") @@ -117,7 +118,9 @@ %%%%%%%%%%%%%% Sizes of fonts and \baselineskip, sec. 3.4 in opmac-d.pdf \ifx\regfont\undefined - \opwarning{csplain version <Nov. 2012> or later is recommended} + \ifx\uselanguage\undefined + \opwarning{csplain version <Nov. 2012> or later is recommended} + \fi % macros from csplain, file csfontsm.tex: \font\tenbi=csbxti10 \def\bi{\tenbi} \def\letfont#1#2{\ifx#2=\expandafter\letfont\expandafter#1\else @@ -362,7 +365,7 @@ \ifx\dotocnumafter\relax \else \opwarning{\noexpand\dotocnum unused in printchap/printsec/printsecc}\fi } -\def\insertmark#1{\toks0={#1}\mark{{\thetocnum} {\the\toks0}}} +\def\insertmark#1{\toks0={#1}\mark{{\ifnonum\else\thetocnum\fi} {\the\toks0}}} \newskip\remskipamount \def\remskip{\afterassignment\remskipA \global\remskipamount} @@ -398,7 +401,7 @@ \parfillskip=0pt plus2fil \def\par{\endgraf\egroup}% \captionhook{#1}\noindent - {\destheight=2.1em \wlabel{\csname the#1num\endcsname}}% + \wlabel{\csname the#1num\endcsname}% \printcaption{\mtext{#1}}{\csname the#1num\endcsname}% } \def\printcaption#1#2{{\bf#1 #2}\enspace} @@ -407,7 +410,7 @@ \def\eqmark{\global\advance\dnum by1 \ifinner\else\eqno \fi - {\destheight=2.1em \wlabel\thednum}\thednum + \wlabel\thednum \thednum } %%%%%%%%%%%%%% Items -- sec. 3.10 in opmac-d.pdf @@ -922,7 +925,7 @@ %%%%%%%%%%%%%% Hyperrefs -- sec. 3.16 in opmac-d.pdf -\newdimen\destheight \destheight=1.3em +\def\destheight{1.4em} \def\destactive[#1:#2]{\if$#2$\else\ifvmode \tmpdim=\prevdepth \prevdepth=-1000pt \destbox[#1:#2]\prevdepth=\tmpdim @@ -942,7 +945,7 @@ } \def\toclink#1{\toclinkA{#1}} \def\pglink#1{#1} -\def\citelink#1{#1} +\def\citelink#1#2{#2} \def\reflink[#1]#2{#2} \def\ulink[#1]#2{{#2}} \def\urlcolor{} @@ -951,7 +954,7 @@ \let\dest=\destactive \def\toclink##1{\link[toc:##1]{\localcolor#1}{\toclinkA{##1}}}% \def\pglink##1{\link[pg:##1]{\localcolor#1}{##1}}% - \def\citelink##1{\link[cite:##1]{\localcolor#1}{##1}}% + \def\citelink##1##2{\link[cite:##1]{\localcolor#1}{##2}}% \def\reflink[##1]##2{\link[ref:##1]{\localcolor#1}{##2}}% \def\ulink[##1]##2{\urllink[url:##1]{##2}}% \def\urlcolor{\longlocalcolor#2}% @@ -1301,7 +1304,7 @@ \iflocfnum \leavevmode\openref\wref\Xfnote{}% \isdefined{fn:\the\fnotenum}\iftrue \else\opwarning{unknown \noexpand\fnote mark. TeX me again}\fi\fi - \fnmarkx{\typobase\typoscale[800/800]\vfootnote\fnmarkx{#1}}% + \fnmarkx{\fnotehook\typobase\typoscale[800/800]\vfootnote\fnmarkx{#1}}% } \def\fnotemark#1{{\advance\fnotenum by#1\relax \isdefined{fn:\the\fnotenum}\iftrue\thefnote @@ -1354,20 +1357,22 @@ \def\fixmnotes#1{\def\mnotesfixed{#1}} + %%%%%%%%%%%%%% \cite, \bib, \usebibtex, \usebbl -- sec. 3.23 in opmac-d.pdf \newwrite\auxfile % AUX file for BibTeX \newcount\bibnum % the bibitem counter +\newtoks\bibmark % the bibmark used if \nonumcitations \newcount\lastcitenum \lastcitenum=0 % for \shortcitations \def\cite[#1]{{\citeA#1,,,[\printsavedcites]}} \def\nocite[#1]{{\citeA#1,,,}} -\def\rcite#1{{\citeA#1,,,\printsavedcites}} +\def\rcite[#1]{{\citeA#1,,,\printsavedcites}} \def\savedcites{} \def\citeA #1#2,{\if#1,\else \if *#1\addcitelist{*}\expandafter \skiptorelax \fi - \expandafter \ifx \csname bib:#1#2\endcsname \relax + \isdefined{bib:#1#2}\iftrue \else \addcitelist{#1#2}% \opwarning{The cite [#1#2] unknown. Try to TeX me again}\openref \addto\savedcites{?,}\def\sortcitesA{}\lastcitenum=0 @@ -1430,30 +1435,44 @@ } \def\shortcitations{\lastcitenum=1 } -\def\printcite#1{\citesep\citelink{#1}\def\citesep{,\hskip.2em\relax}} -\def\printdashcite#1{\hbox{--}\citelink{#1}} +\def\printcite#1{\citesep\citelink{#1}{\citelinkA{#1}}\def\citesep{,\hskip.2em\relax}} +\def\printdashcite#1{\ifmmode-\else\hbox{--}\fi\citelink{#1}{\citelinkA{#1}}} \def\citesep{} -\def\bib[#1]{\par \ifnum\bibnum>0 \bibskip \fi +\def\nonumcitations{\lastcitenum=0\def\sortcitesA{}\def\etalchar##1{$^{##1}$}% + \def\citelinkA##1{\isdefined{bim:##1}\iftrue \csname bim:##1\endcsname + \else ##1\opwarning{\noexpand\nonumcitations + empty bibmark. Maybe bad BibTeX style}\fi} +} +\def\citelinkA{} + +\def\ecite[#1]{\bgroup\citeA#1,,,\expandafter\eciteB\savedcites;} +\def\eciteB#1,#2;#3{\if?#1\relax #3\else \citelink{#1}{#3}\fi\egroup} + +\def\bib[#1] {\isnextchar={\bibA[#1]}{\bibmark={}\bibB[#1]}} +\def\bibA[#1]=#2{\bibmark={#2}\bibB[#1]} +\def\bibB[#1]{\par \ifnum\bibnum>0 \bibskip \fi \advance\bibnum by1 - \wbib{#1}{\the\bibnum}% - \hangindent=\iindent - \noindent \def\tmpb{#1}\dest[cite:\the\bibnum]% - \indent \llap{[\the\bibnum] }\ignorespaces + \noindent \def\tmpb{#1}\wbib{#1}{\the\bibnum}{\the\bibmark}% + \printbib \ignorespaces } -\def\wbib#1#2{\edef\tmp{\wref\Xbib{{#1}{#2}}}% - \ifx\tmp\empty\else \immediate\tmp \fi +\def\wbib#1#2#3{\dest[cite:\the\bibnum]% + \ifx\wref\wrefrelax\else \immediate\wref\Xbib{{#1}{#2}{#3}}\fi} + +\def\Xbib#1#2#3{\sdef{bib:#1}{\bibnn{#2}&}\if^#3^\else\sdef{bim:#2}{#3}\fi\def\lastbibnum{#2}} + +\def\printbib{\hangindent=\iindent + \ifx\citelinkA\empty \noindent\hskip\iindent \llap{[\the\bibnum] }% + \else \noindent \fi } -\def\Xbib#1#2{\sdef{bib:#1}{\bibnn{#2}&}} -\def\addcitelist#1{\global\addto\citelist{\lcite[#1]}} +\def\addcitelist#1{\global\addto\citelist{\citeI[#1]}} \def\writeaux#1{\immediate\write\auxfile{\string\citation{#1}}} \def\writeXcite#1{\openref\immediate\wref\Xcite{{#1}}} \def\citelist{} \def\citelistB{} \def\usebibtex#1#2{% \openref \openauxfile{#1}{#2}% - \def\lcite[##1]{\writeaux{##1}}\citelist + \def\citeI[##1]{\writeaux{##1}}\citelist \global\let\addcitelist=\writeaux \bgroup \readbblfile{\jobname}\egroup } @@ -1471,27 +1490,22 @@ \else \closein\testin \bibnum=0 - \def\begin##1##2{}\def\end##1{}% LaTeX environment - \def\newcommand##1 {}% + \long\def\begin##1\bibitem{\bibitem}\def\end##1{}% LaTeX environment \def\httpAddr##1{\url{http:##1}}\def\\{\hfill\break}% \def\newblock{\hskip .11em plus.33em minus.07em}% - \def\mbox{\leavevmode\hbox}\let\em=\it + \def\mbox{\leavevmode\hbox}\def\emph##1{{\it##1}}% \parindent=\iindent \bibtexhook\relax \input #1.bbl \par \fi } -\def\bibitem{\isnextchar[{\bibitemB}{\def\tmpa{}\bibitemC}} -\def\bibitemB[#1]{\def\tmpa{#1}\bibitemC} +\def\bibitem{\isnextchar[{\bibitemB}{\bibmark={}\bibitemC}} +\def\bibitemB[#1]{\bibmark={#1}\bibitemC} \def\bibitemC#1{\bibitemD{#1}} \def\bibitemD#1{\par\ifnum\bibnum>0 \bibskip \fi \advance\bibnum by1 - \noindent \def\tmpb{#1}\dest[cite:\if$\tmpa$\the\bibnum\else\tmpa\fi]% - \hangindent=\parindent - \if$\tmpa$\indent\llap{[\the\bibnum] }\wbib{#1}{\the\bibnum}% - \else [\tmpa]\wbib{#1}{\tmpa}\enskip - \fi - \ignorespaces + \noindent \def\tmpb{#1}\wbib{#1}{\the\bibnum}{\the\bibmark}% + \printbib \ignorespaces } \def\genbbl#1#2{\openauxfile{#1}{#2}% \immediate\write\auxfile{\string\citation{*}}% @@ -1513,7 +1527,7 @@ \sdef{bbl:a}#1{\bgroup \readbblfile{#1}\egroup} \sdef{bbl:b}#1{\bgroup - \let\lcite=\relax \xdef\citelist{\citelist\citelistB}% + \let\citeI=\relax \xdef\citelist{\citelist\citelistB}% \def\bibitemC##1 ##2\par{% \isinlist\citelist{[##1]}\iftrue \bibitemD{##1}##2\par\fi}% \readbblfile{#1}% @@ -1521,21 +1535,23 @@ \egroup } \sdef{bbl:c}#1{\bgroup - \let\lcite=\relax \xdef\citelist{\citelist\citelistB}% + \ifx\citelinkA\empty \else + \opwarning{\string\nonumcitations: don't use \string\usebbl/c}\fi + \let\citeI=\relax \xdef\citelist{\citelist\citelistB}% \def\bibitemC##1 ##2\par{% \isinlist\citelist{[##1]}\iftrue - \ifx\tmpa\empty \sdef{bb:##1}{\bibitemD{##1}##2\par}% + \if^\the\bibmark^\sdef{bb:##1}{\bibitemD{##1}##2\par}% \else \toks0={##2\par}% - \edef\tmpa{\noexpand\sdef{bb:##1}{% \tmpa have to expand - \noexpand\bibitemB[\tmpa]{##1}\the\toks0}}\tmpa + \edef\tmpa{\noexpand\sdef{bb:##1}{% \the\bibmark have to expand + \noexpand\bibitemB[\the\bibmark]{##1}\the\toks0}}\tmpa \fi\fi}% \readbblfile{#1}% \def\bibitemC##1{\bibitemD{##1}}% - \def\lcite[##1]{\csname bb:##1\endcsname}\citelist + \def\citeI[##1]{\csname bb:##1\endcsname}\citelist \global\let\addcitelist=\writeXcite \egroup } -\def\Xcite#1{\addto\citelistB{\lcite[#1]}} +\def\Xcite#1{\addto\citelistB{\citeI[#1]}} %%%%%%%%%%%%%% output -- sec. 3.24 in opmac-d.pdf @@ -1550,7 +1566,7 @@ } \def\doprotect#1{\let#1=\relax} \addto\begoutput{\def\nl{ }\def\fnote##1{}\def\fnotemark##1{}} -\def\prepage{\destheight=25pt \dest[pg:\the\pageno]} +\def\prepage{\def\destheight{25pt}\dest[pg:\the\pageno]} {\catcode`\@=11 \gdef\pagecontents{\prepage % dest of pageno @@ -1699,9 +1715,14 @@ Nov. 2013 \Xpage: \ifnum\lastpage=#1 \else inserted \cr -> \crcr in \crl, \crll and \crli \doverbinput: \ifeof\vifile added (bug ``empty line at EOF'' corrected) eTeX support for multilang added. -Feb. 2014 \sortcitations introduced, internal macros of \cite rewritten. +Feb. 2014 \sortcitations introduced, internal macros of \cite rewritten Mar. 2014 \frame: \setbox0=\hbox{{#1}} in order to \aftergroup in #1 - \mnote: \pdfsave,\pdfrestore inserted, \mnote colors rewritten. - + \mnote: \pdfsave,\pdfrestore inserted, \mnote colors rewritten +Apr. 2014 \nonumcitations, \ecite, \printbib, \lastbibnum introduced + \wbib, \citelink rewritten (more parameters now) + \destheight rewritten as macro, sorry + \fnotehook introduced +Apr. 2014b \nocite[*] bug removed, \insertmark corrected +Apr. 2014c nowarn about old csplain if csplain isn't used %%%%%%%%%%%%%% End of opmac.tex |