diff --git a/assets/files/works.bib b/assets/files/works.bib index 391661caa..d3bd14cde 100644 --- a/assets/files/works.bib +++ b/assets/files/works.bib @@ -52,6 +52,17 @@ volume = {1}, } +@book{DBLP:books/lib/Knuth86a, + author = {Donald Ervin Knuth}, + title = {Computer modern typefaces}, + publisher = {Addison-Wesley}, + year = {1986}, + url = {https://www.worldcat.org/oclc/13157596}, + isbn = {0201134462}, + timestamp = {Fri, 17 Jul 2020 16:12:40 +0200}, + biburl = {https://dblp.org/rec/books/lib/Knuth86a.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} @article{sharing, title = {Do sharing people behave differently? An empirical evaluation of the distinctive mobility patterns of free-floating car-sharing members}, diff --git a/crates/typst/src/model/cite.rs b/crates/typst/src/model/cite.rs index 0e38b1bd0..e61056e82 100644 --- a/crates/typst/src/model/cite.rs +++ b/crates/typst/src/model/cite.rs @@ -27,6 +27,15 @@ use crate::text::{Lang, Region, TextElem}; /// #bibliography("works.bib") /// ``` /// +/// If your source name contains certain characters such as slashes, which are +/// not recognized by the `<>` syntax, you can explicitly call `label` instead. +/// +/// ```typ +/// Computer Modern is an example of a modernist serif typeface. +/// #cite(label("DBLP:books/lib/Knuth86a")). +/// >>> #bibliography("works.bib") +/// ``` +/// /// # Syntax /// This function indirectly has dedicated syntax. [References]($ref) can be /// used to cite works from the bibliography. The label then corresponds to the diff --git a/tests/ref/meta/bibliography-full.png b/tests/ref/meta/bibliography-full.png index 2ccccf545..4d3241520 100644 Binary files a/tests/ref/meta/bibliography-full.png and b/tests/ref/meta/bibliography-full.png differ diff --git a/tests/typ/meta/bibliography-full.typ b/tests/typ/meta/bibliography-full.typ index f67909b4c..cebe7e0d9 100644 --- a/tests/typ/meta/bibliography-full.typ +++ b/tests/typ/meta/bibliography-full.typ @@ -1,5 +1,5 @@ // Test the full bibliography. --- -#set page(paper: "a6", height: 160mm) +#set page(paper: "a6", height: 170mm) #bibliography("/files/works.bib", full: true) diff --git a/tests/typ/meta/bibliography.typ b/tests/typ/meta/bibliography.typ index ec90a96ae..0ce4b7f73 100644 --- a/tests/typ/meta/bibliography.typ +++ b/tests/typ/meta/bibliography.typ @@ -40,5 +40,5 @@ Now we have multiple bibliographies containing @glacier-melt @keshav2007read #bibliography("/files/works.bib") --- -// Error: 15-55 duplicate bibliography keys: netwok, issue201, arrgh, quark, distress, glacier-melt, tolkien54, sharing, restful, mcintosh_anxiety, psychology25 +// Error: 15-55 duplicate bibliography keys: netwok, issue201, arrgh, quark, distress, glacier-melt, tolkien54, DBLP:books/lib/Knuth86a, sharing, restful, mcintosh_anxiety, psychology25 #bibliography(("/files/works.bib", "/files/works.bib"))