diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/bib2gls/examples/sample-citations.tex |
Initial commit
Diffstat (limited to 'support/bib2gls/examples/sample-citations.tex')
-rw-r--r-- | support/bib2gls/examples/sample-citations.tex | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/support/bib2gls/examples/sample-citations.tex b/support/bib2gls/examples/sample-citations.tex new file mode 100644 index 0000000000..3cf9fd14a0 --- /dev/null +++ b/support/bib2gls/examples/sample-citations.tex @@ -0,0 +1,70 @@ +% This file is public domain. See the "Examples" chapter +% in the bib2gls user manual for a more detailed description +% of this file. + +% bib2gls must be run with the --cite-as-record switch + +\documentclass[12pt,a4paper]{article} + +\usepackage[record,% using bib2gls +nomain,% don't define main glossary +postdot,% full stop after descriptions +nostyles,% don't load default styles +% load glossary-tree and glossary-list and patch styles: +stylemods={tree,list} +]{glossaries-extra} + +\newglossary*{contributors}{Authors} +\newglossary*{titles}{Titles} + +\newcommand{\bibglsnewbibtexentry}[4]{% + \longnewglossaryentry*{#1}{name={#3},#2,type={titles}}{#4}% +} + +\GlsXtrLoadResources[ + src={citations},% data in citations.bib + entry-type-aliases={\GlsXtrBibTeXEntryAliases}, + field-aliases={ + title=name + }, + type={contributors}, + category={same as original entry}, + sort-field={category}, + sort-suffix={name} +] + +\glsxtrsetgrouptitle{article}{Articles} +\glsxtrsetgrouptitle{book}{Books} + +\newcommand{\contributorhandler}[1]{\par\glsentryname{#1} \cite{#1}} + +\newcommand{\glsxtrpostdesccontributor}{% + \glsxtrifhasfield{bibtexentry}{\glscurrententrylabel}% + {% + \glsxtrfieldforlistloop + {\glscurrententrylabel}{bibtexentry}% + {\contributorhandler}% + }% + {\par No titles.}% +} + +\newcommand{\glsxtrpostdescarticle}{\cite{\glscurrententrylabel}} +\newcommand{\glsxtrpostdescbook}{\cite{\glscurrententrylabel}} + +\begin{document} +This is a sample document with some citations~\cite{macaw,parrot} +and some more citations~\cite{duck2018,duck2016} and don't +forget~\cite{ing,parrot2012} and lastly~\cite{quackalot}. + +\printunsrtglossary[type=contributors,style=altlist] +\printunsrtglossary*[type=titles,style=indexgroup] +{% + \renewcommand{\glsxtrgroupfield}{category}% + \renewcommand{\glstreenamefmt}[1]{\emph{#1}}% + \renewcommand{\glstreegroupheaderfmt}[1]{\textbf{#1}}% +} + +\bibliographystyle{unsrt} +\bibliography{citations} + +\end{document} |