%%%%%% BIBLATEX-SWISS-LEGAL-BASE : CITATIONS %%%%%%% % Copyright 2013 Adrien Vion % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status 'maintained'. % % The Current Maintainer of this work is Adrien Vion. % Encoding of this file: UTF-8. Code is ASCII compatible. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ProvidesFile{biblatex-swiss-legal-base.cbx}[2013/07/23 v1.1.1 alpha] \RequireBibliographyStyle{biblatex-swiss-legal-base} %%%%%%%%%%% FORMATAGE DES DONNEES %%%%%%%%%%%%% % Format de postnote (pour les commentaires) \DeclareFieldFormat[customa]{postnote}{\ifnumeral{#1}{\parN #1}{\ifnumerals{#1}{\parNN #1}{#1}}} % Dans les commentaires, le champ postnote est automatiquement reformaté avec les n° au lieu de p. Si l'on veut N ou NN à la place, il faut modifier les strings paragraph et paragraphs dans le fichier .lbx %%%%%%%%%%% MACROS %%%%%%%%%%%%% % Macros général de citation \newbibmacro*{cite}% {% \iffieldequalstr{entrytype}{book}% {\usebibmacro{book:cite}}% {\iffieldequalstr{entrytype}{thesis}% {\usebibmacro{thesis:cite}}% {\iffieldequalstr{entrytype}{inbook}% {\usebibmacro{inbook:cite}}% {\iffieldequalstr{entrytype}{article}% {\usebibmacro{article:cite}}% {\iffieldequalstr{entrytype}{commentary}% {\usebibmacro{commentary:cite}}% {\iffieldequalstr{entrytype}{customa}% {\usebibmacro{customa:cite}}% {\iffieldequalstr{entrytype}{jurisdiction}% {\usebibmacro{jurisdiction:cite}}% {\iffieldequalstr{entrytype}{customb}% {\usebibmacro{customb:cite}}% {\iffieldequalstr{entrytype}{online}% {\usebibmacro{online:cite}}% {\iffieldequalstr{entrytype}{legislation}% {\usebibmacro{legislation:cite}}% {\usebibmacro{book:cite}}% }% }% }% }% }% }% }% }% }% }% \newbibmacro*{fullcite}% {% \iffieldequalstr{entrytype}{book}% {\usebibmacro{book:full}}% {\iffieldequalstr{entrytype}{thesis}% {\usebibmacro{thesis:full}}% {\iffieldequalstr{entrytype}{inbook}% {\usebibmacro{inbook:full}}% {\iffieldequalstr{entrytype}{article}% {\usebibmacro{article:full}}% {\iffieldequalstr{entrytype}{commentary}% {\usebibmacro{commentary:full}}% {\iffieldequalstr{entrytype}{customa}% {\usebibmacro{customa:full}}% {\iffieldequalstr{entrytype}{jurisdiction}% {\usebibmacro{jurisdiction:full}}% {\iffieldequalstr{entrytype}{customb}% {\usebibmacro{customb:full}}% {\iffieldequalstr{entrytype}{online}% {\usebibmacro{online:full}}% {\iffieldequalstr{entrytype}{legislation}% {\usebibmacro{legislation:full}}% {\usebibmacro{book:full}}% }% }% }% }% }% }% }% }% }% }% \newbibmacro{citetitle}{\printfield{title}} %%%%%%%%%%% CORRECTION D'UN BUG (POSTNOTE DANS LES TYPES NON STANDARD) %%%%%%%%%%% \AtEveryCitekey{% \ifboolexpr{% test {\iffieldequalstr{entrytype}{online}}% or test {\iffieldequalstr{entrytype}{legislation}}% or test {\iffieldequalstr{entrytype}{jurisdiction}}% or test {\iffieldequalstr{entrytype}{customb}}% and not test {\iffieldundef{postnote}} }% {\renewbibmacro{postnote}{\postnotedelim\printfield{postnote}}} {}% } %%%%%%%%%%% COMMANDES DE CITATION %%%%%%%%%%% \DeclareCiteCommand{\footcite}[\mkbibfootnote]% {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand{\textcite}[]% {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand{\cite}[]% {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand{\parencite}[\mkbibparens]% {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand{\fullcite}% {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{fullcite}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand{\citetitle}% {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{citetitle}}% {\multicitedelim}% {\usebibmacro{postnote}}% %%%%%%%%%%% COMMANDES SPECIFIQUES POUR LES CITATIONS DE JURISPRUDENCE (expérimental) %%%%%%%%%%% % Commandes pour l'utilisateur \usepackage{xargs} \newcommandx{\jdcite}[5][1,2,3,4]{% \ifdef{\jurisdiction@prenote}% {\renewcommand{\jurisdiction@prenote}{#1}}% Actualisation de la commande \jurisdiction@prenote avec le contenu du champ #1 {\newcommand{\jurisdiction@prenote}{#1}}% \ifdef{\jurisdiction@recital}% {\renewcommand{\jurisdiction@recital}{#3}}% Actualisation de la commande \jurisdiction@recital avec le contenu du champ #3 {\newcommand{\jurisdiction@recital}{#3}}% \ifdef{\jurisdiction@page}% {\renewcommand{\jurisdiction@page}{#4}}% Actualisation de la commande \jurisdiction@page avec le contenu du champ #4 {\newcommand{\jurisdiction@page}{#4}}% \jurisdiction@cite% [#1]% [#2]% {#5}% } %%% UTILISER ifstrempty pour savoir si un argument est vide => si oui, le redéfinir avec l'argument suivant %%% le problème des multicitecommands subsiste. il faudrait essayer de faire un test \value{multicitecount}<{multicitetotal}. Mais ça ne résout de loin pas tous les problèmes. % Interface avec biblatex \DeclareCiteCommand{\jurisdiction@cite}[]% {% PRECODE \usebibmacro{prenote}% \ifcsempty{jurisdiction@prenote}% test pour savoir s'il y a quelque chose dans le champ optionnel prenote. {\bibsentence}% s'il n'y a rien, le bibstring (p. ex. Arrêt précité) suivant est capitalisé {\midsentence}% s'il y a quelque chose, le bibstring suivant commence par une minuscule }% {% LOOPCODE \usebibmacro{citeindex}% \iffieldequalstr{entrytype}{jurisdiction}% test pour être sur qu'on est dans une fiche @jurisdiction {\usebibmacro{jurisdiction@details}}% si c'est bien le cas, on utilise le macro jurisdiction@details {% <= Un message d'erreur apparaît si on est pas dans une fiche @jurisdiction \PackageError{biblatex-swiss-legal}{Use the \protect\jdcite\space command \MessageBreak ONLY for 'jurisdiction' entry types!}{Replace the entrykey by an \MessageBreak entrykey corresponding to a 'jurisdiction' entry.}% }% }% {\multicitedelim}% SEPCODE {\usebibmacro{postnote}}% POSTCODE \DeclareMultiCiteCommand{\jurisdiction@cites}{\jurisdiction@cite}{\multicitedelim} %% Macro détaillée \newbibmacro{jurisdiction@details}{% \ifciteibid% Test pour savoir si l'arrêt vient d'être cité {\ifcsempty{jurisdiction@recital}% Si oui, on se demande si un numéro de considérant a été défini {\usebibmacro{ibid}}% Si ça n'est pas le cas, le bibstring lastruling uniqument s'imprime {\usebibmacro{ibid}\addcomma\addspace\bibsstring{recital}\addspace\jurisdiction@recital% Sinon, impression du bibstring + considérant + év. page. \ifcsempty{jurisdiction@page}% {}% {\addspace\mkbibparens{\jurisdiction@page}}% }% }% {% \printfield{usera}% \iffieldundef{userb}% {}% {\newunit\printfield{userb}}% \iffieldundef{userc}% {}% {\newunit\printfield{userc}}% \iffieldundef{userd}% {}% {\newunit\printfield{userd}}% \iffieldequalstr{usera}{ATF}% <= La date ne s'imprime que s'il ne s'agit pas d'un ATF. {}% {\iffieldundef{origyear}% {}% {\addspace\mkbibparens{\printfield{origday}\adddot\printfield{origmonth}\adddot\printfield{origyear}}}% }% \iftoggle{bbx:jstitles}% <= Option pour activer / désactiver la mention du titre dans les citations d'arrêts {\iffieldundef{title}% {}% {\newunit% \printfield{title}}% }% {}% \iflistundef{language}% {}% {\addspace\mkbibbrackets{\printlist{language}}}% \ifcsempty{jurisdiction@recital}% {}% {% \addcomma\addspace\bibsstring{recital}\addspace\jurisdiction@recital% \ifcsempty{jurisdiction@page}% {}% {\addspace\mkbibparens{\jurisdiction@page}}% }% \iffieldequalstr{howpublished}{publ} {\newunit}% {\newblock}% \iffieldbibstring{howpublished}% {\bibsstring{\thefield{howpublished}}}% Dans les citations, on va toujours utiliser le string abrégé. {\printfield{howpublished}}% \newunit% \iffieldbibstring{journaltitle} {% aa) s'il existe un string pour le nom de la revue \bibsstring{\thefield{journaltitle}}% }% {% bb) s'il n'existe pas de string pour le nom de la revue \printfield{journaltitle}% }% \newunit% \usebibmacro{date}% \newunit% \printfield{volume}% \newunit% \iffieldundef{number}% {}% {\bibsstring{number}\addnbthinspace\printfield{number}}% \newunit% \printfield{pages}% }% } %%%%%%%%%%% INDEXATION AUTOMATIQUE DE LA JURISPRUDENCE (pour l'instant désactivé) %%%%%%%%%%% % Une alternative pourrait consister à utiliser l'option indexing de biblatex, à essayer. %\newcommand{\printjurisdictionindex}{% %\printindex{jurisdictionfed}{Arrêts fédéraux} %\printindex{jurisdictioncnt}{Arrêts cantonaux} %\printindex{jurisdictionfgn}{Arrêts étrangers} %} %\iftoggle{bbx:jurisdictionindex}% %{% %\usepackage{multind} %\usepackage{xstring} %\makeindex{jurisdictionfed}% %\makeindex{jurisdictioncnt}% %\makeindex{jurisdictionfgn}% %\AtEveryCitekey{% % \ifboolexpr{% %% test (\iffieldequalstr{usera}{ataf})% %% or% % test (\iffieldequalstr{usera}{atf})% %% or% %% test (\iffieldequalstr{usera}{atfb})% %% or% %% test (\iffieldequalstr{usera}{atfnp})% %% or% %% test (\iffieldequalstr{usera}{atfpp})% %% or% %% test (\iffieldequalstr{usera}{atpf})% %% or% %% test (\iffieldequalstr{usera}{bge})% % } % {% Si arrêt fédéral % \iffieldequalstr{entrytype}{jurisdiction}% % {\StrLen{\thefield{userb}}[\nombreATF]% % \ifdefstring{\nombreATF}{1} % {\index{jurisdictionfed}{ATF 1@\thefield{userb}\addspace\thefield{userc}\addspace\thefield{userd}}} % {\ifdefstring{\nombreATF}{2} % {\index{jurisdictionfed}{ATF 10@\thefield{userb}\addspace\thefield{userc}\addspace\thefield{userd}}} % {\ifdefstring{\nombreATF}{3} % {\index{jurisdictionfed}{ATF 100@\thefield{userb}\addspace\thefield{userc}\addspace\thefield{userd}}} % {} % } % } %}{}}{}}} % \index{jurisdictionfed}{ATF\addspace% % \thefield{userb}\addspace\thefield{userc}\addspace\thefield{userd}}} % {} % } % {}% Sinon %} % % \iffieldequalstr{entrytype}{jurisdiction}% % {\index{jurisdiction}{[\thefield{origyear}-\thefield{origmonth}-\thefield{origday}] \thefield{usera}\addspace\thefield{userb}\addspace\thefield{userc}\addspace\thefield{userd}}}% % {% % \iffieldequalstr{entrytype}{customb}% % {\index{jurisdiction}{[\thefield{origyear}-\thefield{origmonth}-\thefield{origday}] \thefield{usera}\addspace\thefield{userb}\addspace\thefield{userc}\addspace\thefield{userd}!-- consid.\addspace\thefield{usere}}}% % {}% % }% % % }% %}% %{}% % %%%%%%%%%%% AJOUT DES REVUES ABREGÉES AUX ABREVIATIONS %%% (essais de code, ne fonctionnant pas) % %\AtEveryCitekey{% %}% %\iftoggle{bbx:abrjournal}% % {\nomenclature{\textt{}}{oui ça marche}}% % {}% %}% % %\biblstring{\thefield{journaltitle}} %%% %\newcommand{\abreviation}[2]{ % %\AtEveryCitekey{% %\iffieldundef{journaltitle}% %{}% %{% %%\renewcommand{\titreessai}{\thefield{journaltitle}}% %%\xdef\titrecourt{\titreessai} %%\xdef\abrintershort{\titrecourt} %%\edef{\titreessai}{\thefield{journaltitle}}% %%\ifdef{\abrintershort}% %% {\renewcommand{\abrintershort}{}% %% {\newcommand{\abrintershort}{\bibsstring{\thefield{journaltitle}}}}% %%\ifdef{\abrinterlong}% %% {\renewcommand{\abrinterlong}{\biblstring{\thefield{journaltitle}}}}% %% {\newcommand{\abrinterlong}{\biblstring{\thefield{journaltitle}}}}% %%\@expandtwoargs\nomenclature{\abrintershort}{TEST}% %% %\newcommand{\testXIV}[2]{\nomenclature{#1}{#2}}% %\expandafter\testXIV{\thefield{journaltitle}}{Test}% %% %}% %} %\newcommand{\abrintershort}[1]{\bibsstring{\thefield{journaltitle}}} %\newcommand{\abrinterlong}[1]{\biblstring{\thefield{journaltitle}}} \endinput