Le 26/01/2025 à 12:18, Eric Guichard a écrit :
- Dans votre première version, j’ai réussi à intégrer des crochets à la
place des parenthèses:
[…]
Mais cette modification n’est pas transmise dans la biblio finale:
[…]
- Cette modification ne fonctionne pas avec votre version plus complète:
Il me semble que vous n’aviez pas indiqué ce besoin de remplacement des
parenthèses par des crochets dans votre demande initiale.
Ci-dessous vous trouverez une version qui semble marcher comme vous le
voulez… au moins pour les exemples donnés. Mais je ne garantis pas que
ça marchera correctement pour tous les usages de ‘biblatex’: je n’ai pas
testé l’ajout de notes, les citations en note de bas de page, les
références complètes dans le texte, etc.
En fait, il semblerait utile de définir carrément un nouveau style
complet de citation pour répondre parfaitement à votre besoin.
\documentclass{article}
\usepackage[paperwidth =170mm, paperheight= 260mm,left=2cm, right=2cm,
top=2cm, bottom=3cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\begin{filecontents*}[force]{\jobname.bib}
@article{BerJ24sept92,
author = {Bernoulli, Johann},
title={{Lettre à Varignon}}, journal={Les Annales imaginaires},
volume=“2”, year=“1692”, keywords=“Ber” }
@book{Bougain,
author=“de Bougainville, Louis Antoine”,
title=“{Traité de calcul intégral, pour servir\ldots}”,
address=“Paris”, publisher=“Guérin et Delatour”,
year=“1754”, keywords=“18esiecle”}
@book{Wolff1716, author=“Wolff, Christian”,
title=“Mathematisches lexicon”, address=“Leipzig”,
year=“1716”, publisher=“Anonyme”,
keywords=“18esiecle” }
@book{Appel,
title=“{The Scientific Revolution}”,
editor=“Appel, Wilbur”, year=“1999”,
publisher=“Routledge”, keywords=“20e”}
@book{Test,
title=“{Un test}”,
editor=“Test, Louis”, year=“1950”,
publisher=“Un éditeur”, keywords=“20e”,
shorthand=“R2-TestShorthand 1950”,
}
\end{filecontents*}
\usepackage[colorlinks]{hyperref}
\usepackage{csquotes,nameref}
%\usepackage[style=alphabetic,defernumbers,backend=biber]{biblatex}
\usepackage[style=authoryear,defernumbers,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
%\DeclareFieldFormat{brackets}{\mkbibparens[#1]}
\newbibmacro*{cite:labeldate+extradate:noref}{%
\iffieldundef{labelyear}%
{}%
{\printtext{\printlabeldateextra}}%
}
\newbibmacro*{cite:shorthand:noref}{%
\printtext{\printfield{shorthand}}}
\newbibmacro*{ref:label-with-prefix}{%
\printtext[brackets]{%
\iffieldundef{shorthand}%
{%
\printfield{labelprefix}%
\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}
\usebibmacro{cite:labeldate+extradate:noref}}
{\usebibmacro{cite:shorthand:noref}}%
}
}
\defbibenvironment{bibliography}
{\list
{\usebibmacro{ref:label-with-prefix}\space}
{\setlength{\leftmargin}{1cm}%
\setlength{\labelwidth}{0pt}%
\setlength{\labelsep}{0pt}%
\setlength{\itemindent}{-\leftmargin}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item}
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printfield{labelprefix}\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%q
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}%
}
\renewbibmacro*{textcite}{%
\ifnameundef{labelname}
{\iffieldundef{shorthand}
{\usebibmacro{cite:label}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nonameyeardelim}\bibopenparen}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}}
{\printfield{labelprefix}\printnames{labelname}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nameyeardelim}\bibopenparen}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{citeyear}}}
\DeclareCiteCommand{\parencite}[\mkbibbrackets]
{\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\parencite}[\mkbibbrackets]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{citeyear}}
{\multicitedelim}
{\usebibmacro{postnote}}
\begin{document}
\thispagestyle{empty}
Quelques citations hors texte \parencite{BerJ24sept92, Bougain,
Wolff1716, Appel, Test}.
Quelques citations: \textcite{BerJ24sept92, Bougain, Wolff1716, Appel,
Test}.
\newrefcontext[labelprefix={B-}]
\printbibliography[heading=subbibliography,keyword=Ber,title=Bernoulli]
\newrefcontext[labelprefix={R1-}]
\printbibliography[heading=subbibliography,keyword=18esiecle,title=Ses
contemporains]
\newrefcontext[labelprefix={R2-}]
\printbibliography[heading=subbibliography,keyword=20e,title=Autres]
\end{document}
Cordialement,
Paul Gaborit