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 /macros/latex/contrib/biblatex-contrib/citeall |
Initial commit
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/citeall')
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/citeall/README.md | 19 | ||||
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/citeall/citeall.pdf | bin | 0 -> 106775 bytes | |||
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/citeall/citeall.sty | 185 | ||||
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/citeall/citeall.tex | 119 | ||||
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/citeall/examples-citeall.bib | 39 |
5 files changed, 362 insertions, 0 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/citeall/README.md b/macros/latex/contrib/biblatex-contrib/citeall/README.md new file mode 100644 index 0000000000..b8979be2ab --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/citeall/README.md @@ -0,0 +1,19 @@ +#citeall --- A package to cite all entries of a bbl created with biblatex +Version 1.4 Ulrike Fischer 2017 + +## License +LaTeX Project Public License + +## Contents + +- Readme (this file) +- citeall.sty (the sty) +- citeall.tex, citeall.pdf (the docu) +- examples-citeall.bib (and example bib-file used by the documentation) + +## Installation + +Put the sty where it can be found. + +If you want to compile the documentation: +put the bib-file where it can be found. diff --git a/macros/latex/contrib/biblatex-contrib/citeall/citeall.pdf b/macros/latex/contrib/biblatex-contrib/citeall/citeall.pdf Binary files differnew file mode 100644 index 0000000000..f22df7d27b --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/citeall/citeall.pdf diff --git a/macros/latex/contrib/biblatex-contrib/citeall/citeall.sty b/macros/latex/contrib/biblatex-contrib/citeall/citeall.sty new file mode 100644 index 0000000000..377f9ae465 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/citeall/citeall.sty @@ -0,0 +1,185 @@ +%% --------------------------------------------------------------- +%% The citeall package --- A package to test biblatex-cite commands +%% Maintained by Ulrike Fischer +%% E-mail: fischer@troubleshooting-tex.de +%% www.troubleshooting-tex.de +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% $UFDate: 2017-12-03 18:19:20 +0100 -- Commit: 4f26014 (HEAD, master) -- master$ +%% --------------------------------------------------------------- + +\RequirePackage{xparse} + +\ProvidesExplPackage {citeall} {2017/12/03} {1.4} + {a package to test biblatex-cite commands} + +\@ifpackageloaded{biblatex}{}{% + \PackageWarning{citeall} + { + This~package~works~only~with~biblatex!\MessageBreak + Load~it~before~citeall!\MessageBreak + Loading~citeall~will~abort! + }% + \NewDocumentCommand\citeall { O{} } {} + \tex_endinput:D} + +\DeclareBibliographyCategory{citeall} + +% commands to hold arguments and temporary values +\clist_new:N \l__UFca_citecommands_clist +\tl_new:N \l__UFca_temp_citefunction_tl +\tl_new:N \l__UFca_temp_entrykey_tl +\int_new:N \l__UFca_temp_listitem_int +\int_new:N \l__UFca_temp_listlength_int +\int_new:N \l__UFca_entrynum_int +\int_new:N \l__UFca_cur_entrynum_int + +% formatting commands +\NewDocumentCommand \citeallgroupseparator {}{\par} +\NewDocumentCommand \citeallseparator {}{,\c_space_tl} +\NewDocumentCommand \citeallfinentry {}{} +\NewDocumentCommand \citealldefaultcite {}{\cite} +\NewDocumentCommand \citeallpreambledefinition {m}{} + +\clist_const:Nn\g_UFca_bbl_cmds_clist + { + true, + false, + field, + name, + strng, + keyw, + set, + warn, + inset, + range, + missing, + keyalias, + xref, + cnt, + annotation, + list + } + +\clist_const:Nn\g_UFca_bbl_envs_clist + { + refsection, + sortlist, + datalist + } + +\newcommand\@@UFca@bblcmd@true [2][]{{\ignorespaces}} +\newcommand\@@UFca@bblcmd@false [2][]{{\ignorespaces}} +\newcommand\@@UFca@bblcmd@field [3][]{\ignorespaces} +\newcommand\@@UFca@bblcmd@name [5][]{\ignorespaces} +\newcommand\@@UFca@bblcmd@strng [2]{\ignorespaces} +\newcommand\@@UFca@bblcmd@keyw [1]{\ignorespaces} +\newcommand\@@UFca@bblcmd@set [1]{\ignorespaces} +\newcommand\@@UFca@bblcmd@warn [1]{\ignorespaces} +\newcommand\@@UFca@bblcmd@inset [1]{\addtocategory{citeall}{#1}\ignorespaces} +\newcommand\@@UFca@bblcmd@range [2]{\ignorespaces} +\newcommand\@@UFca@bblcmd@missing [1]{\ignorespaces} +\newcommand\@@UFca@bblcmd@keyalias[2]{\ignorespaces} +\newcommand\@@UFca@bblcmd@xref [1]{\ignorespaces} +\newcommand\@@UFca@bblcmd@cnt [2]{\ignorespaces} +\newcommand\@@UFca@bblcmd@annotation[5]{\ignorespaces} +\newcommand\@@UFca@bblcmd@list [4][]{\ignorespaces} + +\newenvironment{@@UFca@bblenv@refsection}[1]{}{\ignorespaces} +\newenvironment{@@UFca@bblenv@sortlist} [2][]{}{\ignorespaces} +\newenvironment{@@UFca@bblenv@datalist} [2][]{}{\ignorespaces} + +%init suitable definitions for the fields in the bbl +\cs_new:Nn \__UFca_init_bblfields: + { + \let\preamble\citeallpreambledefinition + \clist_map_inline:Nn\g_UFca_bbl_cmds_clist + { + \cs_set_eq:cc { @@UFca@oricmd@##1 } { ##1 } + %\cs_show:c { @@UFca@oricmd@##1 } + \cs_set_eq:cc { ##1 } { @@UFca@bblcmd@##1 } + } + \def\verb##1\endverb {\ignorespaces} + \def\lverb##1\endlverb {\ignorespaces} %see https://github.com/plk/biblatex/issues/229 + \cs_set_eq:NN \refsection \@@UFca@bblenv@refsection + \cs_set_eq:NN \endrefsection \end@@UFca@bblenv@refsection + \cs_set_eq:NN \sortlist \@@UFca@bblenv@sortlist + \cs_set_eq:NN \endsortlist \end@@UFca@bblenv@sortlist + \cs_set_eq:NN \datalist \@@UFca@bblenv@datalist + \cs_set_eq:NN \enddatalist \end@@UFca@bblenv@datalist + } + +% init the entry environment +%#1=number of entries to process, if 0: process all +\cs_new:Nn \__UFca_init_bblentryenv:n + { + \int_set:Nn \l__UFca_entrynum_int {#1} + \int_zero:N \l__UFca_cur_entrynum_int + \NewDocumentEnvironment{entry} {m m m} + { + \int_incr:N \l__UFca_cur_entrynum_int + \tl_set:Nn \l__UFca_temp_entrykey_tl {##1} + \int_zero:N \l__UFca_temp_listitem_int + \int_set:Nn \l__UFca_temp_listlength_int + { + \clist_count:N\l__UFca_citecommands_clist + } + \bool_if:nT + { + \int_compare_p:n { \l__UFca_entrynum_int = 0 } + || + \int_compare_p:n { \l__UFca_cur_entrynum_int <= \l__UFca_entrynum_int } + } + { + \addtocategory{citeall}{##1} + \clist_map_variable:NNn \l__UFca_citecommands_clist \l__UFca_temp_citefunction_tl + { + \int_incr:N \l__UFca_temp_listitem_int + \group_begin: + \cs_set_eq:NN\list\@@UFca@oricmd@list + + \l__UFca_temp_citefunction_tl {\l__UFca_temp_entrykey_tl} + \group_end: + \int_compare:nNnTF + {\l__UFca_temp_listitem_int}<{\l__UFca_temp_listlength_int} + { + \citeallseparator + } + { + \citeallfinentry + } + } + \citeallgroupseparator + } + } + {} + } + + +% the main command + +\NewDocumentCommand\citeall { O{\citealldefaultcite} o} + { + \nocite{*} %cite all entries + \clist_set:Nn \l__UFca_citecommands_clist { #1 } + \clist_if_empty:NT \l__UFca_citecommands_clist + { + \clist_put_right:Nn \l__UFca_citecommands_clist { \citealldefaultcite } + } + \group_begin: + \IfNoValueTF{#2} + { + \__UFca_init_bblentryenv:n{0} + } + { + \__UFca_init_bblentryenv:n{#2} + } + \__UFca_init_bblfields: + \file_if_exist:nT + {\jobname.bbl} + {\file_input:n{\jobname.bbl}}% + \group_end: + } + + +\endinput diff --git a/macros/latex/contrib/biblatex-contrib/citeall/citeall.tex b/macros/latex/contrib/biblatex-contrib/citeall/citeall.tex new file mode 100644 index 0000000000..115112a3e3 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/citeall/citeall.tex @@ -0,0 +1,119 @@ +% !Mode:: "TeX:DE:UTF-8:Main" +% $UFDate: 2017-12-03 18:19:20 +0100 -- Commit: 4f26014 (HEAD, master) -- master$ +\documentclass[DIV=12]{scrartcl} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[english]{babel} +\usepackage[autostyle]{csquotes} +\usepackage{microtype} +\usepackage[style=authoryear-ibid,hyperref=false]{biblatex} +\usepackage{citeall} +\usepackage{fourier} +\usepackage{ydoc-desc,tabularx} +\usepackage{enumitem,needspace} +\makeatletter +\enitkv@key{enumitem}{compactsep}[true]{% + \divide\partopsep by 2\relax + \divide\topsep by 2\relax + \divide\itemsep by 2\relax + \divide\parsep by 2\relax} +\makeatother +\addbibresource{examples-citeall.bib} +\title{The \pkg{citeall} package, v1.4} +\author{Ulrike Fischer\thanks{fischer@troubleshooting-tex.de}} + +\begin{document} +\maketitle +\section{Changes} +Version 1.4 changed the code to adapt the package to the newest biblatex 3.9. + + +Version 1.3 added code to handle the @preamble field in a bib. Changed the definition of \verb+\sortlist+ to adapt to the newest biblatex. + +Version 1.2 adapts the package to biblatex 3.0 and correct some small bugs (e.g. unwanted spaces). +\section{Important} +\pkg{citeall} works only together with (newer versions of) \pkg{biblatex}. \pkg{biblatex} should be loaded before \pkg{citeall}. + +The package relies on some inner working of \pkg{biblatex}, so it could break with future or older versions (I tested with version 3.9). + +\section{The aim of the package} +The \pkg{citeall} package is a package to help to adapt and debug \pkg{biblatex} +citation styles. When adapting such a style one often needs to inspect the +output of examples. While it is easy with \verb+\nocite{*}+ to output all entries of a bib-file in the bibliography it is more troublesome to show citations. +So I wrote a (very) small package which allows me to show citations of all entries of the bib-files. + + + + +\section{The command} +The main command of the package is called like the package and has two optional arguments: + +\DescribeMacro\citeall[<list of commands>][<number of entries>] + +The second optional argument sets the number of entries of the .bib (more precisely the .bbl-file) printed by \cs{citeall}. By default everything is cited. + +The first optional argument is a comma separated list. +For each entrykey in the .bbl \cs{citeall} will loop through this list and pass to each item the entrykey as last argument. By default this list consist simply of a \cs{cite} command. The items don't need to be cite commands. As the examples show you can add text and other commands. + +\begin{itemize}[compactsep] +\item The last command should be something that can handle the entry key argument. +\item If there are brackets e.g. from optional argument of a \cs{cite} you should protect them with braces. +\item If there are commas you should protect them with braces. +\item If you want to insert a paragraph break, use \cs{endgraf} +\item Don't overdo the system. It is meant for simple debugging not for complicated citation printouts. +\end{itemize} + +\section{Some examples} +\verb+\citeall+ \begin{tabular}[t]{p{0.3\textwidth}} + \citeall + \end{tabular} +\verb+\citeall[][1]+ \begin{tabular}[t]{p{0.3\textwidth}} + \citeall[][1] + \end{tabular} + + +\noindent +\verb+\citeall[\fullcite]+\begin{tabular}[t]{p{0.7\textwidth}} + \citeall[\fullcite] + \end{tabular} + + +\noindent +\verb+\citeall[\cite[15],\cite]+\begin{tabular}[t]{p{0.7\textwidth}} + \citeall[\cite[15],\cite] + \end{tabular} + +\noindent +\verb+\citeall[Key: \textcolor{red},{\cite[15]},Test ibid: \cite]+ + +\begin{tabular}[t]{p{0.7\textwidth}} + \citeall[Key: \textcolor{red},{\cite[15]},Test ibid: \cite] +\end{tabular} + +\noindent +\verb+\citeall[{\cite[15]},\endgraf \cite]+ + +\begin{tabular}[t]{p{0.7\textwidth}} + \citeall[{\cite[15]},\endgraf \cite] +\end{tabular} + +\section{Printing the bibliography} +\cs{citeall} internally issues a \verb+\nocite{*}+, so \cs{printbibliography} will print all entries of the bib-file. Since version 1.1 \cs{citeall} adds all entries it cites to a category \enquote{citeall}. So if you restrict the number of citation with the second optional argument, you can also restrict the length of the bibliography with \verb+\printbibliography[category=citeall]+ + +\Needspace{8\baselineskip} +\section{Configuration} + +\DescribeMacro\citeallgroupseparator +\DescribeMacro\citeallseparator +\DescribeMacro\citeallfinentry +\DescribeMacro\citealldefaultcite + +By default the item of an entry are separated by a comma and a space. This can be changed by redefining \cs{citeallseparator}. The last item is finished by \cs{citeallfinentry} (default nothing). The entries are separated by a \cs{par}, this can be changed by redefining \cs{citeallgroupseparator}. +The default cite command used by \cs{citeall} is (\cs{cite}). This can be changed by redefining \cs{citealldefaultcite}. + +\DescribeMacro\citeallpreambledefinition + +.bib files can contain a special entry type \texttt{@preamble} which can contain definitions that should be executed at the begin of the bibliography, e.g. to ensure that some commands are defined. Such a field lead to a command \verb+\preamble{...}+ in the .bbl. When \cs{citeall} reads the .bbl it redefines \cs{preamble} to do nothing. You can change this behaviour by redefining this macro. It should always have one argument! + + +\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/citeall/examples-citeall.bib b/macros/latex/contrib/biblatex-contrib/citeall/examples-citeall.bib new file mode 100644 index 0000000000..b8e9808ce6 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/citeall/examples-citeall.bib @@ -0,0 +1,39 @@ +@ARTICLE{article2015, + AUTHOR = {Muster, Max}, + TITLE = {Title of Article}, + YEAR = {2015}, + JOURNAL = {Testjournal}, + volume = {1}, + number = {2}, + pages = {15}, + month = {2}, +} + + +@BOOK{book2015, + AUTHOR = {BookAuthor, Eva}, + EDITOR = {Editor, Ben}, + TITLE = {a book}, + YEAR = {2015}, + PUBLISHER = {Publisher}, +} + +@misc{fischer2015, + AUTHOR = {Fischer, Ulrike}, + TITLE = {The citeall package}, + YEAR = {2015}, +} + +@misc{fileproblem, + AUTHOR = {Unknown, Max}, + TITLE = {A curious file name}, + YEAR = {2015}, + URL = {{\"u}ber_gang.html} + } + +@article{itemize, +title={itemize}, +author={Itemize, Max}, +year={2015}, +note = {ipsum ipsum ipsum ipsum\begin{itemize}\item abc \item abc\end{itemize}}, +} |