Skip to content

Commit 68ba692

Browse files
committed
Fix rendering of non-article references.
This brings the rendering of non-article entries in line with RevTeX. It significantly extends the support especially for `@inproceedings`, `@incollection`, `@inbook`. The `Chapter`, `Volume`, `Number`, `Edition`, `Month`, fields are now supported for several entry types. Revises how the URL/DOI is linked in the references. Adds the `title_transform_case` option to the internal formatting routines, for use by custom styles. In principle, this could be used to implement the sentence-case transformation that is common in BibTeX styles. Note that I don't condone this convention: The titles should appear as they do in the published material (which generally means title case, not sentence case). In any case, `DocumenterCitations` will continue to render titles as they appear in the `.bib` file, making braces to "protect" capitalized words unnecessary.
1 parent 719a591 commit 68ba692

17 files changed

+875
-129
lines changed

NEWS.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
* Support underscores in citation keys [[#14][]]
1313
* The `Pages` in a `@bibliography` block are now relative to the folder containing the current file. The behavior is consistent with `Pages` in Documenter's `@index` and `@contents` blocks. [[#22][]]
1414
* The parsing of LaTeX strings has improved significantly. In particular, curly braces should now be stripped correctly [[#15][]]. Note that that braces in titles are never needed for `DocumenterCitations`, but handling them correctly makes it easier to use the same `.bib` file for LaTeX and `DocumenterCitations`.
15+
* Fixed the rendering of references other than `@article`, especially `@inproceedings`, `@incollection`, `@inbooks`, mimicking RevTeX. The DOI/URL are now linked via the Title and/or Booktitle. Added support for `Chapter`, `Volume`, `Number`, `Edition`, `Month` fields.
1516

1617
### Added
1718

devrepl.jl

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ if !isfile(joinpath("test", "Manifest.toml"))
2626
end
2727
include("test/init.jl")
2828

29+
# Disable link-checking in interactive REPL, since it is the slowest part
30+
# of building the docs.
31+
ENV["DOCUMENTER_CHECK_LINKS"] = "0"
32+
2933
if abspath(PROGRAM_FILE) == @__FILE__
3034
help()
3135
end

docs/latex/authoryear.tex

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
\item \verb|\Citealt{WinckelIP2008}| renders as ``\Citealt{WinckelIP2008}''.
4949
\item \verb|\Citealp{WinckelIP2008}| renders as ``\Citealp{WinckelIP2008}''.
5050
\item multi-\verb|\cite|: See~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}
51-
\item multi-\verb|\citet|: See~\citet[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
51+
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
52+
\item Ref.~\cite{GoerzPhd2015, Giles2008b,Nolting1997Coulomb}
5253
\end{itemize}
5354

5455
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

docs/latex/biblatex.tex

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
\item \cite{GoerzPhd2015} and \cite{Luc-KoenigEPJD2004}
4141
\item Refs.~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
4242
\item Ref.~\cite{WP_Schroedinger}
43+
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
44+
\item Ref.~\cite{GoerzPhd2015, Giles2008b, Nolting1997Coulomb}
4345
\end{itemize}
4446

4547
\printbibliography

docs/latex/numeric.tex

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
\item \cite{GoerzPhd2015} and \cite{Luc-KoenigEPJD2004}
4141
\item Refs.~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
4242
\item Ref.~\cite{WP_Schroedinger}
43+
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
44+
\item Ref.~\cite{GoerzPhd2015, Giles2008b,Nolting1997Coulomb}
4345
\end{itemize}
4446

4547
Further commands that we do not support in markdown:

docs/latex/refs.bib

+131-7
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,143 @@ @article{Luc-KoenigEPJD2004
110110
Archiveprefix = {arXiv},
111111
}
112112

113+
@misc{WP_Schroedinger,
114+
Author = {Wikipedia},
115+
Title = {Schrödinger equation},
116+
url = {https://en.wikipedia.org/wiki/Schrödinger_equation},
117+
year = {2023},
118+
urldate={2023-10-24},
119+
note={Online},
120+
}
121+
122+
@inbook{NielsenChuangCh10QEC,
123+
Author = {Nielsen, Michael and Chuang, Isaac L.},
124+
Title = {Quantum error-correction},
125+
Chapter = {10},
126+
Booktitle = {Quantum Computation and Quantum Information},
127+
Publisher = {Cambridge University Press},
128+
Doi = {10.1017/CBO9780511976667},
129+
Year = {2000},
130+
}
131+
132+
@proceedings{AnderssonSGS2014,
133+
Booktitle = {Quantum Information and Coherence},
134+
Editor = {Erika Andersson and Patrik {\"O}hberg},
135+
Publisher = {Springer},
136+
Series = {Scottish Graduate Series},
137+
Title = {Open Quantum Systems and Decoherence},
138+
Year = {2014},
139+
Doi = {0.1007/978-3-319-04063-9},
140+
}
141+
142+
143+
@inproceedings{SuominenSGS2014,
144+
Author = {Kalle-Antti Suominen},
145+
Booktitle = {Quantum Information and Coherence},
146+
Pages = {247--282},
147+
Editor = {Erika Andersson and Patrik {\"O}hberg},
148+
Publisher = {Springer},
149+
Series = {Scottish Graduate Series},
150+
Title = {Open Quantum Systems and Decoherence},
151+
Year = {2014},
152+
Doi = {10.1007/978-3-319-04063-9_10},
153+
}
154+
155+
@inproceedings{DevoretLH1995,
156+
Author = {Devoret, Michel H},
157+
Booktitle = {Quantum Fluctuations},
158+
Editor = {Reynaud, S. and Giacobino, E. and Zinn-Justin, J.},
159+
Pages = {353},
160+
Publisher = {Elsevier},
161+
Vol = {Session LXIII (1995)},
162+
Series = {Lecture Notes of the Les Houches Summer School},
163+
Title = {Quantum fluctuations in electrical circuits},
164+
Chapter = {10},
165+
Url = {https://boulderschool.yale.edu/sites/default/files/files/devoret_quantum_fluct_les_houches.pdf},
166+
Year = {1997}
167+
}
168+
169+
@inproceedings{PaszkeNIPS2019,
170+
title = {{PyTorch}: An Imperative Style, High-Performance Deep Learning Library},
171+
address = {Vancouver, BC, Canada},
172+
author = {Paszke, Adam and Gross, Sam and Massa, Francisco and Lerer, Adam and Bradbury, James and Chanan, Gregory and Killeen, Trevor and Lin, Zeming and Gimelshein, Natalia and Antiga, Luca and Desmaison, Alban and K{\"o}pf, Andreas and Yang, Edward and DeVito, Zachary and Raison, Martin and Tejani, Alykhan and Chilamkurthy, Sasank and Steiner, Benoit and Fang, Lu and Bai, Junjie and Chintala, Soumith},
173+
booktitle = {Proceedings of the 33rd International Conference on Neural Information Processing Systems (NeurIPS 2019)},
174+
editor = {Wallach, Hanna M. and Larochelle, Hugo and Beygelzimer, Alina and d'Alch{\'e}-Buc, Florence and Fox, Edward A. and Garnett, Roman},
175+
pages = {8024--8035},
176+
articleno = {721},
177+
numpages = {12},
178+
url = {http://papers.neurips.cc/paper/9015-pytorch-an-imperative-style-high-performance-deep-learning-library.pdf},
179+
year = {2019},
180+
month = {12},
181+
}
182+
183+
184+
@incollection{JuhlARNMRS2020,
185+
title = {Versatile {NMR} simulations using {SIMPSON}},
186+
booktitle = {},
187+
author = {Juhl, Dennis W. and To\v{s}ner, Zden\v{e}k and Vosegaard, Thomas},
188+
editor = {Graham A. Webb},
189+
series = {Annual Reports on {NMR} Spectroscopy},
190+
chapter = {1},
191+
doi = {10.1016/bs.arnmr.2019.12.001},
192+
pages = {1--59},
193+
publisher = {Elsevier},
194+
volume = {100},
195+
year = {2020},
196+
}
197+
198+
@inproceedings{PercontiSPIE2016,
199+
author = {Perconti, Philip and Alberts, W. C. Kirkpatrick and Bajaj, Jagmohan and Schuster, Jonathan and Reed, Meredith},
200+
booktitle = {Quantum Sensing and Nano Electronics and Photonics XIII},
201+
doi = {10.1117/12.2217797},
202+
series = {Proc. SPIE},
203+
number = {975506},
204+
title = {Sensors, nano-electronics and photonics for the Army of 2030 and beyond},
205+
year = {2016},
206+
}
207+
208+
@incollection{Giles2008,
209+
address = {Berlin, Heidelberg},
210+
author = {Giles, Mike B.},
211+
booktitle = {Advances in Automatic Differentiation},
212+
doi = {10.1007/978-3-540-68942-3_4},
213+
editor = {Bischof, Christian H. and B{\"u}cker, H. Martin and Hovland, Paul and Naumann, Uwe and Utke, Jean},
214+
pages = {35--44},
215+
publisher = {Springer},
216+
series = {Lecture Notes in Computational Science and Engineering},
217+
title = {Collected Matrix Derivative Results for Forward and Reverse Mode Algorithmic Differentiation},
218+
volume = {64},
219+
year = {2008},
220+
month = jan,
221+
}
222+
113223
@phdthesis{GoerzPhd2015,
114224
Author = {Goerz, Michael},
115225
Title = {Optimizing Robust Quantum Gates in Open Quantum Systems},
116226
School = {Universität Kassel},
117227
url = {https://kobra.uni-kassel.de/handle/123456789/2015052748381},
118228
Year = {2015},
229+
note = {See \url{https://michaelgoerz.net} for additional formats. Source available on \href{https://github.com/goerz/dissertation}{Github}},
119230
}
120231

121-
@misc{WP_Schroedinger,
122-
Author = {Wikipedia},
123-
Title = {Schrödinger equation},
124-
url = {https://en.wikipedia.org/wiki/Schrödinger_equation},
125-
year = {2023},
126-
urldate={2023-10-24},
127-
note={Online},
232+
@techreport{Giles2008b,
233+
author = {Giles, Mike B.},
234+
institution = {Oxford University Computing Laboratory},
235+
number = {NA-08-01},
236+
title = {An extended collection of matrix derivative results for forward and reverse mode automatic differentiation},
237+
url = {https://people.maths.ox.ac.uk/gilesm/files/NA-08-01.pdf},
238+
year = {2008},
239+
}
240+
241+
@inbook{Nolting1997Coulomb,
242+
author = {Wolfgang Nolting},
243+
title = {Quantenmechanik},
244+
series = {Grundkurs Theoretische Physik},
245+
volume = {5},
246+
number = {2},
247+
chapter = {6},
248+
pages = {100},
249+
doi = {10.1007/978-3-663-14691-9},
250+
year = 1997,
251+
publisher = {Vieweg \& Teubner Verlag},
128252
}

docs/latex/rmp.tex

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
\item \verb|\Citet{WinckelIP2008}| renders as ``\Citet{WinckelIP2008}''.
4040
\item multi-\verb|\cite|: See~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}
4141
\item multi-\verb|\citet|: See~\citet[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
42+
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
43+
\item Ref.~\cite{GoerzPhd2015, Giles2008b,Nolting1997Coulomb}
4244
\end{itemize}
4345

4446
Further commands that we do not support in markdown:

docs/make.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ include("custom_styles/keylabels.jl")
2020

2121
makedocs(
2222
authors=AUTHORS,
23-
linkcheck=true,
23+
linkcheck=(get(ENV, "DOCUMENTER_CHECK_LINKS", "1") != "0"),
24+
# Link checking is disabled in REPL, see `devrepl.jl`.
2425
warnonly=[:linkcheck,],
2526
sitename="DocumenterCitations.jl",
2627
format=Documenter.HTML(

docs/src/gallery.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The built-in styles are:
1313
This is the default style (`style=:numeric`) used throughout the other pages of this documentation, cf. the [Syntax](@ref) examples.
1414

1515
* `[GoerzQ2022](@cite)` renders as "[GoerzQ2022](@cite)"
16-
* `[FuerstNJP2014](@cite)` renders as "[FuerstNJP2014](@cite)"
16+
* `[FuerstNJP2014,SolaAAMOP2018](@cite)` renders as "[FuerstNJP2014,SolaAAMOP2018](@cite)"
1717
* `[GoerzQ2022](@citet)` renders as "[GoerzQ2022](@citet)"
1818
* `[GoerzQ2022](@citep)` renders as "[GoerzQ2022](@citep)" — `@citep` is the same as `@cite` for this style
1919
* `[GoerzQ2022; Eq. (1)](@cite)` renders as "[GoerzQ2022; Eq. (1)](@cite)"
@@ -29,7 +29,7 @@ This is the default style (`style=:numeric`) used throughout the other pages of
2929
**References:**
3030

3131
```@bibliography
32-
Pages = ["gallery.md"]
32+
Pages = [@__FILE__]
3333
Style = :numeric
3434
Canonical = false
3535
```
@@ -39,7 +39,7 @@ Canonical = false
3939
The author-year style (`style=:authoryear`) formats citations with the author name and publication year. This is the citation style used, e.g., in [Rev. Mod. Phys.](https://journals.aps.org/rmp/) (`rmp` option in [REVTeX](https://www.ctan.org/tex-archive/macros/latex/contrib/revtex/auguide)). The bibliography is sorted alphabetically by author name. The default `@cite` command is parenthetical (`@cite` and `@citep` are equivalent) which is different from the `authoryear` style in [natbib](https://mirrors.rit.edu/CTAN/macros/latex/contrib/natbib/natnotes.pdf).
4040

4141
* `[GoerzQ2022](@cite)` renders as "[GoerzQ2022](@cite%authoryear%)"
42-
* `[FuerstNJP2014](@cite)` renders as "[FuerstNJP2014](@cite%authoryear%)"
42+
* `[FuerstNJP2014,SolaAAMOP2018](@cite)` renders as "[FuerstNJP2014,SolaAAMOP2018](@cite%authoryear%)"
4343
* `[GoerzQ2022](@citet)` renders as "[GoerzQ2022](@citet%authoryear%)"
4444
* `[GoerzQ2022](@citep)` renders as "[GoerzQ2022](@citep%authoryear%)" — `@citep` is the same as `@cite` for this style
4545
* `[GoerzQ2022; Eq. (1)](@cite)` renders as "[GoerzQ2022; Eq. (1)](@cite%authoryear%)"
@@ -57,7 +57,7 @@ The author-year style (`style=:authoryear`) formats citations with the author na
5757
**References:**
5858

5959
```@bibliography
60-
Pages = ["gallery.md"]
60+
Pages = [@__FILE__]
6161
Style = :authoryear
6262
Canonical = false
6363
```
@@ -67,7 +67,7 @@ Canonical = false
6767
The `style=:alpha` formats citations and references like `:numeric`, except that it uses labels derived from the author names and publication year and sorts the references alphabetically.
6868

6969
* `[GoerzQ2022](@cite)` renders as "[GoerzQ2022](@cite%alpha%)"
70-
* `[FuerstNJP2014](@cite)` renders as "[FuerstNJP2014](@cite%alpha%)"
70+
* `[FuerstNJP2014,SolaAAMOP2018](@cite)` renders as "[FuerstNJP2014,SolaAAMOP2018](@cite%alpha%)"
7171
* `[GoerzQ2022](@citet)` renders as "[GoerzQ2022](@citet%alpha%)"
7272
* `[GoerzQ2022](@citep)` renders as "[GoerzQ2022](@citep%alpha%)" — `@citep` is the same as `@cite` for this style
7373
* `[GoerzQ2022; Eq. (1)](@cite)` renders as "[GoerzQ2022; Eq. (1)](@cite%alpha%)"
@@ -83,9 +83,11 @@ The `style=:alpha` formats citations and references like `:numeric`, except that
8383
**References:**
8484

8585
```@bibliography
86-
Pages = ["gallery.md"]
86+
Pages = [@__FILE__]
8787
Style = :alpha
8888
Canonical = false
89+
90+
SolaAAMOP2018
8991
```
9092

9193
```@raw latex
@@ -135,13 +137,13 @@ end
135137
The important part of the definition is in the last line, indicating that the References should be shown as an enumeration (ordered list, `<ol>`, in HTML), see below. Meanwhile, citations render exactly as with `style=:authoryear`:
136138

137139
* `[GoerzQ2022](@cite)` renders as "[GoerzQ2022](@cite%enumauthoryear%)"
138-
* `[FuerstNJP2014](@cite)` renders as "[FuerstNJP2014](@cite%enumauthoryear%)"
140+
* `[FuerstNJP2014,SolaAAMOP2018](@cite)` renders as "[FuerstNJP2014,SolaAAMOP2018](@cite%enumauthoryear%)"
139141
* `[WinckelIP2008](@Citet)` renders as "[WinckelIP2008](@Citet%enumauthoryear%)"
140142

141143
**References:**
142144

143145
```@bibliography
144-
Pages = ["gallery.md"]
146+
Pages = [@__FILE__]
145147
Style = :enumauthoryear
146148
Canonical = false
147149
```
@@ -165,7 +167,7 @@ end
165167
~~~
166168

167169
* `[GoerzQ2022](@cite)` renders as "[GoerzQ2022](@cite%keylabels%)"
168-
* `[FuerstNJP2014](@cite)` renders as "[FuerstNJP2014](@cite%keylabels%)"
170+
* `[FuerstNJP2014,SolaAAMOP2018](@cite)` renders as "[FuerstNJP2014,SolaAAMOP2018](@cite%keylabels%)"
169171
* `[GoerzQ2022](@citet)` renders as "[GoerzQ2022](@citet%keylabels%)"
170172
* `[GoerzQ2022](@citep)` renders as "[GoerzQ2022](@citep%keylabels%)" — `@citep` is the same as `@cite` for this style
171173
* `[GoerzQ2022; Eq. (1)](@cite)` renders as "[GoerzQ2022; Eq. (1)](@cite%keylabels%)"
@@ -179,7 +181,7 @@ end
179181
**References:**
180182

181183
```@bibliography
182-
Pages = ["gallery.md"]
184+
Pages = [@__FILE__]
183185
Style = :keylabels
184186
Canonical = false
185187
```

0 commit comments

Comments
 (0)