summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-01-05 01:15:05 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-01-05 01:15:05 +0100
commit5de7c57d3703cadcde3287f20fa5e03aa175a8e1 (patch)
tree1a6348c62b79f95bca9e8f6bd4e9e49ef8bb4614 /tex/context/base
parentf001d9ba5954210bfe37144d6aff612260c754a7 (diff)
downloadcontext-5de7c57d3703cadcde3287f20fa5e03aa175a8e1.tar.gz
2015-01-05 00:16:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4392 -> 4380 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/lpdf-epd.lua2
-rw-r--r--tex/context/base/mult-low.lua2
-rw-r--r--tex/context/base/publ-imp-apa.lua7
-rw-r--r--tex/context/base/publ-imp-apa.mkvi242
-rw-r--r--tex/context/base/publ-imp-aps.lua565
-rw-r--r--tex/context/base/publ-imp-aps.mkvi1485
-rw-r--r--tex/context/base/publ-ini.lua2
-rw-r--r--tex/context/base/publ-ini.mkiv8
-rw-r--r--tex/context/base/publ-sor.lua13
-rw-r--r--tex/context/base/status-files.pdfbin24903 -> 24913 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin356660 -> 356714 bytes
-rw-r--r--tex/context/base/strc-flt.mkvi76
-rw-r--r--tex/context/base/syst-aux.mkiv9
-rw-r--r--tex/context/base/tabl-ntb.mkiv210
-rw-r--r--tex/context/base/tabl-tbl.mkiv22
-rw-r--r--tex/context/base/tabl-xtb.lua51
-rw-r--r--tex/context/base/tabl-xtb.mkvi3
20 files changed, 1694 insertions, 1007 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index c846aeb3f..bc27a12af 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2015.01.02 11:55}
+\newcontextversion{2015.01.05 00:14}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index bd456b7f1..6280b445f 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 558e749fa..3dc0d8cec 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2015.01.02 11:55}
+\edef\contextversion{2015.01.05 00:14}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/lpdf-epd.lua b/tex/context/base/lpdf-epd.lua
index 5ffd62bd6..4d10a26f4 100644
--- a/tex/context/base/lpdf-epd.lua
+++ b/tex/context/base/lpdf-epd.lua
@@ -47,6 +47,8 @@ local lpdf = lpdf
local lpdf_epdf = { }
lpdf.epdf = lpdf_epdf
+local pdf_open = epdf.open
+
local report_epdf = logs.reporter("epdf")
local getDict, getArray, getReal, getNum, getString, getBool, getName, getRef, getRefNum
diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua
index f96ebacbc..bd6f3c04d 100644
--- a/tex/context/base/mult-low.lua
+++ b/tex/context/base/mult-low.lua
@@ -203,7 +203,7 @@ return {
--
"normalbaselineskip", "normallineskip", "normallineskiplimit",
--
- "availablehsize", "localhsize", "setlocalhsize", "distributedhsize",
+ "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction",
--
"nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs",
--
diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua
index fae461d81..a529c47ec 100644
--- a/tex/context/base/publ-imp-apa.lua
+++ b/tex/context/base/publ-imp-apa.lua
@@ -36,7 +36,7 @@ local specification = {
interpreter = "author",
composer = "author",
producer = "author",
- doi = "url",
+ doi = "url",
url = "url",
page = "pagenumber",
pages = "pagenumber",
@@ -98,6 +98,7 @@ local categories = specification.categories
categories.article = {
sets = {
author = { "author", "editor", "title" },
+ volume = { "volume", "number", "pages" },
doi = generic.doi,
isbn = { "issn" },
},
@@ -107,7 +108,7 @@ categories.article = {
optional = {
"year",
"subtitle", "type", "file",
- "journal", "volume", "number", "pages",
+ "journal", "volume",
"doi", "note", "isbn"
},
}
@@ -123,7 +124,7 @@ categories.magazine = {
},
optional = {
"subtitle", "type", "file",
- "volume", "number", "pages",
+ "volume",
"month", "day",
"doi", "note", "isbn"
},
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index b8402e15a..5e6cc20db 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -34,7 +34,7 @@
\c!lastnamesep={,\nobreakspace\textampersand\space},
\c!finalnamesep={,\nobreakspace\textampersand\space},
\c!firstnamesep=\space,
- \c!otherstext={\space\btxlabeltext{\currentbtxspecification:others}},
+ \c!otherstext={,\space\btxlabeltext{\currentbtxspecification:others}},
\c!juniorsep=\space,
\c!vonsep=\space,
\c!initialsep=\space, % between initials and lastname
@@ -123,6 +123,13 @@
\c!finalnamesep={\space\btxlabeltext{\currentbtxspecification:and}\space}, % no comma!
\c!authorconversion=\v!name]
+% The APA style also sorts the rendered list by authoryear
+
+\setupbtxrendering
+ [sorttype=authoryear,
+ numbering=no,
+ hang=20] % how to get hanging to work? ... answer: it's descriptions ...
+
% Should the following be loaded by default?
%D In order to be able to get journals expanded (or normalized or abbreviated) you need
@@ -302,7 +309,7 @@
\fi
\stoptexdefinition
-\starttexdefinition btx:apa:title-subtitle-type
+\starttexdefinition btx:apa:title
\setmode{btx:apa:title-placed}
\btxdoif {file} {
% we make the title active, opening file
@@ -314,11 +321,13 @@
\btxcolon
\btxflush{Word -> subtitle}
}
- \doifnotmode {btx:apa:thesis} {
- \btxdoif{type} {
- \btxleftbracket
- \btxflush{Word -> type}
- \btxrightbracket
+ \doifnot {\currentbtxcategory} {techreport} {
+ \doifnotmode {btx:apa:thesis} {
+ \btxdoif{type} {
+ \btxleftbracket
+ \btxflush{Word -> type}
+ \btxrightbracket
+ }
}
}
\btxperiod
@@ -332,20 +341,17 @@
\doifelse {#it} {it} {
\begingroup
\it
- \texdefinition{btx:apa:title-subtitle-type}
+ \texdefinition{btx:apa:title}
\italiccorrection
\endgroup
} {
- \texdefinition{btx:apa:title-subtitle-type}
+ \texdefinition{btx:apa:title}
}
}
}
\stoptexdefinition
-\starttexdefinition btx:apa:editor-or-editors
- % \btxflushauthor[invertedshort] {editor}
- % driven by authorconversion=invertedshort
- %\btxflushauthor{editor}
+\starttexdefinition btx:apa:editor
\btxflush{editor}
\btxleftparenthesis
\btxsingularorplural {editor} {
@@ -356,43 +362,24 @@
\btxrightparenthesisperiod
\stoptexdefinition
-% \starttexdefinition btx:apa:flush:author
-% \btxflush{author}
-% \stoptexdefinition
-% \starttexdefinition btx:apa:flush:editor
-% \texdefinition{btx:apa:editor-or-editors}% just put the code here
-% \stoptexdefinition
-% \starttexdefinition btx:apa:flush:title
-% \texdefinition{btx:apa:title-subtitle-type}% just put the code here
-% \stoptexdefinition
-%
-% \texdefinition{btx:apa:flush:\btxfoundname{author}}
-%
-% can be used in:
+\starttexdefinition btx:apa:author
+ \btxflush{author}
+\stoptexdefinition
\starttexdefinition btx:apa:authoryear
% we make the authoryear active, pointing to the citation
\texdefinition{btx:apa:inject} {internal(\currentbtxinternal)}
{
- \doifelse {\btxfoundname{author}} {author} {
- % \btxflushauthor[invertedshort] {author}
- % driven by authorconversion=invertedshort
- \btxflush{author}
- } {
- \doifelse {\btxfoundname{author}} {title} {
- \texdefinition{btx:apa:title-subtitle-type}
- } {
- \doifelse {\btxfoundname{author}} {editor} {
- \texdefinition{btx:apa:editor-or-editors}
- } {
- \btxflush{author}
- }
- }
- }
+ % author is a set, e.g.
+ % author = { "author", "editor", "publisher", "title" },
+ \executeifdefined
+ {btx:apa:\btxfoundname{author}}
+ {\texdefinition{btx:apa:author}}
\btxleftparenthesis
\btxdoifelse {year} {
\btxflush{year}
- \btxflush{suffix}
+ %\btxflush{suffix}
+ \btxflush{suffixedyear}
\btxdoif {month} {
\btxcomma
\btxflush{month}
@@ -403,7 +390,7 @@
}
} {
\btxlabeltext{apa:nd}
- \btxdoif {suffix} {
+ \btxdoif {suffix} {% check this!
\btxspace
\btxflush{suffix}
}
@@ -425,7 +412,7 @@
\btxdoifelse {editor} {
\btxlabeltext{apa:In}
\btxspace
- \texdefinition{btx:apa:editor-or-editors}
+ \texdefinition{btx:apa:editor}
\btxdoif {#title} {
\texdefinition{btx:apa:italic}{Word -> #title}
}
@@ -438,91 +425,67 @@
}
\stoptexdefinition
-\starttexdefinition btx:apa:doif-edition-or-volume-or-number-or-pages #edition #if
- \btxdoifelse {#edition} {
- #if
- }{
- \btxdoifelse {volume} {
- #if
- } {
- \btxdoifelse {number} {
- #if
+\starttexdefinition btx:apa:editionset
+ \btxdoifelse {edition} {
+ \btxleftparenthesis
+ \doif {\currentbtxcategory} {techreport} {
+ \btxdoifelse {type} {
+ \btxflush{Word -> type}
} {
- \btxdoif {pages} {
- #if
- }
+ \btxlabeltext{apa:technicalreport}
}
+ \setmode{btx:apa:comma}
}
- }
-\stoptexdefinition
-
-\starttexdefinition btx:apa:edition-volume-number-pages #edition
- \texdefinition{btx:apa:doif-edition-or-volume-or-number-or-pages}{#edition}{\btxleftparenthesis}
- \btxdoifelse {#edition} {
- \btxflush{#edition}
- \doif {#edition} {edition} {
+ \doif {\btxfoundname{edition}} {edition} {
+ \doifmode {btx:apa:comma}
+ {\btxcomma}
+ \btxflush{edition}
\btxspace
\btxlabeltext{apa:edition}
+ \setmode{btx:apa:comma}
}
- } {
- \doif {\currentbtxcategory} {techreport} {
- \btxspace
- \btxlabeltext{apa:technicalreport}
- }
- }
- \btxdoif {volume} {
- \btxdoif {#edition} {
- \doifelse {#edition} {edition}
- {\btxcomma} {\btxspace}
- }
- \btxoneorrange {volume} {
- \btxlabeltext{apa:Volume}
- } {
- \btxlabeltext{apa:Volumes}
- }
- \btxspace
- \btxflush{volume}
- }
- \btxdoif {number} {
- \btxdoifelse {volume} {
- \btxcomma
- } {
- \btxdoifelse {#edition} {
- \doifelse {#edition} {edition}
- {\btxcomma} {\btxspace}
+ \btxdoif {volume} {
+ \doifmode {btx:apa:comma}
+ {\btxcomma}
+ \btxoneorrange {volume} {
+ \btxlabeltext{apa:Volume}
} {
- \btxspace
+ \btxlabeltext{apa:Volumes}
}
+ \btxspace
+ \btxflush{volume}
+ \setmode{btx:apa:comma}
}
- \btxlabeltext{apa:Number}
- \btxspace
- \btxflush{number}
- }
- \btxdoif {pages} {
- \btxdoifelse {volume} {
- \btxcomma
- } {
- \btxdoifelse {#edition} {
- \doifelse {#edition} {edition}
- {\btxcomma} {\btxspace}
+ \btxdoif {number} {
+ \doifmode {btx:apa:comma}
+ {\btxcomma}
+ \btxlabeltext{apa:Number}
+ \btxspace
+ \btxflush{number}
+ \setmode{btx:apa:comma}
+ }
+ \btxdoif {pages} {
+ \doifmode {btx:apa:comma}
+ {\btxcomma}
+ \btxoneorrange {pages} {
+ \btxlabeltext{apa:p}
} {
- \btxdoif {number} {
- \btxcomma
- }
+ \btxlabeltext{apa:pp}
}
+ \btxspace
+ \btxflush{pages}
}
- \btxoneorrange {pages} {
- \btxlabeltext{apa:p}
- } {
- \btxlabeltext{apa:pp}
+ \btxrightparenthesisperiod
+ } {
+ \doif {\currentbtxcategory} {techreport} {
+ \btxleftparenthesis
+ \btxlabeltext{apa:technicalreport}
+ \btxrightparenthesisperiod
}
- \btxspace
- \btxflush{pages}
}
- \texdefinition{btx:apa:doif-edition-or-volume-or-number-or-pages}{#edition}{\btxrightparenthesisperiod}
\stoptexdefinition
-\starttexdefinition btx:apa:journal-volume-number-pages
+\starttexdefinition btx:apa:journal-volumeset
\btxdoif {journal} {
\btxspace
% expandedjournal abbreviatedjournal
@@ -530,7 +493,9 @@
% A newspaper may not have a volume but may have a number!
\btxdoif {volume} {
\btxcomma
- \texdefinition{btx:apa:italic}{volume}
+ \doif {\btxfoundname{volume}} {volume} {
+ \texdefinition{btx:apa:italic}{volume}
+ }
\btxdoifnot {number} {
\btxdoifelse {pages}
{\btxcomma}
@@ -617,16 +582,16 @@
% use \btxentry here?
\btxspace
\begingroup
- \setbreakpoints[doi]
- \btxdoifelseinteractive {doi} {
- \goto {
+ \setbreakpoints[doi]
+ \btxdoifelseinteractive {doi} {
+ \goto {
+ doi:\btxflush{doi}
+ } [
+ url(http://dx.doi.org/\btxflush{doi})
+ ]
+ } {
doi:\btxflush{doi}
- } [
- url(http://dx.doi.org/\btxflush{doi})
- ]
- } {
- doi:\btxflush{doi}
- }
+ }
\endgroup
\stoptexdefinition
@@ -634,8 +599,7 @@
% also issn - see publ-imp-apa.lua
\btxdoif {isbn} {
\btxleftparenthesis
- %broken: \btxfoundname{WORD -> isbn}:\btxspace
- \btxfoundname{isbn}:\btxspace
+ \WORD{\btxfoundname{isbn}}:\btxspace
\btxflush{isbn}
\btxrightparenthesis
}
@@ -754,7 +718,7 @@
\startsetups btx:apa:article
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{}
- \texdefinition{btx:apa:journal-volume-number-pages}
+ \texdefinition{btx:apa:journal-volumeset}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -765,7 +729,7 @@
\startsetups btx:apa:magazine
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{}
- \texdefinition{btx:apa:journal-volume-number-pages}
+ \texdefinition{btx:apa:journal-volumeset}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -776,7 +740,7 @@
\startsetups btx:apa:newspaper
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{}
- \texdefinition{btx:apa:journal-volume-number-pages}
+ \texdefinition{btx:apa:journal-volumeset}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -790,7 +754,7 @@
\startsetups btx:apa:book
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{it}
- \texdefinition{btx:apa:edition-volume-number-pages}{edition}
+ \texdefinition{btx:apa:editionset}
\texdefinition{btx:apa:wherefrom-publisher-author-is-}{author}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -809,7 +773,7 @@
\btxspace
}
\texdefinition{btx:apa:editor-in-}{title}
- \texdefinition{btx:apa:edition-volume-number-pages}{edition}
+ \texdefinition{btx:apa:editionset}
\texdefinition{btx:apa:wherefrom-publisher-author-is-}{author}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -825,7 +789,7 @@
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{}
\texdefinition{btx:apa:editor-in-}{booktitle}
- \texdefinition{btx:apa:edition-volume-number-pages}{edition}
+ \texdefinition{btx:apa:editionset}
\texdefinition{btx:apa:wherefrom-publisher-author-is-}{author}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -838,7 +802,7 @@
\startsetups btx:apa:proceedings
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{}
- \texdefinition{btx:apa:edition-volume-number-pages}{edition}
+ \texdefinition{btx:apa:editionset}
\btxdoifelse {editor} {
\btxdoif {organization} {
\btxspace
@@ -861,7 +825,7 @@
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{}
\texdefinition{btx:apa:editor-in-}{booktitle}
- \texdefinition{btx:apa:edition-volume-number-pages}{edition}
+ \texdefinition{btx:apa:editionset}
\btxdoif {organization} {
\btxspace
\btxflush{organization}
@@ -885,9 +849,9 @@
\texdefinition{btx:apa:title-if-not-placed}{it}
\btxleftparenthesis
\btxdoifelse {type} {
- \btxflush{type}
+ \btxflush{Word -> type}
} {
- \btxlabeltext{apa:\currentbtxcategory}
+ \Word{\btxlabeltext{apa:\currentbtxcategory}}
}
\btxrightparenthesis
\btxdoif {school} {
@@ -936,7 +900,7 @@
\startsetups btx:apa:manual
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{it}
- \texdefinition{btx:apa:edition-volume-number-pages}{edition}
+ \texdefinition{btx:apa:editionset}
\texdefinition{btx:apa:wherefrom-publisher-author-is-}{organization}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -948,7 +912,7 @@
\startsetups btx:apa:techreport
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}{it}
- \texdefinition{btx:apa:edition-volume-number-pages}{type}
+ \texdefinition{btx:apa:editionset}
\texdefinition{btx:apa:wherefrom-publisher-author-is-}{institution}
\texdefinition{btx:apa:url-note-doi}
\stopsetups
@@ -1073,6 +1037,10 @@
% If all else fails to match:
\startsetups btx:apa:literal
+ %\btxleftparenthesis
+ \removeunwantedspaces(
+ \btxflush{key}
+ \btxrightparenthesis
\btxdoif {text} {
\btxflush{text}
}
diff --git a/tex/context/base/publ-imp-aps.lua b/tex/context/base/publ-imp-aps.lua
index a918c755d..3e63c6d88 100644
--- a/tex/context/base/publ-imp-aps.lua
+++ b/tex/context/base/publ-imp-aps.lua
@@ -1,68 +1,511 @@
--- to be checked
-
-return {
- name = "aps",
- version = "1.00",
- comment = "APA specification.",
- author = "Alan Braslau and Hans Hagen",
+local specification = {
+ --
+ -- metadata
+ --
+ name = "aps",
+ version = "1.00",
+ comment = "APS specification",
+ author = "Alan Braslau and Hans Hagen",
copyright = "ConTeXt development team",
+ --
+ -- derived (combinations of) fields (all share the same default set)
+ --
+ virtual = {
+ "authoryear",
+ "authoryears",
+ "authornum",
+ "num",
+ "suffix",
+ },
+ --
+ -- special datatypes
+ --
+ types = {
+ --
+ -- list of fields that are interpreted as names: "NAME [and NAME]" where
+ -- NAME is one of the following:
+ --
+ -- First vons Last
+ -- vons Last, First
+ -- vons Last, Jrs, First
+ -- Vons, Last, Jrs, First
+ --
+ author = "author",
+ editor = "author",
+ artist = "author",
+ interpreter = "author",
+ composer = "author",
+ producer = "author",
+ doi = "url",
+ url = "url",
+ page = "pagenumber",
+ pages = "pagenumber",
+ keywords = "keyword",
+ },
+ --
+ -- categories with their specific fields
+ --
categories = {
- article = {
- required = { "author", "title", "journal", "year" },
- optional = { "volume", "number", "pages", "month", "note" },
- },
- book = {
- required = { "author", "editor", "title", "publisher", "year" },
- optional = { "volume", "number", "series", "address", "edition", "month","note" },
- },
- booklet = {
- required = { "title" },
- optional = { "author", "howpublished", "address", "month", "year", "note" },
- },
- inbook = {
- required = { "author", "editor", "title", "chapter", "pages", "publisher","year" },
- optional = { "volume", "number", "series", "type", "address", "edition", "month", "note" },
- },
- incollection = {
- required = { "author", "title", "booktitle", "publisher", "year" },
- optional = { "editor", "volume", "number", "series", "type", "chapter", "pages", "address", "edition", "month", "note" },
- },
- inproceedings = {
- required = { "author", "title", "booktitle", "year" },
- optional = { "editor", "volume", "number", "series", "pages", "address", "month","organization", "publisher", "note" },
- },
- manual = {
- required = { "title" },
- optional = { "author", "organization", "address", "edition", "month", "year", "note" },
+ --
+ -- the following fields are for documentation and testing purposes
+ --
+ ["demo-a"] = {
+ sets = {
+ author = { "author", "institution", "organization" },
+ doi = { "doi", "url" },
+ },
+ required = { "author", "title", "year", "note", "doi" },
+ optional = { "subtitle", "file" },
},
- mastersthesis = {
- required = { "author", "title", "school", "year" },
- optional = { "type", "address", "month", "note" },
- },
- misc = {
- required = { "author", "title", "howpublished", "month", "year", "note" },
- optional = { "author", "title", "howpublished", "month", "year", "note" },
- },
- phdthesis = {
- required = { "author", "title", "school", "year" },
- optional = { "type", "address", "month", "note" },
- },
- proceedings = {
- required = { "title", "year" },
- optional = { "editor", "volume", "number", "series", "address", "month", "organization", "publisher", "note" },
- },
- techreport = {
- required = { "author", "title", "institution", "year" },
- optional = { "type", "number", "address", "month", "note" },
- },
- patent = {
- required = { "nationality", "number", "year", "yearfiled" },
- optional = { "author", "title", "language", "assignee", "address", "type", "day", "dayfiled", "month", "monthfiled", "note", },
- },
- unpublished = {
- required = { "author", "title", "note" },
- optional = { "month", "year" },
+ ["demo-b"] = {
+ sets = {
+ authors = { "author", "institution", "organization" },
+ doi = { "doi", "url" },
+ },
+ required = { "authors", "title", "year", "note", "doi" },
+ optional = { "subtitle", "file" },
},
+ --
+ -- more categories are added below
+ --
},
}
+local generic = {
+ --
+ -- A set returns the first field (in order of position below) that is found
+ -- present in an entry. A set having the same name as a field conditionally
+ -- allows the substitution of an alternate field.
+ --
+ -- note that anything can get assigned a doi or be available online.
+ doi = { "doi", "url" },
+}
+
+-- Note that the APS specification allows an additional field "collaboration"
+-- to be rendered following the author list (if the collaboration name appears
+-- in the byline of the cited article).
+
+-- Definition of recognized categories and the fields that they contain.
+-- Required fields should be present; optional fields may also be rendered;
+-- all other fields will be ignored.
+
+-- Sets contain either/or in order of precedence.
+--
+-- For a category *not* defined here yet present in the dataset, *all* fields
+-- are taken as optional. This allows for flexibility in the addition of new
+-- categories.
+
+local categories = specification.categories
+
+-- an article from a journal
+
+categories.article = {
+ sets = {
+ author = { "author", "editor", "title" },
+ volume = { "volume", "number", "pages" },
+ doi = generic.doi,
+ isbn = { "issn" },
+ },
+ required = {
+ "author"
+ },
+ optional = {
+ "collaboration",
+ "year",
+ "subtitle", "type", "file",
+ "journal", "volume",
+ "doi", "note", "isbn"
+ },
+}
+
+-- an article from a magazine
+
+categories.magazine = {
+ sets = categories.article.sets,
+ required = {
+ "author",
+ "year",
+ "journal",
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "type", "file",
+ "volume",
+ "month", "day",
+ "doi", "note", "isbn"
+ },
+}
+
+categories.newspaper = categories.magazine
+
+-- (from jabref) to be identified and setup ...
+
+categories.periodical = {
+ sets = {
+ author = { "editor", "publisher" },
+ doi = generic.doi,
+ isbn = { "issn" },
+ },
+ required = {
+ "title",
+ "year",
+ },
+ optional = {
+ "author",
+ "collaboration",
+ "subtitle", "file",
+ "series", "volume", "number", "month",
+ "organization",
+ "doi", "note", "isbn"
+ },
+}
+
+-- (from jabref) to be identified and setup ...
+
+categories.standard = {
+ sets = {
+ author = { "author", "institution", "organization" },
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "year",
+ "title", "subtitle",
+ "doi", "note",
+ },
+ optional = {
+ "collaboration",
+ },
+}
+
+-- a book with an explicit publisher.
+
+categories.book = {
+ sets = {
+ author = { "author", "editor", "publisher", "title" },
+ edition = { "edition", "volume", "number", "pages" },
+ doi = generic.doi,
+ },
+ required = { "author" },
+ optional = {
+ "collaboration",
+ "year", "month", "day",
+ "subtitle", "type", "file",
+ "edition", "series",
+ "address",
+ "doi", "note", "isbn"
+ },
+}
+
+-- a part of a book, which may be a chapter (or section or whatever) and/or a range of pages.
+
+categories.inbook = {
+ sets = {
+ author = { "author", "editor", "publisher", "title", "chapter" },
+ edition = { "edition", "volume", "number", "pages" },
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "year" ,
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "type", "file",
+ "edition", "series",
+ "month",
+ "address",
+ "doi", "note", "isbn"
+ },
+}
+
+-- a work that is printed and bound, but without a named publisher or sponsoring institution.
+
+categories.booklet = {
+ sets = {
+ author = { "author", "title" },
+ doi = generic.doi,
+ },
+ required = {
+ "author"
+ },
+ optional = {
+ "collaboration",
+ "year", "month",
+ "subtitle", "type", "file",
+ "address",
+ "howpublished",
+ "doi", "note", "isbn"
+ },
+}
+
+-- a part of a book having its own title.
+
+categories.incollection = {
+ sets = {
+ author = { "author", "editor", "publisher", "title" },
+ edition = { "edition", "volume", "number", "pages" },
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "booktitle",
+ "year",
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "type", "file",
+ "month",
+ "edition", "series",
+ "chapter",
+ "address",
+ "doi", "note", "isbn"
+ },
+}
+
+-- the proceedings of a conference.
+
+categories.proceedings = {
+ sets = {
+ author = { "editor", "publisher", "title" },
+ edition = { "edition", "volume", "number", "pages" },
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "year"
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "file",
+ "edition", "series",
+ "month",
+ "address", "organization",
+ "doi", "note", "isbn"
+ },
+}
+
+-- an article in a conference proceedings.
+
+categories.inproceedings = {
+ sets = categories.incollection.sets,
+ required = categories.incollection.required,
+ optional = {
+ "collaboration",
+ "subtitle", "type", "file",
+ "month",
+ "edition", "series",
+ "address", "organization",
+ "doi", "note", "isbn"
+ },
+}
+
+categories.conference = categories.inproceedings
+
+-- a thesis (of course).
+
+categories.thesis = {
+ sets = {
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "title",
+ "school",
+ "year",
+ "type"
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "file",
+ "month",
+ "address",
+ "doi", "note", "isbn"
+ },
+}
+
+categories.mastersthesis = {
+ sets = categories.thesis.sets,
+ required = {
+ "author",
+ "title",
+ "school",
+ "year"
+ },
+ optional = {
+ "collaboration",
+ "type",
+ "subtitle", "file",
+ "month",
+ "address",
+ "doi", "note", "isbn"
+ },
+}
+categories.phdthesis = categories.mastersthesis
+
+-- a report published by a school or other institution, usually numbered within a series.
+
+categories.techreport = {
+ sets = {
+ -- no "edition"!
+ edition = { "type", "volume", "number", "pages" },
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "title",
+ "institution",
+ "year"
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "file",
+ "edition", -- set, not field!
+ "month",
+ "address",
+ "doi", "note", "isbn"
+ },
+}
+
+-- technical documentation.
+
+categories.manual = {
+ sets = {
+ edition = { "edition", "volume", "number", "pages" },
+ doi = generic.doi,
+ },
+ required = {
+ "title"
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "file",
+ "author", "address", "organization",
+ "edition", "month", "year",
+ "doi", "note", "isbn"
+ },
+}
+
+-- a patent (of course).
+
+categories.patent = {
+ sets = {
+ doi = generic.doi,
+ },
+ required = {
+ "nationality",
+ "number",
+ "year", "yearfiled"
+ },
+ optional = {
+ "type",
+ --check this: "language",
+ "collaboration",
+ "author", "assignee",
+ "title", "subtitle", "file",
+ "address",
+ "day", "dayfiled", "month", "monthfiled",
+ "doi", "note"
+ },
+}
+
+-- a document having an author and title, but not formally published.
+
+categories.unpublished = {
+ sets = {
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "title",
+ "note"
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "file",
+ "year", "month",
+ "doi"
+ },
+}
+
+-- like misc below but includes organization.
+
+categories.electronic = {
+ sets = {
+ doi = generic.doi,
+ },
+ required = {
+ "title"
+ },
+ optional = {
+ "subtitle", "type", "file",
+ "year", "month",
+ "author",
+ "collaboration",
+ "address",
+ "organization",
+ "howpublished",
+ "doi", "note"
+ },
+}
+
+-- use this type when nothing else fits.
+
+categories.misc = {
+ sets = {
+ doi = generic.doi,
+ isbn = { "isbn", "issn" },
+ },
+ required = {
+ -- nothing is really important here
+ },
+ optional = {
+ "author",
+ "collaboration",
+ "title", "subtitle", "file",
+ "year", "month",
+ "howpublished",
+ "doi", "note", "isbn"
+ },
+}
+
+-- other (whatever jabref does not know!)
+
+categories.other = {
+ sets = {
+ doi = generic.doi,
+ isbn = { "isbn", "issn" },
+ },
+ required = {
+ "author",
+ "title",
+ "year"
+ },
+ optional = {
+ "collaboration",
+ "subtitle", "file",
+ "doi", "note", "isbn"
+ },
+}
+
+-- if all else fails to match:
+
+categories.literal = {
+ sets = {
+ author = { "key" },
+ doi = generic.doi,
+ },
+ required = {
+ "author",
+ "text"
+ },
+ optional = {
+ "collaboration",
+ "doi", "note"
+ },
+ virtual = false,
+}
+
+-- done
+
+return specification
diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi
index 84e0c8fcc..60fb43ed8 100644
--- a/tex/context/base/publ-imp-aps.mkvi
+++ b/tex/context/base/publ-imp-aps.mkvi
@@ -1,7 +1,7 @@
%D \module
%D [ file=publ-imp-aps,
-%D version=2014.05.25,
-%D title=APA bibliography style,
+%D version=2013.12.12,
+%D title=APS bibliography style,
%D subtitle=Publications,
%D author=Alan Braslau and Hans Hagen,
%D date=\currentdate,
@@ -10,159 +10,360 @@
%C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted
%D by \PRAGMA. See mreadme.pdf for details.
+% \loadbtxdefinitionfile[def]
+
\startbtxrenderingdefinitions[aps]
+%D Reference:
+%D \startTEX
+%D @Book{APS2011,
+%D title ={Physical Review Style and Notation Guide}
+%D year ={2011},
+%D month ={June}
+%D edition ={Revised},
+%D editor ={Waldron, A and Judd, P. and Miller, V.},
+%D address ={Ridge, NY},
+%D publisher={American Physical Society},
+%D pages ={26},
+%D url ={http://journals.aps.org/files/styleguide-pr.pdf}
+%D }
+%D \stopTEX
+
+% set all APS compliant values (may be redundant but we do not count on defaults.)
+
+\setupbtxlistvariant
+ [\c!namesep={,\space},
+ \c!lastnamesep={,\nobreakspace\textampersand\space},
+ \c!finalnamesep={,\nobreakspace\textampersand\space},
+ \c!firstnamesep=\space,
+ \c!otherstext={\space\btxlabeltext{\currentbtxspecification:others}},
+ \c!juniorsep=\space,
+ \c!vonsep=\space,
+ \c!initialsep=\space, % between initials and lastname
+ %\c!initialssep=\space, % between multiple initials % todo
+ %\c!initialsterminator={.}, % todo
+ \c!surnamesep={,\space},
+ \c!surnameinitialsep={,\space},
+ \c!surnamefirstnamesep={,\space},
+ \c!etallimit=10,
+ \c!etaldisplay=\btxlistvariantparameter\c!etallimit,
+ %\c!journalconversion=\v!normal,
+ \c!monthconversion=\v!month,
+ \c!authorconversion=short]
+
+\definebtxlistvariant
+ [author]
+
+\definebtxlistvariant
+ [editor]
+ [author]
+
+% like \setupbtxlistvariant above but not exactly...
+
+\setupbtxcitevariant
+ [\c!alternative=num,
+ \c!namesep=\btxlistvariantparameter\c!namesep,
+ \c!lastnamesep=\btxlistvariantparameter\c!lastnamesep,
+ \c!finalnamesep={\nobreakspace\textampersand\space}, % no comma!
+ \c!firstnamesep=\btxlistvariantparameter\c!firstnamesep,
+ \c!otherstext=\btxlistvariantparameter\c!otherstext,
+ \c!juniorsep=\btxlistvariantparameter\c!juniorsep,
+ \c!vonsep=\btxlistvariantparameter\c!vonsep,
+ \c!initialsep=\btxlistvariantparameter\c!initialsep,
+ %\c!initialssep=\btxlistvariantparameter\c!initialssep,
+ %\c!initialsterminator=\btxlistvariantparameter\c!initialsterminator,
+ \c!surnamesep=\btxlistvariantparameter\c!surnamesep,
+ \c!surnameinitialsep=\btxlistvariantparameter\c!surnameinitialsep,
+ \c!surnamefirstnamesep=\btxlistvariantparameter\c!surnamefirstnamesep,
+ \c!etallimit=\btxlistvariantparameter\c!etallimit,
+ \c!etaldisplay=\btxlistvariantparameter\c!etaldisplay,
+ % \c!monthconversion=\btxlistvariantparameter\c!monthconversion,
+ \c!authorconversion=\btxlistvariantparameter\c!authorconversion,
+ \c!interaction=\v!start,
+ % \c!setups=btx:cite:initialize,
+ \c!pubsep={,\space},
+ \c!lastpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!finalpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!sorttype=,
+ \c!compress=\v!no,
+ \c!inbetween=\space,
+ \c!range=\endash,
+ \c!left={[},
+ \c!middle=,
+ \c!right={]}]
+
+\definebtxcitevariant
+ [author]
+ [\c!lastnamesep={,\nobreakspace\textampersand\space},
+ \c!finalnamesep={\nobreakspace\textampersand\space}, % no comma!
+ \c!authorconversion=\v!name]
+
+\definebtxcitevariant
+ [authoryear]
+ [\c!compress=\v!yes,
+ \c!inbetween={,\space},
+ \c!left={(},
+ \c!right={)},
+ \c!pubsep={;\space},
+ \c!lastpubsep={;\space},
+ \c!finalpubsep={;\space},
+ \c!lastnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!finalnamesep={\space\btxlabeltext{\currentbtxspecification:and}\space}, % no comma!
+ \c!authorconversion=\v!name]
+
+\definebtxcitevariant
+ [authoryears]
+ [authoryear]
+ [\c!left=,
+ \c!inbetween={\space(},
+ \c!pubsep={);\space},
+ \c!lastpubsep={);\space},
+ \c!finalpubsep={);\space},
+ \c!lastnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!finalnamesep={\space\btxlabeltext{\currentbtxspecification:and}\space}, % no comma!
+ \c!authorconversion=\v!name]
+
+% Should the following be loaded by default?
+
+%D In order to be able to get journals expanded (or normalized or abbreviated) you need
+%D to load a list:
+%D
+%D \starttyping
+%D \btxloadjournallist[journals.txt] % the jabref list
+%D \stoptyping
+
+%D Sometimes we have verbose injections in an entry and these can be language
+%D dependent, so we use labels.
+%D
+%D Because we want to mix rendering (in the manual) we need a namespace in label
+%D texts:
+
\setupbtxlabeltext
[en]
[aps:mastersthesis={Master's thesis},
aps:phdthesis={PhD thesis},
- aps:technicalreport={Technical report},
- aps:editor=editor,
- aps:editors=editors,
- aps:edition=edition,
- aps:volume=volume,
- aps:Volume=Volume,
+ aps:technicalreport={Tech. Rep.}, % Technical report
+ aps:supplement={Suppl.}, % Supplement
+ aps:patent=Patent,
+ aps:Translator={Trans.}, % Translator(s)
+ aps:Editor={Ed.}, % Editor
+ aps:Editors={Eds.}, % Editors
+ aps:edition={ed.}, % edition
+ aps:volume=volume, % used?
+ aps:Volume={Vol.}, % Volume
+ aps:Volumes={Vols.}, % Volumes
aps:number=number,
- aps:Number=Number,
+ aps:Number={No.}, % Number
+ aps:nd={n.d.}, % no date
aps:in=in,
aps:of=of,
aps:In=In,
- aps:p=p,
- aps:pp=pp,
+ aps:Part={Pt.}, % Part
+ aps:p={p.},
+ aps:pp={pp.},
aps:pages=pages,
aps:and=and,
- aps:others={et al.}]
+ aps:period={. },
+ aps:Author=Author,
+ aps:Reference={Ref.},
+ aps:References={Refs.},
+ aps:Advanced={to be published},
+ aps:Retrieved={Available from}, % {Retrieved from},
+ aps:others={\it et al.}]
\setupbtxlabeltext
[fr]
[aps:mastersthesis={Thèse de master (DEA, DESS, master)},
aps:phdthesis={Thèse de doctorat},
aps:technicalreport={Rapport technique},
- aps:editor=éditeur,
- aps:editors=éditeurs,
+ aps:supplement=Supplément,
+ aps:patent=Brevet,
+ aps:Translator=Traducteur,
+ aps:Editor=Éditeur,
+ aps:Editors=Éditeurs,
aps:edition=édition,
aps:volume=volume,
aps:Volume=Volume,
+ aps:Volumes=Volumes,
aps:number=numéro,
aps:Number=Numéro,
+ aps:nd={s.d.} % sans date
aps:in=dans,
aps:of=de,
aps:In=Dans,
- aps:p=p,
- aps:pp=pp,
+ aps:Part=Partie,
+ aps:p={p.},
+ aps:pp={pp.},
aps:pages=pages,
aps:and=et,
- aps:others={et al.}]
+ aps:period={. },
+ aps:Author=Auteur,
+ aps:Reference={Réf.},
+ aps:References={Réfs.},
+ aps:Advanced={à être publié},
+ aps:Retrieved={Disponible à}, % {Téléchargé de},
+ aps:others={\it et al.}]
\setupbtxlabeltext
[de]
[aps:mastersthesis={Masterarbeit},
aps:phdthesis={Dissertation},
aps:technicalreport={Technischer Bericht},
- aps:editor=Herausgeber,
- aps:editors=Herausgeber,
- aps:edition=Auflage,
- aps:volume=Band,
+ aps:supplement={Beilage}, % Supplement
+ aps:patent=Patent,
+ aps:Translator={Ãœbersetzer}, % Ãœbers.
+ aps:Editor=Herausgeber, % Hrsg./Hg.
+ aps:Editors=Herausgeber,
+ aps:edition=Auf\/lage,
+ aps:volume=Band, % Bd.
aps:Volume=Band,
- aps:number=Numer,
- aps:Number=Numer,
+ aps:Volumes={Bände},
+ aps:number=Nummer,
+ aps:Number={Nr.},
+ aps:nd={o.D.}, % ohne Datum (mostly: o.J. / ohne Jahr)
aps:in=in,
aps:of=von,
aps:In=In,
- aps:p=S,
- aps:pp=S,
+ aps:Part=Teil,
+ aps:p={S.},
+ aps:pp={S.},
aps:pages=Seiten,
aps:and=und,
- aps:others={et al.}]
-
-% \c!authoretallimit=4,
-% \c!editoretallimit=4,
-% \c!artauthoretallimit=4,
-% \c!authoretaldisplay=1,
-% \c!editoretaldisplay=1,
-% \c!artauthoretaldisplay=1,
-% \c!authoretaltext={ {\it et al.\/}},
-% \c!editoretaltext={ {\it et al.\/}},
-% \c!artauthoretaltext={ {\it et al.\/}}]
-
-\setvariables
- [btx:aps:publisher]
- [left=\btxspace,
- right=\btxperiod]
-
-\setvariables
- [btx:aps:organization]
- [left=\btxspace,
- right=\btxperiod]
-
-\setvariables
- [btx:aps:school]
- [left=\btxcomma,
- right=\btxperiod,
- otherwise=\btxperiod]
-
-\setvariables
- [btx:aps:institution]
- [left=\btxcomma,
- right=\btxperiod,
- otherwise=\btxperiod]
-
-% \def\insertEdition#1#2#3{%
-% \begingroup
-% \insertedition{#1}{\doifnumberelse{\csname @@pb@edition\endcsname}{%
-% \ifcase \csname @@pb@edition\endcsname \or st\or nd\or rd\else th\fi
-% }{}#2}{#3}%
-% \endgroup
-% }
-
-\starttexdefinition btx:aps:chapter
- \btxdoif {chapter} {
- \btxcomma
- \btxdoifelse {type} {
- \btxflush{type}
- \btxspace
- } {
- \btxlabeltext{aps:chapter}
+ aps:period={. },
+ aps:Author=Autor,
+ aps:Reference={Ref.},
+ aps:References={Ref.},
+ aps:Advanced={veröffentlicht werden},
+ aps:Retrieved={heruntergeladen von},
+ aps:others={\it et al.}]
+
+% thanks: Andrea Valle
+
+\setupbtxlabeltext
+ [it]
+ [aps:mastersthesis={Tesi di laurea},
+ aps:phdthesis={Tesi di dottorato},
+ aps:technicalreport={Relazione tecnica},
+ aps:supplement={Supplemento},
+ aps:patent=Brevetto,
+ aps:Translator={Trad.}, % Translator(s)
+ aps:Editor={A cura di},
+ aps:Editors={A cura di},
+ aps:edition={ed.},
+ aps:volume=volume,
+ aps:Volume={Vol.},
+ aps:Volumes={Vol.},
+ aps:number=numero,
+ aps:Number=Numero,
+ aps:nd={s.d.},
+ aps:in=in,
+ aps:of=di,
+ aps:In=In,
+ aps:Part=Parte,
+ aps:p={p.},
+ aps:pp={pp.},
+ aps:pages=pagine,
+ aps:and=e,
+ aps:period={. },
+ aps:Author=Autore,
+ aps:Reference={Rif.},
+ aps:References={Rif.},
+ aps:Advanced={da pubblicare},
+ aps:Retrieved={Accessible online},
+ aps:others={\it et al.}]
+
+%D Instead of texdefinitions without arguments, we could have used setups but in my
+%D editor (hh, scite) the commands stand out better. It also saves an additional
+%D component in the name (e.g. common:) because commands and setups have a different
+%D namespace, so similar calls don't clash. Performance of definitions is somewhat
+%D better.
+
+%D \btxdoif... and \btxflush rely on the definitions in publ-imp-aps.lua:
+%D fields that are not listed as required nor optional are IGNORED.
+
+% First some helpers:
+
+\starttexdefinition btx:aps:inject #link #content
+ \ifconditional\btxinteractive
+ \ifx\currentbtxinternal\empty
+ #content
+ \else
+ \goto {
+ #content
+ } [
+ #link
+ ]
+ \fi
+ \else
+ #content
+ \fi
+\stoptexdefinition
+
+\starttexdefinition btx:aps:title
+ \btxdoif {file} {
+ % we make the title active, opening file
+ \texdefinition{btx:aps:inject} {url(file:\btxflush{file})}
+ }
+ {
+ \begingroup
+ \it
+ \btxflush{Word -> title}
+ \btxdoif {subtitle} {
+ \btxcolon
+ \btxflush{Word -> subtitle}
+ }
+ \italiccorrection
+ \endgroup
+ \doifnot {\currentbtxcategory} {techreport} {
+ \doifnotmode {btx:aps:thesis} {
+ \btxdoif{type} {
+ \btxleftbracket
+ \btxflush{Word -> type}
+ \btxrightbracket
+ }
+ }
}
- \btxspace
- \btxflush{chapter}
}
\stoptexdefinition
-\starttexdefinition btx:aps:publisher
- \btxdoif {publisher} {
- \btxflush{publisher}
- }
- \btxdoif {city} {
- \btxcomma
- \btxflush{city}
- }
- \btxdoif {country} {
- \btxcomma
- \btxflush{country}
+% need for a global option to activate or inhibit....
+
+\starttexdefinition btx:aps:optional-title
+ \btxdoif {title} {
+ \btxdoif {file} {
+ % we make the title active, opening file
+ \texdefinition{btx:aps:inject} {url(file:\btxflush{file})}
+ }
+ {
+ \quotation{%
+ \btxflush{Word -> title}
+ \btxdoif {subtitle} {
+ \btxcolon
+ \btxflush{Word -> subtitle}
+ }
+ }
+ \btxcomma
+ }
}
- \btxperiod
\stoptexdefinition
-\starttexdefinition btx:aps:pages-p-or-pp
- \btxoneorrange {pages} {
- \btxlabeltext{aps:p}
+\starttexdefinition btx:aps:editor
+ \btxflush{editor}
+ \btxleftparenthesis
+ \btxsingularorplural {editor} {
+ \btxlabeltext{aps:Editor}
} {
- \btxlabeltext{aps:pp}
+ \btxlabeltext{aps:Editors}
}
+ \btxrightparenthesisperiod
\stoptexdefinition
-\starttexdefinition btx:aps:pages
- \btxdoif {pages} {
- \btxcomma
- \btxoneorrange {pages} {
- \btxlabeltext{aps:p}
- } {
- \btxlabeltext{aps:pp}
- }
- \btxperiod
- \btxnbsp
- \btxflush{pages}
+\starttexdefinition btx:aps:author
+ \btxflush{author}
+ \btxdoif {collaboration} {
+ \btxleftparenthesis
+ \btxflush{collaboration}
+ \btxrightparenthesis
}
\stoptexdefinition
@@ -181,710 +382,556 @@
\endgroup
\stoptexdefinition
-\disablemode[btx:aps:edited-book] % hm, ugly
-
-\starttexdefinition btx:aps:note
- \btxdoif {note} {
- \btxspace
- \btxflush{note}
- \btxperiod
- }
-\stoptexdefinition
-
-\starttexdefinition btx:aps:comment
- \btxdoif {comment} {
- \btxspace
- \btxflush{comment}
- \btxperiod
- }
-\stoptexdefinition
-
-\startsetups btx:aps:article
- \btxdoif {author} {
- \btxflushauthor {author}
+\starttexdefinition btx:aps:editor-in- #title
+ \btxdoifelse {editor} {
+ \btxlabeltext{aps:In}
\btxspace
- \btxdoif {key} {
- \btxsetup{btx:format:key}
- \btxspace
- }
- }
- \btxdoif {title} {
- \btxflush{title}
- \btxperiod
- }
- \btxdoifelse {journal} {
- \btxcomma
- \btxflush{journal}
- }
- \btxdoifelse {volume} {
- \texdefinition{btx:aps:bold}{volume}
- \btxdoif {pages} {
- \btxcomma
- \btxfirstofrange{pages}
+ \texdefinition{btx:aps:editor}
+ \btxdoif {#title} {
+ \texdefinition{btx:aps:italic}{Word -> #title}
}
} {
- \btxdoif {pages} {
+ \btxdoif {#title} {
+ \btxlabeltext{aps:In}
\btxspace
- \btxfirstofrange{pages}
+ \texdefinition{btx:aps:italic}{Word -> #title}
}
}
- \btxdoif {year} {
- \btxlparent
- \btxflush{year}
- \btxrparent
- }
- \btxperiod
- \texdefinition{btx:aps:note}
- \texdefinition{btx:aps:comment}
-\stopsetups
-
-\disablemode[btx:apa:edited-book] % hm, ugly
+\stoptexdefinition
-\startsetups btx:aps:book
- \btxdoif {author} {
- \btxflushauthor {author}
- \btxspace
- } {
- \btxdoifelse {editor} {
- \btxflush{editor}
- \btxcomma
- \btxsingularorplural {editor} {
- \btxlabeltext{aps:editor}
+\starttexdefinition btx:aps:editionset
+ \btxdoifelse {edition} {
+ \btxleftparenthesis
+ \doif {\currentbtxcategory} {techreport} {
+ \btxdoifelse {type} {
+ \btxflush{Word -> type}
} {
- \btxlabeltext{aps:editors}
+ \btxlabeltext{aps:technicalreport}
}
+ \setmode{btx:aps:comma}
+ }
+ \doif {\btxfoundname{edition}} {edition} {
+ \doifmode {btx:aps:comma}
+ {\btxcomma}
+ \btxflush{edition}
\btxspace
- \setmode{btx:apa:edited-book}
- } {
- \btxdoif {key} {
- \btxflush{key}
- \btxperiod
- }
+ \btxlabeltext{aps:edition}
+ \setmode{btx:aps:comma}
}
- }
- \btxdoifelse {title} {
- \btxcomma
- \texdefinition {btx:apa:italic} {
- \doifmode {btx:apa:edited-book} {
- \resetmode{editedbook}
- \btxdoifelse {volume} {
- \btxlabeltext{aps:Number}
- \btxnbsp
- \btxflush{number}
- \btxdoifelse {series} {
- \btxlabeltext{aps:in}
- \btxnbsp
- \btxflush{series}
- \btxperiod
- } {
- \btxdoif {crossref} {
- \btxlabeltext{aps:in}
- \btxnbsp
- \btxflush{crossref}
- \btxperiod
- }
- }
- } {
- \insertseries{ }{.}{}
- }
+ \btxdoif {volume} {
+ \doifmode {btx:aps:comma}
+ {\btxcomma}
+ \btxoneorrange {volume} {
+ \btxlabeltext{aps:Volume}
} {
- \btxdoif {crossref} {
- \texdefinition {btx:aps:chapter}
- \btxdoif {pages} {
- \btxcomma
- \btxflush{pages}
- \texdefinition{btx:aps:pages-p-or-pp}
- }
- \btxperiod
- \btxdoif {volume} {
- \btxlabeltext{aps:Volume}
- \btxnbsp
- \btxflush{volume}
- \btxspace
- \btxlabeltext{aps:of}
- \btxnbsp
- }%
- \btxflush{crossref}
- } {
- \btxdoif {volume} {
- \btxcomma
- \btxlabeltext{aps:volume}
- \btxnbsp
- \btxflush{volume}
- \btxdoif {series} {
- \btxspace
- \btxlabeltext{aps:of}
- \btxnbsp
- \texdefinition {btx:aps:italic} {
- \btxflush{series}
- }
- }
- \btxdoif {chapter} {
- \btxcomma
- \btxflush{chapter}
- }
- \texdefinition{btx:aps:pages}
- \btxperiod
- }
- }
+ \btxlabeltext{aps:Volumes}
}
+ \btxspace
+ \btxflush{volume}
+ \setmode{btx:aps:comma}
}
- } {
- \btxspace
- }
- \btxdoif {year} {
- \btxlparent
- \texdefinition{btx:aps:publisher}
- \btxflush{year}
- \btxrparent
- \btxdoif {edition} {
- \btxcomma
- \btxflush{edition}
+ \btxdoif {number} {
+ \doifmode {btx:aps:comma}
+ {\btxcomma}
+ \btxlabeltext{aps:Number}
\btxspace
- \btxlabeltext{aps:edition}% ed
+ \btxflush{number}
+ \setmode{btx:aps:comma}
}
- }
- \btxperiod
- \texdefinition{btx:aps:note}
-\stopsetups
-
-\startsetups btx:aps:inbook
- \btxdoifelse {authors} {
- \btxflushauthor {author}
- } {
- \btxdoifelse {editor} {
- \btxflush{editor}
- \btxcomma
- \btxsingularorplural {
- \btxlabeltext{aps:editor}
+ \btxdoif {pages} {
+ \doifmode {btx:aps:comma}
+ {\btxcomma}
+ \btxoneorrange {pages} {
+ \btxlabeltext{aps:p}
} {
- \btxlabeltext{aps:editors}
- }
- \setmode{btx:aps:edited-book}
- } {
- \btxdoif {key} {
- \btxsetup{btx:format:key}
- \btxperiod
+ \btxlabeltext{aps:pp}
}
+ \btxspace
+ \btxflush{pages}
+ }
+ \btxrightparenthesisperiod
+ } {
+ \doif {\currentbtxcategory} {techreport} {
+ \btxleftparenthesis
+ \btxlabeltext{aps:technicalreport}
+ \btxrightparenthesisperiod
}
}
- \btxdoif {title} {
+\stoptexdefinition
+
+\starttexdefinition btx:aps:journal-volumeset-year
+ \btxdoif {journal} {
\btxcomma
- \texdefinition{btx:aps:italic}{title}
- \btxdoif {year} {
- \btxlparent
- \texdefinition{btx:aps:publisher}
- \btxflush{year}
- \btxrparent
- \btxdoif {edition} {
- \btxcomma
- \btxflush{edition}
- \btxspace
- \btxlabeltext{aps:edition}
- \btxperiod
+ % expandedjournal abbreviatedjournal
+ \btxflush{expandedjournal -> journal}
+ % A newspaper may not have a volume but may have a number!
+ \btxdoifelse {volume} {
+ \doif {\btxfoundname{volume}} {volume} {
+ \texdefinition{btx:aps:bold}{volume}
}
- }
- \doifmodeelse {btx:aps:edited-book} {
- \resetmode{btx:aps:edited-book}
- \btxdoifelse {volume} {
- \btxspace
- \btxlabeltext{aps:volume}% vol. (todo: add period to abbreviation)
- \btxnbsp
- \btxflush{volume}
- \btxdoifelse {series} {
- \btxspace
- \btxlabeltext{aps:in}
- \btxnbsp
- \btxflush{series}
- } {
- \btxdoifelse {crossref} {
- \btxspace
- \btxlabeltext{aps:in}
- \btxnbsp
- \btxflush{crossref}
- }
- }
- \btxperiod
- } {
- {\insertseries{ }{.}{} }%
+ \btxdoif {number} {
+ \removeunwantedspaces(
+ \btxflush{number}
+ \btxrightparenthesiscomma
}
} {
- \btxdoifelse {crossref} {
- \btxdoif {chapter} {
- \btxcomma
- \btxflush{chapter}
- }
- \texdefinition{btx:aps:pages}
- \btxperiod
- \btxdoif {volume} {
- \btxlabeltext{aps:Volume}
- \btxnbsp
- \btxflush{volume}
- \btxspace
- \btxlabeltext{aps:of}
- \btxnbsp
- }
- % weird:
- \btxflush{crossref}
- } {
- \btxdoif {volume} {
- \btxcomma
- \btxlabeltext{aps:volume}% vol.
- \btxnbsp
- \btxflush{volume}
- \btxdoif {series} {
- \btxnbsp
- \btxlabeltext{aps:of}
- \btxnbsp
- \texdefinition{btx:aps:italic}{
- \btxflush{series}
- }
- }
- }
- \btxdoif {chapter} {
- \btxcomma
- \btxflush{chapter}
- }
- \btxdoif {pages} {
- \btxcomma
- \btxflush{pages}
- \texdefinition{btx:aps:pages-p-or-pp}
- }
- \btxperiod
+ \btxdoif {number} {
+ \btxflush{number}
+ \btxcomma
}
}
+ \btxflush{pages}
+ \btxleftparenthesis
+ \btxdoifelse {year} {
+ \btxflush{year}
+ } {
+ \btxlabeltext{aps:Advanced}
+ }
+ \btxrightparenthesis
+ \btxperiod
}
- \texdefinition{btx:aps:note}
-\stopsetups
+\stoptexdefinition
-\startsetups btx:aps:booklet
- \btxdoif {author} {
- \btxflushauthor {author}
- \btxspace
- } {
- \btxdoif {key} {
- \btxsetup{btx:format:key}
- \btxperiod
+\definebreakpoints[doi]
+\definebreakpoint [doi][:][nleft=3,type=1]
+\definebreakpoint [doi][/][nleft=3,type=1]
+\definebreakpoint [doi][-][nleft=3,type=1]
+\definebreakpoint [doi][.][nleft=3,type=1]
+
+\starttexdefinition btx:aps:url
+ % use \btxentry here?
+ \btxspace
+ \btxlabeltext{aps:Retrieved}
+ \btxspace
+ \begingroup
+ \setbreakpoints[doi]
+ \btxdoifelseinteractive {url} {
+ \goto {
+ \btxflush{url}
+ } [
+ url(\btxflush{url})
+ ]
+ } {
+ \btxflush{url}
}
- }
- \btxdoif {title} {
- \btxflush{title}
- \btxdoif {series} {
- \btxlparent
- \btxflush{series}
- \btxrparent
+ \endgroup
+\stoptexdefinition
+
+\starttexdefinition btx:aps:doi
+ % use \btxentry here?
+ \btxspace
+ \begingroup
+ \setbreakpoints[doi]
+ \btxdoifelseinteractive {doi} {
+ \goto {
+ doi:\btxflush{doi}
+ } [
+ url(http://dx.doi.org/\btxflush{doi})
+ ]
+ } {
+ doi:\btxflush{doi}
}
- \btxperiod
+ \endgroup
+\stoptexdefinition
+
+\starttexdefinition btx:aps:isbn
+ % also issn - see publ-imp-aps.lua
+ \btxdoif {isbn} {
+ \btxleftparenthesis
+ \WORD{\btxfoundname{isbn}}:\btxspace
+ \btxflush{isbn}
+ \btxrightparenthesis
}
- \btxdoif {year} {
- \btxlparent
- \texdefinition{btx:aps:publisher}
- \btxflush{year}
- \btxrparent
- \btxdoif {edition} {
- \btxcomma
- % todo: st nd rd th
- \btxflush{edition}
- \btxspace
- \btxlabeltext{aps:edition}
- }
- \btxperiod
+\stoptexdefinition
+
+\starttexdefinition btx:aps:note
+ % grouping could indeed be useful for note.
+ \btxdoif {note} {
+ \btxleftparenthesis
+ {\btxflush{note}}
+ \btxrightparenthesis
}
- \btxdoif {pages} {
- \btxflush{pages}
- \texdefinition{btx:aps:pages-p-or-pp}
- \btxperiod
+\stoptexdefinition
+
+\starttexdefinition btx:aps:url-note-doi
+ \doif {\btxfoundname{doi}} {url} {
+ \texdefinition{btx:aps:url}
}
+ \texdefinition{btx:aps:isbn}
\texdefinition{btx:aps:note}
-\stopsetups
-
-\startsetups btx:aps:manual
- \btxdoif {title} {
- \texdefinition {btx:aps:italic} {
- \btxflush{title}
- }
- \btxdoif {series} {
- \btxlparent
- \btxflush{series}
- \btxrparent
- }
- \btxperiod
+ \doif {\btxfoundname{doi}} {doi} {
+ \texdefinition{btx:aps:doi}
}
- \btxdoifelse {year} {
- \btxlparent
- \btxdoif {organization} {
- \btxflush{organization}
+ \removeunwantedspaces
+\stoptexdefinition
+
+\starttexdefinition btx:aps:publisher-wherefrom-year
+ \btxleftparenthesis
+ \btxflush{publisher}
+ \btxdoifelse {address} {
+ \btxdoif {publisher} {
\btxcomma
}
- \btxdoif {city} {
- \btxflush{organization}
+ \btxflush{address}
+ \btxdoif {country} {
\btxcomma
+ \btxflush{country}
}
- \btxflush{year}
- \btxrparent
- % st\or nd\or rd\else th\fi
- \btxdoif {edition} {
+ \btxcomma
+ } {
+ \btxdoif {publisher} {
\btxcomma
- \btxflush{edition}
- \btxspace
- \btxlabeltext{aps:edition}% ed
}
- \btxperiod
}
- \btxdoif {pages} {
- \btxflush{pages}
- \texdefinition{btx:aps:pages-p-or-pp}
- \btxperiod
+ \btxdoifelse {year} {
+ \btxflush{year}
+ } {
+ \btxlabeltext{aps:Advanced}
}
- \texdefinition{btx:aps:note}
+ \btxrightparenthesis
+\stoptexdefinition
+
+% Then by category
+
+% An article from a journal
+% Required fields: author or editor or title, journal, (year).
+% Optional fields: volume, number, pages, type, doi, url, note.
+% Note that bibtex (and tools) do not include editor (e.g. special issue or section)
+
+\startsetups btx:aps:article
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:optional-title}
+ \texdefinition{btx:aps:journal-volumeset-year}
+ \texdefinition{btx:aps:url-note-doi}
\stopsetups
-\startsetups btx:aps:incollection
- \btxdoifelse {author} {
- \btxflushauthor {author}
- } {
- \btxdoif {key} {
- \btxsetup{ntx:format:key}
- \btxcomma
- }
- }
- \btxdoifelse {title} {
- \btxcomma
- \btxlabeltext{aps:in}
+% An article from a magazine.
+% Required fields: author or title, journal, (year).
+% Optional fields: volume, number, pages, type, month, day, doi, url, note.
+
+\startsetups btx:aps:magazine
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:optional-title}
+ \texdefinition{btx:aps:journal-volumeset-year}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% An article from a newspaper.
+% Required fields: author or title, journal, (year).
+% Optional fields: volume, number, pages, type, month, day, doi, url, note.
+
+\startsetups btx:aps:newspaper
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:optional-title}
+ \texdefinition{btx:aps:journal-volumeset-year}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% A book with an explicit publisher.
+% Required fields: author or editor or publisher, title, (year).
+% Optional fields: volume or number, series, address, edition, month, day, note.
+
+% todo: series?
+
+\startsetups btx:aps:book
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:editionset}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% A part of a book, which may be a chapter (or section or whatever) and/or a range of pages.
+% Required fields: author or editor, title, chapter and/or pages, publisher, year.
+% Optional fields: volume or number, series, type, address, edition, month, note.
+
+% todo: series?
+
+\startsetups btx:aps:inbook
+ \texdefinition{btx:aps:author}
+ \btxdoif {chapter} {
+ \btxflush{Word -> chapter}
\btxspace
- \texdefinition{btx:aps:italic} {title}
- \btxdoifelse {editor} {
- \btxcomma
- \btxlabeltext{aps:edited} % edited by
+ }
+ \texdefinition{btx:aps:editor-in-}{title}
+ \texdefinition{btx:aps:editionset}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% A part of a book having its own title.
+% Required fields: author, title, booktitle, publisher, year.
+% Optional fields: editor, volume or number, series, type, chapter, pages, address, edition, month, note.
+
+% todo: series?
+
+\startsetups btx:aps:incollection
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:editor-in-}{booktitle}
+ \texdefinition{btx:aps:editionset}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% The proceedings of a conference.
+% Required fields: title, year.
+% Optional fields: editor, volume or number, series, address, month, organization, publisher, note.
+% todo: series?
+
+\startsetups btx:aps:proceedings
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:editionset}
+ \btxdoif {editor} {
+ \btxdoif {organization} {
\btxspace
- \btxflush{edited}
- } {
- \btxdoif {series} {
- \btxdoifelse {volume} {
- \btxcomma
- \btxlabeltext{aps:number}
- \btxspace
- \btxflush{volume}
- \btxnbsp
- \btxlabeltext{aps:in}
- } {
- \btxspace
- }
- \btxflush{series}
- }
- }
- \btxdoif {chapter} {
- \btxcomma
- \btxflush{chapter}
- }
- \btxspace
- \btxdoif {year} {
- \btxlparent
- \btxflush{year}
- \btxrparent
- \texdefinition{btx:aps:publisher}
- \btxdoif {edition} {
- \btxcomma
- \btxflush{edition}
- \btxlabeltext{aps:edition}% ed.
- }
- \texdefinition{btx:aps:pages}
- }
- \btxperiod
- } {
- \btxlabeltext{aps:In}
- \btxdoif {crossref} {
- \btxflush{crossref}
- }
- \btxdoif {chapter} {
+ \btxflush{organization}
\btxcomma
- \btxflush{chapter}
- \btxspace
}
- \texdefinition{btx:aps:pages}
- \btxperiod
}
- \texdefinition{btx:aps:note}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
\stopsetups
+% An article in a conference proceedings.
+% Required fields: author, title, booktitle, year.
+% Optional fields: editor, volume or number, series, pages, address, month, organization, publisher, note.
+% todo: series?
+
\startsetups btx:aps:inproceedings
- \btxdoif {author} {
- \btxflushauthor{author}
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:editor-in-}{booktitle}
+ \texdefinition{btx:aps:editionset}
+ \btxdoif {organization} {
\btxspace
+ \btxflush{organization}
+ \btxcomma
}
- \btxdoifelse {title} {
- \texdefinition {btx:aps:italic} {
- \btxflush{ title}
- }
- \btxdoif {editor} {
- \btxcomma
- \btxlabeltext{aps:edited}% edited by
- \btxspace
- \btxflush{editor}
- }
- \btxdoif {chapter} {
- \btxcomma
- \btxflush{chapter}
- }
- \btxdoif {year} {
- \btxlparent
- \btxflush{year}
- \btxdoifelse {organization} {
- \btxcomma
- \btxflush{organization}
- }
- \texdefinition{btx:aps:publisher}
- \btxdoif {city} {
- \btxcomma
- \btxflush{city}
- }
- \btxrparent
- }
- \btxdoif {series} {
- \btxcomma
- \btxdoif {volume} {
- \btxlabeltext{aps:volume}% vol.
- \btxspace
- \btxflush{volume}
- \btxspace
- \btxlabeltext{aps:of}
- }
- \texdefinition {btx:aps:italic} {
- \btxflush{series}
- }
- }
- \texdefinition{btx:aps:pages}
- \btxperiod
- } {
- \btxspace
- \btxlabeltext{aps:In}
- \btxdoif {crossref} {
- \btxflush{crossref}
- }
- \btxdoif {chapter} {
- \btxcomma
- \btxflush{chapter}
- }
- \texdefinition{btx:aps:pages}
- \btxperiod
- }
- \texdefinition{btx:aps:note}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
\stopsetups
-\startsetups btx:aps:proceedings
- \btxdoifelse {editor} {
- \btxflush{editor}
- \btxcomma
- \btxsingularorplural {editor} {
- \btxlabeltext{aps:editor}% ed
- } {
- \btxlabeltext{aps:editors}% eds
- }
- \setmode{btx:aps:edited-book}
+\startsetups btx:aps:conference
+ \fastsetup{btx:aps:inproceedings}
+\stopsetups
+
+% A thesis.
+% Required fields: author, title, school, year.
+% Optional fields: type, address, month, note.
+
+\startsetups btx:aps:thesis
+ \setmode{btx:aps:thesis}
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \btxleftparenthesis
+ \btxdoifelse {type} {
+ \btxflush{Word -> type}
} {
- \btxdoif {key} {
- \btxsetup{btx:format:key}
- \btxspace
- }
+ \Word{\btxlabeltext{aps:\currentbtxcategory}}
}
- \btxdoif {title} {
- \texdefinition {btx:aps:italic} {
- \btxflush{title}
- }
- \btxdoif {series} {
- \bxtif {volume} {
- \btxcomma
- \btxlabeltext{aps:number}
- \btxspace
- \btxflush{volume}
- \btxnbsp
- \btxlabeltext{aps:in}
- }
- \btxspace
- \btxflush{series}
- }
- \btxdoif {chapter} {
+ \btxrightparenthesis
+ \btxdoif {school} {
+ \btxperiod
+ \btxflush{school}
+ }
+ \btxdoif {address} {
+ \btxdoifelse {school} {
\btxcomma
- \btxflush{chapter}
- \btxspace
- }
- \btxdoif {year} {
- \btxlparent
- \btxdoif {organization} {
- \btxflush{organization}
- \btxcomma
- }
- \texdefinition{btx:aps:publisher}
- \btxflush{year}
- \btxrparent
+ } {
+ \btxperiod
}
- \texdefinition{btx:aps:pages}
- \btxdoif {city} {
+ \btxflush{address}
+ \btxdoif {country} {
\btxcomma
- \btxflush{city}
+ \btxflush{country}
}
}
- \texdefinition{btx:aps:note}
+ \btxperiod
+ \texdefinition{btx:aps:url-note-doi}
\stopsetups
-\starttexdefinition btx:aps:thesis #field
- \btxdoif {author} {
- \btxflushauthor {author}
- \btxcomma
- }
- \btxdoifelse {type} {
- \btxflush{type}
- \btxcomma
- } {
- \btxlabeltext{aps:#field}
- }
- \texdefinition{btx:aps:publisher}
- \btxdoifelse {year} {
- \btxlparent
- \btxflush{year}
- \btxrparent
- }
- \btxdoifelse {pages} {
- \btxcomma
- \btxflush{pages}
- }
- \texdefinition{btx:aps:note}
-\stoptexdefinition
+\startsetups btx:aps:phdthesis
+ \fastsetup{btx:aps:thesis}
+\stopsetups
\startsetups btx:aps:mastersthesis
- \texdefinition{btx:aps:thesis}{mastersthesis}
+ \fastsetup{btx:aps:thesis}
\stopsetups
-\startsetups btx:aps:phdthesis
- \texdefinition{btx:aps:thesis}{phdthesis}
+% A work that is printed and bound, but without a named publisher or sponsoring institution.
+% Required field: title.
+% Optional fields: author, howpublished, address, month, year, note.
+
+\startsetups btx:aps:booklet
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% Technical documentation.
+% Required field: title.
+% Optional fields: author, organization, address, edition, month, year, note.
+
+\startsetups btx:aps:manual
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:editionset}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
\stopsetups
+% A report published by a school or other institution, usually numbered within a series.
+% Required fields: author, title, institution, year.
+% Optional fields: type, number, address, month, note.
+
\startsetups btx:aps:techreport
- \btxdoif {author} {
- \btxflushauthor{author}
- \btxcomma
- }
- \btxdoif {title} {
- \texdefinition {btx:apa:italic} {
- \btxflush{title}
- \btxdoifelse {series} {
- \btxcomma
- \btxlparent
- \btxflush{series}
- \btxrparent
- } {
- \btxspace
- }
- }
- }
- \btxdoifelse {type} {
- \btxflush{type}
- } {
- \btxlabeltext{aps:techreport}
- }
- \btxdoif {volume} {
- \btxspace
- \btxflush{volume}
- }
- \btxcomma
- \texdefinition{btx:aps:publisher}
- \btxdoif {year} {
- \btxlparent
- \btxflush{year}
- \btxrparent
- }
- \btxdoif {pages} {
- \btxlcomma
- \btxflush{pages}
- }
- \texdefinition{btx:aps:note}
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:editionset}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-note-doi}
\stopsetups
-\startsetups btx:aps:misc
- \btxdoifelse {author} {
- \btxflushauthor{author}
- \btxdoif {title} {
- \btxcomma
- \texdefinition {btx:aps:italic} {
- \btxflush{title}
- }
+% A document having an author and title, but not formally published.
+% Required fields: author, title, note.
+% Optional fields: month, year.
+
+\startsetups btx:aps:unpublished
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% A patent. Note that this category was not defined with BIBTEX. Below from JabRef:
+% Required fields: nationality, number, year, yearfiled
+% Optional fields: author, title, assignee, address, type, number, day, dayfiled, month, monthfiled, note, url
+% Also optional: publisher
+
+% todo: yearfiled, monthfiled, dayfiled
+
+\startsetups btx:aps:patent
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \begingroup
+ \it
+ \btxdoif {nationality} {
+ \btxspace
+ \btxflush{nationality}
}
- } {
- \btxdoifelse {title} {
- \btxdoifelse {key} {
- \btxsetup{btx:format:key}
+ \btxspace
+ \btxlabeltext{aps:patent}
+ \btxdoif {number} {
+ \btxspace
+ \btxlabeltext{aps:Number}
+ \btxspace
+ \btxflush{number}
+ }
+ \btxperiod
+ \italiccorrection
+ \endgroup
+ \btxdoifelse {author} {
+ \btxdoifelse {country} {
+ \btxspace
+ \btxdoif {address} {
+ \btxflush{address}
\btxcomma
}
- \texdefinition {btx:aps:italic} {
- \btxflush{title}
- }
+ \btxflush{country}
+ \btxdoifelse {assignee}
+ {\btxcolon} {\btxperiod}
} {
- \btxdoifelse {key} {
- \btxsetup{btx:format:key}
+ \btxdoifelse {address} {
+ \btxspace
+ \btxflush{address}
+ \btxdoifelse {assignee}
+ {\btxcolon} {\btxperiod}
+ } {
+ \btxdoifelse {assignee}
+ {\btxspace} {}
}
}
- }
- \btxdoif {series} {
- \btxlparent
- \btxflush{series}
- \btxrparent
- }
- \btxdoifelse {year} {
- \btxlparent
- \texdefinition{btx:aps:publisher}
- \btxflush{year}
- \btxrparent
- } {
- \btxdoif {published} {
- \btxcomma
- \btxflush{published}
+ \btxdoif {assignee} {
+ \btxflush{assignee}
+ \btxperiod
}
+ } {
+ \texdefinition{btx:aps:publisher-wherefrom-year}
}
- \btxdoif {pages} {
- \btxcomma
- \btxflush{pages}
- }
- \btxdoif {print} {
- % eprint
- \btxcomma
- \btxflush{print}
- }
- \texdefinition{btx:aps:note}
+ \texdefinition{btx:aps:url}
+ \texdefinition{btx:aps:note}
\stopsetups
-\startsetups btx:aps:unpublished
- \btxdoif {author} {
- \btxflushauthor{author}
- }
- \btxdoif {title} {
- \texdefinition {btx:aps:italic} {
- \btxspace
- \btxflush{title}
- \btxdoif {series} {
- \btxlparent
- \btxflush{series}
- \btxrparent
- }
- }
- }
- \btxdoif {type} {
- \btxlparent
- \btxflush{type}
- \btxrparent
+% Electronic. Note that this category was not defined with BIBTEX. Below from JabRef:
+% Required fields: title
+% Optional fields: address, author, howpublished, month, note, organization, url, year, doi
+% Also optional: type
+
+% Like Misc below but includes organization.
+
+\startsetups btx:aps:electronic
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \btxdoif {organization} {
+ \btxspace
+ \btxflush{organization}
+ \btxperiod
}
- \btxlparent
- \btxlabeltext{aps:unpublished}% new label
- \btxdoifelse {year} {
- \btxcomma
- \btxflush{year}
+ \btxdoif {howpublished} {
+ \btxspace
+ \btxflush{howpublished}
+ \btxperiod
}
- \btxrparent
- \btxdoif {pages} {
- \btxcomma
- \btxflush{pages}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% Other. Note that this category was not defined with BIBTEX. Below from JabRef:
+% Required fields: author or title, year
+% Optional fields: note, doi, url
+
+\startsetups btx:aps:other
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% Use this type when nothing else fits.
+% Required fields: none.
+% Optional fields: author, title, howpublished, month, year, note.
+
+\startsetups btx:aps:misc
+ \texdefinition{btx:aps:author}
+ \texdefinition{btx:aps:title}
+ \btxdoif {howpublished} {
\btxspace
+ \btxflush{howpublished}
+ \btxperiod
}
- \texdefinition{btx:aps:note}
+ \texdefinition{btx:aps:url-note-doi}
+\stopsetups
+
+% If all else fails to match:
+
+\startsetups btx:aps:literal
+ %\btxleftparenthesis
+ \removeunwantedspaces(
+ \btxflush{key}
+ \btxrightparenthesis
+ \btxdoif {text} {
+ \btxflush{text}
+ }
+\stopsetups
+
+%D Experiment:
+
+\startsetups btx:aps:lefttext
+ \currentbtxlefttext
+\stopsetups
+
+\startsetups btx:aps:righttext
+ \currentbtxrighttext
\stopsetups
\stopbtxrenderingdefinitions
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index e09ba3a38..1fa2c44e1 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -1545,7 +1545,7 @@ do
end
end
if type(sorter) == "function" then
- rendering.list = sorter(dataset,rendering,newlist,sorttype)
+ rendering.list = sorter(dataset,rendering,newlist,sorttype) or newlist
else
rendering.list = newlist
end
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index 801a274d3..6e03bb96a 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -110,10 +110,12 @@
\unexpanded\def\startbtxrenderingdefinitions[#1]%
{\pushmacro\currentbtxrenderingdefinition
\edef\currentbtxrenderingdefinition{#1}%
- \letvalue{\??btxrenderingdefinition\currentbtxrenderingdefinition}\currentbtxrenderingdefinition}
+ \letvalue{\??btxrenderingdefinition\currentbtxrenderingdefinition}\currentbtxrenderingdefinition
+ \unprotect}
\unexpanded\def\stopbtxrenderingdefinitions
- {\popmacro\currentbtxrenderingdefinition}
+ {\protect
+ \popmacro\currentbtxrenderingdefinition}
\unexpanded\def\loadbtxdefinitionfile[#1]%
{\ctxcommand{loadbtxdefinitionfile("#1")}}
@@ -1465,7 +1467,7 @@
\c!continue=\v!no,
\c!method=\v!global,
% \c!setups=btx:\btxrenderingparameter\c!alternative:initialize, % not the same usage as cite !
- \c!sorttype=,
+% \c!sorttype=authoryear,
\c!criterium=\v!text,
\c!refcommand=authoryears, % todo
\c!numbering=\v!yes,
diff --git a/tex/context/base/publ-sor.lua b/tex/context/base/publ-sor.lua
index acef99aa0..c17273cc3 100644
--- a/tex/context/base/publ-sor.lua
+++ b/tex/context/base/publ-sor.lua
@@ -106,6 +106,11 @@ local sharedmethods = { }
publications.sortmethods = sharedmethods
local function sortsequence(dataset,list,sorttype)
+
+ if not list or #list == 0 then
+ return
+ end
+
local specification = publications.currentspecification
local types = specification.types
local sortmethods = specification.sortmethods
@@ -188,13 +193,19 @@ local function sortsequence(dataset,list,sorttype)
local action, error = loadstring(code)
if type(action) == "function" then
action = action()
+ else
+ report("error when compiling sort method %a: %s",sorttype,error or "unknown")
end
if type(action) == "function" then
local valid = action(dataset,list,method)
if valid and #valid > 0 then
sorters.sort(valid,compare)
return valid
+ else
+ report("error when applying sort method %a",sorttype)
end
+ else
+ report("error in sort method %a",sorttype)
end
else
report("invalid sort method %a",sorttype)
@@ -248,7 +259,7 @@ local sorters = {
sort(list,compare)
else
local valid = sortsequence(dataset,list,sorttype)
- if #valid > 0 then
+ if valid and #valid > 0 then
for i=1,#valid do
local v = valid[i]
valid[i] = list[v.index]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 137acb6f7..af48c623a 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index badc82b03..8d131e34a 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi
index 94f730beb..14bfafa9f 100644
--- a/tex/context/base/strc-flt.mkvi
+++ b/tex/context/base/strc-flt.mkvi
@@ -108,8 +108,9 @@
% \c!stopper=\@@kostopper,
\c!suffixseparator=, % currently rather hard coded
\c!suffix=\floatcaptionsuffix,
- \c!distance=1em,
+ \c!distance=\emwidth,
\c!conversion=\v!numbers,
+ \c!maxwidth=\hsize,
\c!command=]
% we can comment some of these
@@ -1395,17 +1396,82 @@
\fi
\strc_floats_make_complete_caption}}
+% \def\strc_floats_prepare_stack_caption_auto
+% {\ifx\p_strc_floats_caption_align\empty \else
+% \doifnotinset\v!middle\p_strc_floats_caption_align{\let\captionovershoot\!!zeropoint}%
+% \fi
+% \edef\captionhsize{\the\wd\b_strc_floats_content}%
+% \ifdim\captionhsize>\hsize
+% % float is wider than \hsize
+% \setbox\b_strc_floats_caption\vbox
+% {\settrialtypesetting
+% \strc_floats_caption_set_align
+% \hsize\captionhsize
+% \notesenabledfalse
+% \strc_floats_make_complete_caption}%
+% \ifdim\ht\scratchbox>\lineheight % more lines
+% \setbox\b_strc_floats_caption\vbox
+% {\strc_floats_caption_set_align
+% \hsize\dimexpr\captionhsize-\captionovershoot\relax
+% \ifdim\hsize<\captionminwidth\relax
+% \hsize\captionhsize
+% \fi
+% \strc_floats_make_complete_caption}%
+% \else
+% \setbox\b_strc_floats_caption\vbox
+% {\strc_floats_caption_set_align
+% \hsize\captionhsize
+% \strc_floats_make_complete_caption}%
+% \fi
+% \else
+% % float is smaller of equal to \hsize
+% \ifdim\captionhsize<\captionminwidth\relax
+% \scratchdimen\captionminwidth % float smaller than min width
+% \edef\captionhsize{\the\scratchdimen}%
+% \fi
+% \setbox\scratchbox\vbox % test with overshoot
+% {\settrialtypesetting
+% \scratchdimen\dimexpr\captionhsize+\captionovershoot+3\emwidth\relax % 3em is an average word length
+% \ifdim\scratchdimen<\hsize
+% \hsize\scratchdimen
+% \fi
+% \notesenabledfalse
+% \strc_floats_make_complete_caption}%
+% \ifdim\ht\scratchbox>\lineheight
+% % at least an average word longer than a line
+% \setbox\b_strc_floats_caption\vbox
+% {\strc_floats_caption_set_align
+% \scratchdimen\dimexpr\captionhsize+\captionovershoot\relax
+% \ifdim\scratchdimen<\hsize
+% \hsize\scratchdimen
+% \fi
+% \strc_floats_make_complete_caption}%
+% \else\ifx\p_strc_floats_caption_align\empty
+% \setbox\b_strc_floats_caption\vbox
+% {\strc_floats_caption_set_align
+% \hsize\captionhsize
+% \raggedcenter % overloads
+% \strc_floats_make_complete_caption}%
+% \else
+% \setbox\b_strc_floats_caption\vbox
+% {\strc_floats_caption_set_align
+% \hsize\captionhsize
+% \strc_floats_make_complete_caption}%
+% \fi\fi
+% \fi}
+
\def\strc_floats_prepare_stack_caption_auto
{\ifx\p_strc_floats_caption_align\empty \else
\doifnotinset\v!middle\p_strc_floats_caption_align{\let\captionovershoot\!!zeropoint}%
\fi
\edef\captionhsize{\the\wd\b_strc_floats_content}%
- \ifdim\captionhsize>\hsize
+ \scratchwidth\floatcaptionparameter\c!maxwidth\relax
+ \ifdim\captionhsize>\scratchwidth
% float is wider than \hsize
\setbox\b_strc_floats_caption\vbox
{\settrialtypesetting
\strc_floats_caption_set_align
- \hsize\captionhsize
+ \hsize\scratchwidth
\notesenabledfalse
\strc_floats_make_complete_caption}%
\ifdim\ht\scratchbox>\lineheight % more lines
@@ -1413,13 +1479,13 @@
{\strc_floats_caption_set_align
\hsize\dimexpr\captionhsize-\captionovershoot\relax
\ifdim\hsize<\captionminwidth\relax
- \hsize\captionhsize
+ \hsize\scratchwidth
\fi
\strc_floats_make_complete_caption}%
\else
\setbox\b_strc_floats_caption\vbox
{\strc_floats_caption_set_align
- \hsize\captionhsize
+ \hsize\scratchwidth
\strc_floats_make_complete_caption}%
\fi
\else
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 84d1b10b6..81b6406f9 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -5336,6 +5336,9 @@
\def\distributedhsize#1#2#3%
{\dimexpr(#1-\numexpr#3-1\relax\dimexpr#2\relax)/#3\relax}
+\def\hsizefraction#1#2%
+ {\dimexpr#1/#2\relax}
+
%D \macros
%D {doifvalue,doifnotvalue,doifelsevalue,
%D doifnothing,doifsomething,doifelsenothing,
@@ -6142,16 +6145,12 @@
%D \macros
%D {processcontent}
%D
-%D This is the first occasion where \TEX\ and \ETEX\ are no
-%D longer compatible, although in many cases things go ok.
-%D Beware of verbatim, i.e. catcode changes.
+%D This macro is first used in the tabulation macros.
%D
%D \starttyping
%D \unexpanded\def\starthans%
%D {\processcontent{stophans}\test{\message{\test}\wait}}
%D \stoptyping
-%D
-%D This macro is first used in the tabulation macros.
\unexpanded\def\processcontent#1%
{\begingroup\expandafter\syst_helpers_process_content\csname#1\endcsname}
diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv
index 77b0be2fa..34f893df7 100644
--- a/tex/context/base/tabl-ntb.mkiv
+++ b/tex/context/base/tabl-ntb.mkiv
@@ -19,6 +19,8 @@
%D real purpose in it. If needed I can squeeze out a few more percentages
%D runtime.
+% columndistance 'optimized' ... needs checking
+
\writestatus{loading}{ConTeXt Table Macros / Natural Tables}
% sometimes this helps (with nc going wild): \setupTABLE[maxwidth=100cm]
@@ -167,6 +169,11 @@
\newdimen\d_tabl_ntb_height
\newdimen\d_tabl_ntb_width
+\newdimen\d_tabl_ntb_leftmargindistance
+\newdimen\d_tabl_ntb_rightmargindistance
+\newdimen\d_tabl_ntb_columndistance
+\newdimen\d_tabl_ntb_maxwidth
+
\newtoks\everyTABLEpass % public
\newcount\tablecellrows % public (needs checking)
@@ -344,7 +351,7 @@
\newif\ifenableTBLbreak \enableTBLbreakfalse
\newif\ifmultipleTBLheads \multipleTBLheadsfalse
\newif\iftightTBLrowspan \tightTBLrowspantrue
-\newif\iftightTBLcolspan \tightTBLcolspantrue
+%newif\iftightTBLcolspan \tightTBLcolspantrue
\newif\iftraceTABLE \traceTABLEfalse
@@ -890,6 +897,12 @@
\ifhmode\kern\zeropoint\fi % blocks \removeunwantedspaces: check this on icare handelingsschema
\resetcharacteralign % new
\setupcurrentnaturaltablelocal[\c!align={\v!right,\v!broad,\v!high},#1]%
+ %
+ \d_tabl_ntb_leftmargindistance \naturaltablelocalparameter\c!leftmargindistance\relax
+ \d_tabl_ntb_rightmargindistance\naturaltablelocalparameter\c!rightmargindistance\relax
+ \d_tabl_ntb_columndistance \naturaltablelocalparameter\c!columndistance\relax
+ \d_tabl_ntb_maxwidth \naturaltablelocalparameter\c!maxwidth\relax
+ %
\usesetupsparameter\naturaltablelocalparameter
\doifelse{\naturaltablelocalparameter\c!textwidth}\v!local
{\hsize\availablehsize}
@@ -1115,7 +1128,7 @@
\def\tabl_ntb_column_next
{\global\advance\c_tabl_ntb_col\plusone
- \kern\naturaltablelocalparameter\c!columndistance
+ \kern\d_tabl_ntb_columndistance
\aligntab}
\def\tabl_ntb_column_span
@@ -1138,7 +1151,10 @@
\nobreak
\fi\fi}%
\tabl_ntb_column_next
- \kern\dimexpr\naturaltablelocalparameter\c!leftmargindistance-\naturaltablelocalparameter\c!columndistance\relax}
+ \kern\dimexpr
+ \d_tabl_ntb_leftmargindistance
+ -\d_tabl_ntb_columndistance
+ \relax}
\unexpanded\def\tabl_ntb_row_align_reset
{\global\advance\c_tabl_ntb_row\plusone
@@ -1146,7 +1162,10 @@
\global\c_tabl_ntb_spn\zerocount}
\unexpanded\def\tabl_ntb_row_align_stop
- {\kern\dimexpr\naturaltablelocalparameter\c!rightmargindistance-\naturaltablelocalparameter\c!columndistance\relax
+ {\kern\dimexpr
+ \d_tabl_ntb_rightmargindistance
+ -\d_tabl_ntb_columndistance
+ \relax
\crcr
\noalign
{\nointerlineskip
@@ -1243,16 +1262,22 @@
{\d_tabl_ntb_width\zeropoint
\scratchcounter\c_tabl_ntb_col
\!!counta\tabl_ntb_get_col{#1}{#2}\relax
- \dorecurse\!!counta
- {\advance\d_tabl_ntb_width\dimexpr
- \tabl_ntb_get_wid\scratchcounter
- +\naturaltablelocalparameter\c!columndistance
- \ifnum\recurselevel<\!!counta
- +\tabl_ntb_get_dis\scratchcounter
- \fi
- \relax
- \advance\scratchcounter\plusone}%
- \advance\d_tabl_ntb_width-\naturaltablelocalparameter\c!columndistance\relax
+ \ifcase\!!counta\or
+ \advance\d_tabl_ntb_width\dimexpr
+ \tabl_ntb_get_wid\scratchcounter
+ \relax
+ \advance\scratchcounter\plusone
+ \else
+ \dorecurse\!!counta
+ {\advance\d_tabl_ntb_width\dimexpr
+ \tabl_ntb_get_wid\scratchcounter
+ \ifnum\recurselevel<\!!counta
+ +\d_tabl_ntb_columndistance
+ +\tabl_ntb_get_dis\scratchcounter
+ \fi
+ \relax
+ \advance\scratchcounter\plusone}%
+ \fi
\setbox\scratchbox\hbox{\tabl_ntb_get_txt{#1}{#2}}%
\tabl_ntb_set_ht{#1}{#2}{\the\ht\scratchbox}%
\tabl_ntb_set_wd{#1}{#2}{\the\wd\scratchbox}%
@@ -1283,16 +1308,22 @@
% width
\d_tabl_ntb_width\zeropoint
\scratchcounter\c_tabl_ntb_col
- \dorecurse\!!counta
- {\advance\d_tabl_ntb_width\dimexpr
- \tabl_ntb_get_wid\scratchcounter
- +\naturaltablelocalparameter\c!columndistance
- \ifnum\recurselevel<\!!counta
- +\tabl_ntb_get_dis\scratchcounter
- \fi
- \relax
- \advance\scratchcounter\plusone}%
- \advance\d_tabl_ntb_width-\naturaltablelocalparameter\c!columndistance\relax
+ \ifcase\!!counta\or
+ \advance\d_tabl_ntb_width\dimexpr
+ \tabl_ntb_get_wid\scratchcounter
+ \relax
+ \advance\scratchcounter\plusone
+ \else
+ \dorecurse\!!counta
+ {\advance\d_tabl_ntb_width\dimexpr
+ \tabl_ntb_get_wid\scratchcounter
+ \ifnum\recurselevel<\!!counta
+ +\d_tabl_ntb_columndistance
+ +\tabl_ntb_get_dis\scratchcounter
+ \fi
+ \relax
+ \advance\scratchcounter\plusone}%
+ \fi
% cell
\setbox\scratchbox\hbox attr \taggedattribute \attribute\taggedattribute \bgroup
\dotagTABLEsignal % maybe we need to add some packaging in this case
@@ -1341,7 +1372,9 @@
\def\tabl_ntb_table_stop
{\setbox\scratchbox\hbox
- {\setupcurrentnaturaltablelocal[\c!frame=\v!off,\c!background=,\c!align=\v!no]%
+ {\letnaturaltablelocalparameter\c!frame\v!off
+ \letnaturaltablelocalparameter\c!background\empty
+ \letnaturaltablelocalparameter\c!align\v!no
\inheritednaturaltablelocalframed{\strut}}%
\edef\minimalcellheight{\the\ht\scratchbox}% not used
\dorecurse\c_tabl_ntb_maximum_col
@@ -1417,18 +1450,27 @@
\def\tabl_ntb_stretch_widths % more variants, e.g. a max to \dimend
{\ifcase\c_tabl_ntb_maximum_col\else % else division by zero
\!!dimend\zeropoint
- \!!dimene\hsize
+ \!!dimene\dimexpr
+ \hsize
+ -\d_tabl_ntb_leftmargindistance
+ -\d_tabl_ntb_rightmargindistance
+ +\d_tabl_ntb_columndistance
+ \relax
\dorecurse\c_tabl_ntb_maximum_col
- {\advance\!!dimend\dimexpr\tabl_ntb_get_wid\recurselevel+\naturaltablelocalparameter\c!columndistance\relax
- \advance\!!dimene-\tabl_ntb_get_dis\recurselevel}%
- \advance\!!dimend\dimexpr-\naturaltablelocalparameter\c!columndistance+\naturaltablelocalparameter\c!leftmargindistance+\naturaltablelocalparameter\c!rightmargindistance\relax
+ {\advance\!!dimend\dimexpr
+ \tabl_ntb_get_wid\recurselevel
+ \relax
+ \advance\!!dimene\dimexpr
+ -\tabl_ntb_get_dis\recurselevel
+ -\d_tabl_ntb_columndistance
+ \relax}%
+ \relax
% distribute width (stretch)
\ifdim\!!dimend<\!!dimene
\advance\!!dimend-\!!dimene
- \!!dimend-\!!dimend
\divide\!!dimend\c_tabl_ntb_maximum_col
\dorecurse\c_tabl_ntb_maximum_col
- {\tabl_ntb_set_wid\recurselevel{\the\dimexpr\tabl_ntb_get_wid\recurselevel+\!!dimend\relax}}%
+ {\tabl_ntb_set_wid\recurselevel{\the\dimexpr\tabl_ntb_get_wid\recurselevel-\!!dimend\relax}}%
\fi
\fi}
@@ -1497,15 +1539,23 @@
\def\tabl_ntb_check_widths_indeed#1%
{\iftraceTABLE\tabl_ntb_show_widths{B#1}\fi
\!!counta\zerocount
- \!!dimena\dimexpr\hsize-\naturaltablelocalparameter\c!leftmargindistance-\naturaltablelocalparameter\c!rightmargindistance-\naturaltablelocalparameter\c!columndistance\relax
+ \!!dimena\dimexpr
+ \hsize
+ -\d_tabl_ntb_leftmargindistance
+ -\d_tabl_ntb_rightmargindistance
+ -\d_tabl_ntb_columndistance
+ \relax
\dorecurse\c_tabl_ntb_maximum_col
{\scratchdimen\tabl_ntb_get_aut\recurselevel\relax
- \advance\!!dimena-\tabl_ntb_get_dis\recurselevel\relax
+ \advance\!!dimena\dimexpr
+ -\tabl_ntb_get_dis\recurselevel
+ -\d_tabl_ntb_columndistance
+ \relax
\ifdim\scratchdimen>\zeropoint\relax
\advance\!!dimena -\scratchdimen
\else
\scratchdimen\tabl_ntb_get_wid\recurselevel\relax
- \ifdim\scratchdimen>\naturaltablelocalparameter\c!maxwidth\relax
+ \ifdim\scratchdimen>\d_tabl_ntb_maxwidth\relax
\ifcase#1\else\tabl_ntb_let_wid\recurselevel\zeropoint\fi
\advance\!!counta \plusone
\else
@@ -1657,15 +1707,86 @@
% cells but still to small .. chicken egg problem ... for that we should
% also have a smallest width run
+% \unexpanded\def\tabl_ntb_cell_process_a#1#2[#3]#4% grouping added ! ! !
+% {\bgroup
+% \tabl_ntb_setup_cell{#1}{#2}%
+% \setbox\scratchbox\hbox
+% {\scratchdimen\naturaltablelocalparameter\c!distance\relax
+% \ifdim\scratchdimen>\tabl_ntb_get_dis{#2}\relax
+% \tabl_ntb_set_dis{#2}{\the\scratchdimen}%
+% \fi
+% \setupcurrentnaturaltablelocal[#3,\c!background=,\c!frame=\v!off]% 25% faster
+% \inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop\tabl_ntb_cell_finalize}}%
+% \scratchdimen\tabl_ntb_get_wid\c_tabl_ntb_col\relax
+% \ifdim\wd\scratchbox>\scratchdimen
+% \ifsqueezeTBLspan
+% \ifautosqueezeTBLspan
+% \edef\p_width{\naturaltablelocalparameter\c!width}%
+% \csname\??naturaltablesqueeze\ifcsname\??naturaltablesqueeze\p_width\endcsname\p_width\fi\endcsname
+% \else
+% \donetrue
+% \fi
+% \ifdone % brr, 0
+% \ifnum\tabl_ntb_get_col{#1}{#2}>\plusone \tabl_ntb_set_spn\c_tabl_ntb_col\fi
+% \fi
+% \fi
+% \tabl_ntb_spn_doifelse\c_tabl_ntb_col
+% {\iftightTBLcolspan\donefalse\else\donetrue\fi}%
+% \donetrue
+% \ifdone
+% \ifdim\tabl_ntb_get_wid\c_tabl_ntb_col<\wd\scratchbox
+% \tabl_ntb_set_wid\c_tabl_ntb_col{\the\wd\scratchbox}%
+% \fi
+% \fi
+% \fi
+% \scratchcounter\numexpr\c_tabl_ntb_row+\plusone\relax
+% \scratchdimen\tabl_ntb_get_hei\scratchcounter\relax
+% \ifdim\ht\scratchbox<\scratchdimen
+% \tabl_ntb_set_hei\scratchcounter{\the\ht\scratchbox}% auto set
+% \fi
+% \tabl_ntb_set_ht{#1}{#2}{\the\ht\scratchbox}%
+% \tabl_ntb_set_wd{#1}{#2}{\the\wd\scratchbox}%
+% \ifautoTBLcheckwidth
+% \ifdim\wd\scratchbox<.75\hsize % fuzzy guess
+% \ifdim\ht\scratchbox>2\openlineheight % honor width since this
+% \scratchdimen\tabl_ntb_get_aut\c_tabl_ntb_col\relax % can be a figure or so
+% \ifdim\scratchdimen=\zeropoint
+% % side effect: when width is set to 0pt,
+% % we can force a span that fits the sum of spans widths
+% \tabl_ntb_set_aut\c_tabl_ntb_col{\the\scratchdimen}%
+% \else\ifdim\wd\scratchbox>\scratchdimen
+% % unless span
+% \tabl_ntb_set_aut\c_tabl_ntb_col{\the\wd\scratchbox}%
+% % to be translated
+% \writestatus\m!TABLE{no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}%
+% \fi\fi
+% \fi
+% \fi
+% \fi
+% \setbox2\emptyhbox
+% \wd2\wd\scratchbox
+% \ht2\ht\scratchbox
+% \dp2\dp\scratchbox
+% \box2
+% \egroup}
+
\unexpanded\def\tabl_ntb_cell_process_a#1#2[#3]#4% grouping added ! ! !
{\bgroup
\tabl_ntb_setup_cell{#1}{#2}%
+\letnaturaltablelocalparameter\c!option\empty
+\setupcurrentnaturaltablelocal[#3]%
+\letnaturaltablelocalparameter\c!background\empty
+\letnaturaltablelocalparameter\c!frame\v!off
\setbox\scratchbox\hbox
{\scratchdimen\naturaltablelocalparameter\c!distance\relax
\ifdim\scratchdimen>\tabl_ntb_get_dis{#2}\relax
\tabl_ntb_set_dis{#2}{\the\scratchdimen}%
\fi
- \setupcurrentnaturaltablelocal[#3,\c!background=,\c!frame=\v!off]% 25% faster
+ % nilling the background is some 25% faster
+ % % \setupcurrentnaturaltablelocal[#3,\c!background=,\c!frame=\v!off]%
+ % \setupcurrentnaturaltablelocal[#3]% 25% faster
+ % \letnaturaltablelocalparameter\c!background\empty
+ % \letnaturaltablelocalparameter\c!frame\v!off
\inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop\tabl_ntb_cell_finalize}}%
\scratchdimen\tabl_ntb_get_wid\c_tabl_ntb_col\relax
\ifdim\wd\scratchbox>\scratchdimen
@@ -1681,7 +1802,8 @@
\fi
\fi
\tabl_ntb_spn_doifelse\c_tabl_ntb_col
- {\iftightTBLcolspan\donefalse\else\donetrue\fi}%
+ {\edef\p_option{\naturaltablelocalparameter\c!option}%
+ \ifx\p_option\v!tight\donefalse\else\donetrue\fi}%
\donetrue
\ifdone
\ifdim\tabl_ntb_get_wid\c_tabl_ntb_col<\wd\scratchbox
@@ -1723,7 +1845,9 @@
\unexpanded\def\tabl_ntb_cell_process_b_c#1#2#3[#4]#5%
{\setbox\scratchbox\hbox
{\tabl_ntb_setup_cell{#2}{#3}%
- \setupcurrentnaturaltablelocal[#4,#1,\c!frame=\v!off,\c!background=]%
+ \setupcurrentnaturaltablelocal[#4,#1]%
+ \letnaturaltablelocalparameter\c!background\empty
+ \letnaturaltablelocalparameter\c!frame\v!off
\inheritednaturaltablelocalframed{\tabl_ntb_cell_start#5\tabl_ntb_cell_stop}}%
\setbox2\emptyhbox
\wd2\wd\scratchbox
@@ -1762,7 +1886,10 @@
\unexpanded\def\tabl_ntb_cell_process_d#1#2[#3]#4%
{\tabl_ntb_setup_cell{#1}{#2}%
\bgroup
- \setupcurrentnaturaltablelocal[#3,\c!width=\d_tabl_ntb_width,\c!background=,\c!frame=\v!off]% 25% faster
+ \setupcurrentnaturaltablelocal[#3]%
+ \letnaturaltablelocalparameter\c!background\empty
+ \letnaturaltablelocalparameter\c!frame\v!off
+ \setnaturaltablelocalparameter\c!width{\d_tabl_ntb_width}%
\inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop}%
\egroup}
@@ -1771,10 +1898,11 @@
\setupcurrentnaturaltablelocal[#3]% to get the color right, the way we
\color % handle color here prevents interference due to whatsit nodes
[\naturaltablelocalparameter\c!color] % as well as permits local colors to take precedence
- {\ifdim\d_tabl_ntb_height=\zeropoint\relax % case: nc=maxcolumns
- \setupcurrentnaturaltablelocal[\c!color=,\c!width=\d_tabl_ntb_width]%
+ {\letnaturaltablelocalparameter\c!color\empty
+ \setnaturaltablelocalparameter\c!width{\d_tabl_ntb_width}%
+ \ifdim\d_tabl_ntb_height=\zeropoint\relax % case: nc=maxcolumns
\else
- \setupcurrentnaturaltablelocal[\c!color=,\c!width=\d_tabl_ntb_width,\c!height=\d_tabl_ntb_height]%
+ \setnaturaltablelocalparameter\c!height{\d_tabl_ntb_height}%
\fi
\inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop}}%
\hskip\tabl_ntb_get_dis{#2}}
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index f538747a3..59ac85ed3 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -1049,17 +1049,25 @@
\def\tabl_tabulate_insert_foot_content
{\tabulatenoalign{\global\settrue\c_tabl_tabulate_someamble}%
- \csname\??tabulatehead\currenttabulation\endcsname
+ \csname\??tabulatefoot\currenttabulation\endcsname
\tabulatenoalign{\global\setfalse\c_tabl_tabulate_someamble}}%
\def\tabl_tabulate_check_full_content % - needed, else confusion with \c!header
{\ifcsname\??tabulatehead\currenttabulation\endcsname
- \let\tabl_tabulate_insert_head\tabl_tabulate_insert_head_content
+ \expandafter\ifx\csname\??tabulatehead\currenttabulation\endcsname\empty
+ \let\tabl_tabulate_insert_head\empty
+ \else
+ \let\tabl_tabulate_insert_head\tabl_tabulate_insert_head_content
+ \fi
\else
\let\tabl_tabulate_insert_head\empty
\fi
\ifcsname\??tabulatefoot\currenttabulation\endcsname
- \let\tabl_tabulate_insert_foot\tabl_tabulate_insert_foot_content
+ \expandafter\ifx\csname\??tabulatefoot\currenttabulation\endcsname\empty
+ \let\tabl_tabulate_insert_foot\empty
+ \else
+ \let\tabl_tabulate_insert_foot\tabl_tabulate_insert_head_content
+ \fi
\else
\let\tabl_tabulate_insert_foot\empty
\fi}
@@ -1090,11 +1098,11 @@
\def\tabl_tabulate_start_foot_yes[#1]%
{\processcontent{\e!stop\v!tabulatetail}\m_tabl_tabulate_data{\letvalue{\??tabulatefoot#1}\m_tabl_tabulate_data}}
-% \def\tabl_tabulate_start_head_nop{\tabl_tabulate_start_head_yes[\v!tabulate]}
-% \def\tabl_tabulate_start_foot_nop{\tabl_tabulate_start_foot_yes[\v!tabulate]}
+\def\tabl_tabulate_start_head_nop{\tabl_tabulate_start_head_yes[\v!tabulate]}
+\def\tabl_tabulate_start_foot_nop{\tabl_tabulate_start_foot_yes[\v!tabulate]}
-\def\tabl_tabulate_start_head_nop{\tabl_tabulate_start_head_yes[]}
-\def\tabl_tabulate_start_foot_nop{\tabl_tabulate_start_foot_yes[]}
+% \def\tabl_tabulate_start_head_nop{\tabl_tabulate_start_head_yes[]}
+% \def\tabl_tabulate_start_foot_nop{\tabl_tabulate_start_foot_yes[]}
% \unexpanded\def\tabl_start_defined[#1]%
% {\bgroup
diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua
index ca02616e3..9be8f9be0 100644
--- a/tex/context/base/tabl-xtb.lua
+++ b/tex/context/base/tabl-xtb.lua
@@ -127,7 +127,7 @@ function xtables.create(settings)
local modes = { }
local fixedrows = { }
local fixedcolumns = { }
- local fixedcspans = { }
+ -- local fixedcspans = { }
local frozencolumns = { }
local options = { }
local rowproperties = { }
@@ -142,7 +142,7 @@ function xtables.create(settings)
autowidths = autowidths,
fixedrows = fixedrows,
fixedcolumns = fixedcolumns,
- fixedcspans = fixedcspans,
+ -- fixedcspans = fixedcspans,
frozencolumns = frozencolumns,
options = options,
nofrows = 0,
@@ -194,22 +194,25 @@ function xtables.create(settings)
setmetatableindex(fixedrows,add_zero)
setmetatableindex(fixedcolumns,add_zero)
setmetatableindex(options,add_table)
- setmetatableindex(fixedcspans,add_table)
+ -- setmetatableindex(fixedcspans,add_table)
--
- settings.columndistance = tonumber(settings.columndistance) or 0
- settings.rowdistance = tonumber(settings.rowdistance) or 0
- settings.leftmargindistance = tonumber(settings.leftmargindistance) or 0
+ local globaloptions = settings_to_hash(settings.option)
+ --
+ settings.columndistance = tonumber(settings.columndistance) or 0
+ settings.rowdistance = tonumber(settings.rowdistance) or 0
+ settings.leftmargindistance = tonumber(settings.leftmargindistance) or 0
settings.rightmargindistance = tonumber(settings.rightmargindistance) or 0
- settings.options = settings_to_hash(settings.option)
- settings.textwidth = tonumber(settings.textwidth) or texget("hsize")
- settings.lineheight = tonumber(settings.lineheight) or texgetdimen("lineheight")
- settings.maxwidth = tonumber(settings.maxwidth) or settings.textwidth/8
+ settings.options = globaloptions
+ settings.textwidth = tonumber(settings.textwidth) or texget("hsize")
+ settings.lineheight = tonumber(settings.lineheight) or texgetdimen("lineheight")
+ settings.maxwidth = tonumber(settings.maxwidth) or settings.textwidth/8
-- if #stack > 0 then
-- settings.textwidth = texget("hsize")
-- end
data.criterium_v = 2 * data.settings.lineheight
data.criterium_h = .75 * data.settings.textwidth
-
+ --
+ data.tight = globaloptions[v_tight]
end
function xtables.initialize_reflow_width(option,width)
@@ -266,19 +269,20 @@ function xtables.set_reflow_width()
if width > widths[c] then
widths[c] = width
end
+-- elseif not data.tight and not options[v_tight] then
elseif not options[v_tight] then
if width > widths[c] then
widths[c] = width
end
end
end
--- if cspan > 1 then
--- local f = data.fixedcspans[c]
--- local w = f[cspan] or 0
--- if width > w then
--- f[cspan] = width -- maybe some day a solution for autospanmax and so
--- end
--- end
+ -- if cspan > 1 then
+ -- local f = data.fixedcspans[c]
+ -- local w = f[cspan] or 0
+ -- if width > w then
+ -- f[cspan] = width -- maybe some day a solution for autospanmax and so
+ -- end
+ -- end
if drc.ny < 2 then
if height > heights[r] then
heights[r] = height
@@ -296,9 +300,13 @@ function xtables.set_reflow_width()
local fixedcolumns = data.fixedcolumns
local fixedrows = data.fixedrows
if dimensionstate == 1 then
+if cspan > 1 then
+ -- ignore width
+else
if width > fixedcolumns[c] then -- how about a span here?
fixedcolumns[c] = width
end
+end
elseif dimensionstate == 2 then
fixedrows[r] = height
elseif dimensionstate == 3 then
@@ -857,9 +865,12 @@ function xtables.construct()
end
nofr = nofr + 1
local rp = rowproperties[r]
+ -- we have a direction issue here but hpack_node_list(list,0,"exactly","TLT") cannot be used
+ -- due to the fact that we need the width
+ local hbox = hpack_node_list(list)
+ setfield(hbox,"dir","TLT")
result[nofr] = {
- -- hpack_node_list(list),
- hpack_node_list(list,0,"exactly","TLT"), -- otherwise weird lap
+ hbox,
size,
i < nofrange and rowdistance > 0 and rowdistance or false, -- might move
false,
diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi
index 43914137d..11e926575 100644
--- a/tex/context/base/tabl-xtb.mkvi
+++ b/tex/context/base/tabl-xtb.mkvi
@@ -343,7 +343,8 @@
\setvalue{\??xtableflushsplit\v!no}%
{\dontleavehmode % else no leftskip etc
- \ctxcommand{x_table_flush{ method = "\v!normal" }}}
+ \ctxcommand{x_table_flush{ method = "\v!normal" }}%
+ \removeunwantedspaces}
% in text flow: headers and footers get repeated