Skip to content

Commit

Permalink
Merge pull request #56 from JuliaDocs/mg/format-non-articles
Browse files Browse the repository at this point in the history
Fix rendering of non-article references
  • Loading branch information
goerz authored Oct 31, 2023
2 parents 719a591 + 68ba692 commit 65d08d7
Show file tree
Hide file tree
Showing 17 changed files with 875 additions and 129 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Support underscores in citation keys [[#14][]]
* 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][]]
* 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`.
* 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.

### Added

Expand Down
4 changes: 4 additions & 0 deletions devrepl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ if !isfile(joinpath("test", "Manifest.toml"))
end
include("test/init.jl")

# Disable link-checking in interactive REPL, since it is the slowest part
# of building the docs.
ENV["DOCUMENTER_CHECK_LINKS"] = "0"

if abspath(PROGRAM_FILE) == @__FILE__
help()
end
3 changes: 2 additions & 1 deletion docs/latex/authoryear.tex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
\item \verb|\Citealt{WinckelIP2008}| renders as ``\Citealt{WinckelIP2008}''.
\item \verb|\Citealp{WinckelIP2008}| renders as ``\Citealp{WinckelIP2008}''.
\item multi-\verb|\cite|: See~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}
\item multi-\verb|\citet|: See~\citet[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
\item Ref.~\cite{GoerzPhd2015, Giles2008b,Nolting1997Coulomb}
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
2 changes: 2 additions & 0 deletions docs/latex/biblatex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
\item \cite{GoerzPhd2015} and \cite{Luc-KoenigEPJD2004}
\item Refs.~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
\item Ref.~\cite{WP_Schroedinger}
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
\item Ref.~\cite{GoerzPhd2015, Giles2008b, Nolting1997Coulomb}
\end{itemize}

\printbibliography
Expand Down
2 changes: 2 additions & 0 deletions docs/latex/numeric.tex
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
\item \cite{GoerzPhd2015} and \cite{Luc-KoenigEPJD2004}
\item Refs.~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
\item Ref.~\cite{WP_Schroedinger}
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
\item Ref.~\cite{GoerzPhd2015, Giles2008b,Nolting1997Coulomb}
\end{itemize}

Further commands that we do not support in markdown:
Expand Down
138 changes: 131 additions & 7 deletions docs/latex/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,143 @@ @article{Luc-KoenigEPJD2004
Archiveprefix = {arXiv},
}

@misc{WP_Schroedinger,
Author = {Wikipedia},
Title = {Schrödinger equation},
url = {https://en.wikipedia.org/wiki/Schrödinger_equation},
year = {2023},
urldate={2023-10-24},
note={Online},
}

@inbook{NielsenChuangCh10QEC,
Author = {Nielsen, Michael and Chuang, Isaac L.},
Title = {Quantum error-correction},
Chapter = {10},
Booktitle = {Quantum Computation and Quantum Information},
Publisher = {Cambridge University Press},
Doi = {10.1017/CBO9780511976667},
Year = {2000},
}

@proceedings{AnderssonSGS2014,
Booktitle = {Quantum Information and Coherence},
Editor = {Erika Andersson and Patrik {\"O}hberg},
Publisher = {Springer},
Series = {Scottish Graduate Series},
Title = {Open Quantum Systems and Decoherence},
Year = {2014},
Doi = {0.1007/978-3-319-04063-9},
}


@inproceedings{SuominenSGS2014,
Author = {Kalle-Antti Suominen},
Booktitle = {Quantum Information and Coherence},
Pages = {247--282},
Editor = {Erika Andersson and Patrik {\"O}hberg},
Publisher = {Springer},
Series = {Scottish Graduate Series},
Title = {Open Quantum Systems and Decoherence},
Year = {2014},
Doi = {10.1007/978-3-319-04063-9_10},
}

@inproceedings{DevoretLH1995,
Author = {Devoret, Michel H},
Booktitle = {Quantum Fluctuations},
Editor = {Reynaud, S. and Giacobino, E. and Zinn-Justin, J.},
Pages = {353},
Publisher = {Elsevier},
Vol = {Session LXIII (1995)},
Series = {Lecture Notes of the Les Houches Summer School},
Title = {Quantum fluctuations in electrical circuits},
Chapter = {10},
Url = {https://boulderschool.yale.edu/sites/default/files/files/devoret_quantum_fluct_les_houches.pdf},
Year = {1997}
}

@inproceedings{PaszkeNIPS2019,
title = {{PyTorch}: An Imperative Style, High-Performance Deep Learning Library},
address = {Vancouver, BC, Canada},
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},
booktitle = {Proceedings of the 33rd International Conference on Neural Information Processing Systems (NeurIPS 2019)},
editor = {Wallach, Hanna M. and Larochelle, Hugo and Beygelzimer, Alina and d'Alch{\'e}-Buc, Florence and Fox, Edward A. and Garnett, Roman},
pages = {8024--8035},
articleno = {721},
numpages = {12},
url = {http://papers.neurips.cc/paper/9015-pytorch-an-imperative-style-high-performance-deep-learning-library.pdf},
year = {2019},
month = {12},
}


@incollection{JuhlARNMRS2020,
title = {Versatile {NMR} simulations using {SIMPSON}},
booktitle = {},
author = {Juhl, Dennis W. and To\v{s}ner, Zden\v{e}k and Vosegaard, Thomas},
editor = {Graham A. Webb},
series = {Annual Reports on {NMR} Spectroscopy},
chapter = {1},
doi = {10.1016/bs.arnmr.2019.12.001},
pages = {1--59},
publisher = {Elsevier},
volume = {100},
year = {2020},
}

@inproceedings{PercontiSPIE2016,
author = {Perconti, Philip and Alberts, W. C. Kirkpatrick and Bajaj, Jagmohan and Schuster, Jonathan and Reed, Meredith},
booktitle = {Quantum Sensing and Nano Electronics and Photonics XIII},
doi = {10.1117/12.2217797},
series = {Proc. SPIE},
number = {975506},
title = {Sensors, nano-electronics and photonics for the Army of 2030 and beyond},
year = {2016},
}

@incollection{Giles2008,
address = {Berlin, Heidelberg},
author = {Giles, Mike B.},
booktitle = {Advances in Automatic Differentiation},
doi = {10.1007/978-3-540-68942-3_4},
editor = {Bischof, Christian H. and B{\"u}cker, H. Martin and Hovland, Paul and Naumann, Uwe and Utke, Jean},
pages = {35--44},
publisher = {Springer},
series = {Lecture Notes in Computational Science and Engineering},
title = {Collected Matrix Derivative Results for Forward and Reverse Mode Algorithmic Differentiation},
volume = {64},
year = {2008},
month = jan,
}

@phdthesis{GoerzPhd2015,
Author = {Goerz, Michael},
Title = {Optimizing Robust Quantum Gates in Open Quantum Systems},
School = {Universität Kassel},
url = {https://kobra.uni-kassel.de/handle/123456789/2015052748381},
Year = {2015},
note = {See \url{https://michaelgoerz.net} for additional formats. Source available on \href{https://github.com/goerz/dissertation}{Github}},
}

@misc{WP_Schroedinger,
Author = {Wikipedia},
Title = {Schrödinger equation},
url = {https://en.wikipedia.org/wiki/Schrödinger_equation},
year = {2023},
urldate={2023-10-24},
note={Online},
@techreport{Giles2008b,
author = {Giles, Mike B.},
institution = {Oxford University Computing Laboratory},
number = {NA-08-01},
title = {An extended collection of matrix derivative results for forward and reverse mode automatic differentiation},
url = {https://people.maths.ox.ac.uk/gilesm/files/NA-08-01.pdf},
year = {2008},
}

@inbook{Nolting1997Coulomb,
author = {Wolfgang Nolting},
title = {Quantenmechanik},
series = {Grundkurs Theoretische Physik},
volume = {5},
number = {2},
chapter = {6},
pages = {100},
doi = {10.1007/978-3-663-14691-9},
year = 1997,
publisher = {Vieweg \& Teubner Verlag},
}
2 changes: 2 additions & 0 deletions docs/latex/rmp.tex
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
\item \verb|\Citet{WinckelIP2008}| renders as ``\Citet{WinckelIP2008}''.
\item multi-\verb|\cite|: See~\cite[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}
\item multi-\verb|\citet|: See~\citet[and references therein]{WinckelIP2008,BrumerShapiro2003,BrifNJP2010,Shapiro2012,KochJPCM2016,GoerzQ2022,SolaAAMOP2018,MorzhinRMS2019,KochEPJQT2022}.
\item Ref.~\cite{NielsenChuangCh10QEC, AnderssonSGS2014, SuominenSGS2014, DevoretLH1995, PaszkeNIPS2019,JuhlARNMRS2020,PercontiSPIE2016,Giles2008}
\item Ref.~\cite{GoerzPhd2015, Giles2008b,Nolting1997Coulomb}
\end{itemize}

Further commands that we do not support in markdown:
Expand Down
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ include("custom_styles/keylabels.jl")

makedocs(
authors=AUTHORS,
linkcheck=true,
linkcheck=(get(ENV, "DOCUMENTER_CHECK_LINKS", "1") != "0"),
# Link checking is disabled in REPL, see `devrepl.jl`.
warnonly=[:linkcheck,],
sitename="DocumenterCitations.jl",
format=Documenter.HTML(
Expand Down
22 changes: 12 additions & 10 deletions docs/src/gallery.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The built-in styles are:
This is the default style (`style=:numeric`) used throughout the other pages of this documentation, cf. the [Syntax](@ref) examples.

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

```@bibliography
Pages = ["gallery.md"]
Pages = [@__FILE__]
Style = :numeric
Canonical = false
```
Expand All @@ -39,7 +39,7 @@ Canonical = false
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).

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

```@bibliography
Pages = ["gallery.md"]
Pages = [@__FILE__]
Style = :authoryear
Canonical = false
```
Expand All @@ -67,7 +67,7 @@ Canonical = false
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.

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

```@bibliography
Pages = ["gallery.md"]
Pages = [@__FILE__]
Style = :alpha
Canonical = false
SolaAAMOP2018
```

```@raw latex
Expand Down Expand Up @@ -135,13 +137,13 @@ end
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`:

* `[GoerzQ2022](@cite)` renders as "[GoerzQ2022](@cite%enumauthoryear%)"
* `[FuerstNJP2014](@cite)` renders as "[FuerstNJP2014](@cite%enumauthoryear%)"
* `[FuerstNJP2014,SolaAAMOP2018](@cite)` renders as "[FuerstNJP2014,SolaAAMOP2018](@cite%enumauthoryear%)"
* `[WinckelIP2008](@Citet)` renders as "[WinckelIP2008](@Citet%enumauthoryear%)"

**References:**

```@bibliography
Pages = ["gallery.md"]
Pages = [@__FILE__]
Style = :enumauthoryear
Canonical = false
```
Expand All @@ -165,7 +167,7 @@ end
~~~

* `[GoerzQ2022](@cite)` renders as "[GoerzQ2022](@cite%keylabels%)"
* `[FuerstNJP2014](@cite)` renders as "[FuerstNJP2014](@cite%keylabels%)"
* `[FuerstNJP2014,SolaAAMOP2018](@cite)` renders as "[FuerstNJP2014,SolaAAMOP2018](@cite%keylabels%)"
* `[GoerzQ2022](@citet)` renders as "[GoerzQ2022](@citet%keylabels%)"
* `[GoerzQ2022](@citep)` renders as "[GoerzQ2022](@citep%keylabels%)" — `@citep` is the same as `@cite` for this style
* `[GoerzQ2022; Eq. (1)](@cite)` renders as "[GoerzQ2022; Eq. (1)](@cite%keylabels%)"
Expand All @@ -179,7 +181,7 @@ end
**References:**

```@bibliography
Pages = ["gallery.md"]
Pages = [@__FILE__]
Style = :keylabels
Canonical = false
```
Expand Down
Loading

0 comments on commit 65d08d7

Please sign in to comment.