diff --git a/rapport_francais/preambule_biblatex.tex b/rapport_francais/preambule_biblatex.tex new file mode 100644 index 0000000000000000000000000000000000000000..6c8783e25d591bb11fca451e41f8a54f9a7c8bd0 --- /dev/null +++ b/rapport_francais/preambule_biblatex.tex @@ -0,0 +1,51 @@ +% Gestion de la bibliographie avec biblatex +\usepackage[ + backend=bibtex, + style=authoryear, + firstinits=true, + natbib=true +]{biblatex} +\addbibresource{biblio.bib} +%Line breaks of long URLs in biblatex bibliography http://tex.stackexchange.com/a/134281 +\setcounter{biburllcpenalty}{7000} +\setcounter{biburlucpenalty}{8000} +% Line break for DOI http://tex.stackexchange.com/a/50958/124910 +\setcounter{biburlnumpenalty}{100} + + +% hyperlink name with biblatex authoryear +% https://tex.stackexchange.com/a/27107/124910 + +\DeclareFieldFormat{citehyperref}{% + \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links + \bibhyperref{#1}} + +\DeclareFieldFormat{textcitehyperref}{% + \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links + \bibhyperref{% + #1% + \ifbool{cbx:parens} + {\bibcloseparen\global\boolfalse{cbx:parens}} + {}}} + +\savebibmacro{cite} +\savebibmacro{textcite} + +\renewbibmacro*{cite}{% + \printtext[citehyperref]{% + \restorebibmacro{cite}% + \usebibmacro{cite}}} + +\renewbibmacro*{textcite}{% + \ifboolexpr{ + ( not test {\iffieldundef{prenote}} and + test {\ifnumequal{\value{citecount}}{1}} ) + or + ( not test {\iffieldundef{postnote}} and + test {\ifnumequal{\value{citecount}}{\value{citetotal}}} ) + } + {\DeclareFieldAlias{textcitehyperref}{noformat}} + {}% + \printtext[textcitehyperref]{% + \restorebibmacro{textcite}% + \usebibmacro{textcite}}} \ No newline at end of file diff --git a/rapport_francais/preambule_rapport_francais.tex b/rapport_francais/preambule_rapport_francais.tex index 1709d09acd4e1eff4468b42b9cf1f4c2f6540f66..d283e7178a52c1ed2406d3547c5d2c40c8f5dad3 100644 --- a/rapport_francais/preambule_rapport_francais.tex +++ b/rapport_francais/preambule_rapport_francais.tex @@ -21,18 +21,7 @@ \renewcommand{\mkbegdispquote}[2]{\itshape} % Gestion de la bibliographie avec biblatex -\usepackage[ - backend=bibtex, - style=authoryear, - firstinits=true, - natbib=true -]{biblatex} -\addbibresource{biblio.bib} -%Line breaks of long URLs in biblatex bibliography http://tex.stackexchange.com/a/134281 -\setcounter{biburllcpenalty}{7000} -\setcounter{biburlucpenalty}{8000} -% Line break for DOI http://tex.stackexchange.com/a/50958/124910 -\setcounter{biburlnumpenalty}{100} +\input{rapport_francais/preambule_biblatex} % Extra space for numbered titles in table of contents