TransWikia.com

Biblatex - url with "é" and code with percents signs

TeX - LaTeX Asked by tramberlimpe on July 15, 2021

I use lualatex. I write in french.

The compilation process is :

lualatex myfile.tex && makeindex myfile.idx && biber myfile.cbf && lualatex myfile.tex && lualatex myfile.tex

I have to cite a url in my work with the character "é" in it :

https://fr.scoutwiki.org/Cérémonial_de_la_totémisation

I have his reference in my file "biblio.bib" :

    @online{scoutopediaceretotem,
    keywords = {site},
    author = {{SCOUTOPEDIA, l'encyclopédie scoute !}},
    title ={Article consacré au cérémonial de totémisation},
    url ={https://fr.scoutwiki.org/Cérémonial_de_la_totémisation},
    urldate = {2020-03-31}
    }

I load my class with a cls file myfile.cls (with a lot of stuff in it).
The begining is this :

NeedsTeXFormat{LaTeX2e}
ProvidesClass{bpmemoire}[14/11/2018 v3.0]

% !TeX program = lualatex     
% !TeX encoding = utf8 
% !TeX spellcheck = french
%%                                                                        %%
%%============================== Document Class ==========================%%
%
LoadClass[12pt,a4paper,openany]{book} %%% pour le mémoire
%                                                                        %%
RequirePackage{ifluatex}
%%                                                                        %%
%%========================================================================%%

ifluatex 
RequirePackage{fontspec}
setsansfont{CMU Sans Serif}%{Arial}
setmainfont{CMU Serif}%{Times New Roman}
setmonofont{CMU Typewriter Text}%{Consolas}
defaultfontfeatures{Ligatures={TeX}}
RequirePackage{polyglossia}
setmainlanguage{french} %setdefaultlanguage{french} %  
setotherlanguages{english,russian,thai}
 
else
RequirePackage[utf8]{inputenc}
RequirePackage[T1]{fontenc}
RequirePackage[french]{babel}
fi

Everything works well, except for the url, who replace "é" or other
letters by codes (with percent signs) :

SCOUTOPEDIA « Article consacré au cérémonial de totémisation » url : https ://fr.scoutwi-
ki.org/C%C3%A9r%C3%A9monial_de_la_tot%C3%A9misation (visité le 31/03/2020).

I tried a lot of things with inputenc, polyglossia, {‘/e} instead of "é", etc. found on this site, but nothing works. Do you have an idea.
I know, that an url with "é" is a problèm, but I have to deal with it…

Thanks

One Answer

with lualatex this here should work:

documentclass{article}
usepackage[colorlinks]{hyperref}
usepackage{biblatex}

DeclareFieldFormat{url}{%
  mkbibacro{URL}addcolonspace
  href{#1}{nolinkurl{thefield{urlraw}}}}

DeclareFieldFormat{citeurl}{%
  href{#1}{nolinkurl{thefield{urlraw}}}}  
  
addbibresource{test.bib}
begin{document}
cite{scoutopediaceretotem}

citeurl{scoutopediaceretotem}

printbibliography

end{document}

enter image description here

You can change the style of the url with urlstyle, see the documentation of the url package. E.g. with urlstyle{rm} it will look like this:

enter image description here

Correct answer by Ulrike Fischer on July 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP