1

This piece of code should create a document with a link to https://fr.wikipedia.org/wiki/Alignement_en_mémoire

Instead of that the link goes to https://fr.wikipedia.org/wiki/Alignement_en_mémoire

Why is that? How to solve the problem?

Edited : The percent encoding gives a working link but indent-region in emacs (on OS X) gives now false indentation and the log file is showing a problem.

% Pour XeTeX
\XeTeXdefaultencoding utf-8

\documentclass[10pt,svgnames]{beamer} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{french} \usepackage{csquotes} % gestion des guillemets (pas sûr que cela reste indispensable avec polyglossia) \definecolor{links}{HTML}{2A1B81} \hypersetup{colorlinks,linkcolor=,urlcolor=links}

\begin{document} \begin{frame} \begin{itemize} \item Pour des raisons d'\href{https://fr.wikipedia.org/wiki/Alignement_en_mémoire}{alignement en mémoire}, le format BMP a recours au padding.

\item Pour des raisons d'\href{https://fr.wikipedia.org/wiki/Alignement_en_m%C3%A9moire}{alignement en mémoire}, le format BMP a recours au padding. \end{itemize} \end{frame} \end{document}

The beginning and the end of the log file:

This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019) (preloaded format=xelatex 2020.2.18)  19 JUN 2020 09:32
entering extended mode
 restricted \write18 enabled.
 file:line:error style messages enabled.
 %&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/local/texlive/2019/texmf-dist/tex/latex/beamer/beamer.cls
Document Class: beamer 2019/09/29 v3.57 A class for typesetting presentations
(/usr/local/texlive/2019/texmf-dist/tex/latex/beamer/beamerbasemodes.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count163
)
\beamer@tempbox=\box45
\beamer@tempcount=\count164
\c@beamerpauses=\count165

(/usr/local/texlive/2019/texmf-dist/tex/latex/beamer/beamerbasedecode.sty \beamer@slideinframe=\count166 \beamer@minimum=\count167 \beamer@decode@box=\box46 ) \beamer@commentbox=\box47 \beamer@modecount=\count168 ) (/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/ifpdf.sty Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.

(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/iftex.sty Package: iftex 2019/11/07 v1.0c TeX engine tests ))


(/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator-basic-dicti onary-English.dict Dictionary: translator-basic-dictionary, Language: English ) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator-bibliograph y-dictionary-English.dict Dictionary: translator-bibliography-dictionary, Language: English ) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator-environment -dictionary-English.dict Dictionary: translator-environment-dictionary, Language: English ) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator-months-dict ionary-English.dict Dictionary: translator-months-dictionary, Language: English ) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator-numbers-dic tionary-English.dict Dictionary: translator-numbers-dictionary, Language: English ) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator-theorem-dic tionary-English.dict Dictionary: translator-theorem-dictionary, Language: English )

Package fontspec Info: Adjusting the maths setup (use [no-math] to avoid (fontspec) this).

\symlegacymaths=\mathgroup8 LaTeX Font Info: Overwriting symbol font legacymaths' in versionbold' (Font) OT1/cmr/m/n --> OT1/cmr/bx/n on input line 12. LaTeX Font Info: Redeclaring math accent \acute on input line 12. LaTeX Font Info: Redeclaring math accent \grave on input line 12. LaTeX Font Info: Redeclaring math accent \ddot on input line 12. LaTeX Font Info: Redeclaring math accent \tilde on input line 12. LaTeX Font Info: Redeclaring math accent \bar on input line 12. LaTeX Font Info: Redeclaring math accent \breve on input line 12. LaTeX Font Info: Redeclaring math accent \check on input line 12. LaTeX Font Info: Redeclaring math accent \hat on input line 12. LaTeX Font Info: Redeclaring math accent \dot on input line 12. LaTeX Font Info: Redeclaring math accent \mathring on input line 12. LaTeX Font Info: Redeclaring math symbol \Gamma on input line 12. LaTeX Font Info: Redeclaring math symbol \Delta on input line 12. LaTeX Font Info: Redeclaring math symbol \Theta on input line 12. LaTeX Font Info: Redeclaring math symbol \Lambda on input line 12. LaTeX Font Info: Redeclaring math symbol \Xi on input line 12. LaTeX Font Info: Redeclaring math symbol \Pi on input line 12. LaTeX Font Info: Redeclaring math symbol \Sigma on input line 12. LaTeX Font Info: Redeclaring math symbol \Upsilon on input line 12. LaTeX Font Info: Redeclaring math symbol \Phi on input line 12. LaTeX Font Info: Redeclaring math symbol \Psi on input line 12. LaTeX Font Info: Redeclaring math symbol \Omega on input line 12. LaTeX Font Info: Redeclaring math symbol \mathdollar on input line 12. LaTeX Font Info: Redeclaring symbol font operators' on input line 12. LaTeX Font Info: EncodingOT1' has changed to TU' for symbol font (Font)operators' in the math version normal' on input line 12. LaTeX Font Info: Overwriting symbol fontoperators' in version normal' (Font) OT1/cmss/m/n --&gt; TU/lmr/m/n on input line 12. LaTeX Font Info: EncodingOT1' has changed to TU' for symbol font (Font)operators' in the math version bold' on input line 12. LaTeX Font Info: Overwriting symbol fontoperators' in version bold' (Font) OT1/cmss/b/n --&gt; TU/lmr/m/n on input line 12. LaTeX Font Info: Overwriting symbol fontoperators' in version normal' (Font) TU/lmr/m/n --&gt; TU/lmr/m/n on input line 12. LaTeX Font Info: Redeclaring math alphabet \mathrm on input line 12. LaTeX Font Info: Overwriting math alphabet\mathit' in version normal' (Font) TU/lmss/m/it --&gt; TU/lmr/m/it on input line 12. LaTeX Font Info: Overwriting math alphabet\mathbf' in version normal' (Font) TU/lmss/b/n --&gt; TU/lmr/b/n on input line 12. LaTeX Font Info: Overwriting math alphabet\mathsf' in version normal' (Font) TU/lmss/m/n --&gt; TU/lmss/m/n on input line 12. LaTeX Font Info: Overwriting math alphabet\mathtt' in version normal' (Font) TU/lmtt/m/n --&gt; TU/lmtt/m/n on input line 12. LaTeX Font Info: Overwriting symbol fontoperators' in version bold' (Font) TU/lmr/m/n --&gt; TU/lmr/b/n on input line 12. LaTeX Font Info: Overwriting math alphabet\mathit' in version bold' (Font) TU/lmss/b/it --&gt; TU/lmr/b/it on input line 12. LaTeX Font Info: Overwriting math alphabet\mathsf' in version bold' (Font) TU/lmss/b/n --&gt; TU/lmss/b/n on input line 12. LaTeX Font Info: Overwriting math alphabet\mathtt' in version `bold' (Font) TU/lmtt/b/n --> TU/lmtt/b/n on input line 12. LaTeX Info: Redefining \rmfamily on input line 12. LaTeX Info: Redefining \sffamily on input line 12. LaTeX Info: Redefining \ttfamily on input line 12. (./test.nav)) Runaway argument? \begin {itemize} \item Pour des raisons d'\href {https://fr.wikipedia\ETC. ! File ended while scanning use of \frame. <inserted text> \par <*> test.tex

I suspect you have forgotten a }', causing me to read past where you wanted me to stop. I'll try to recover; but if the error is serious, you'd better typeE' or `X' now and fix your file.

! Emergency stop. <*> test.tex

*** (job aborted, no legal \end found)

Here is how much of TeX's memory you used: 24768 strings out of 479819 500728 string characters out of 5893613 811726 words of memory out of 5000000 41412 multiletter control sequences out of 15000+600000 532730 words of font info for 29 fonts, out of 8000000 for 9000 1348 hyphenation exceptions out of 8191 58i,4n,67p,792b,289s stack positions out of 5000i,500n,10000p,200000b,80000s No pages of output.

  • works fine for me. Is your system up-to-date? – Ulrike Fischer Jun 18 '20 at 21:54
  • 1
    Related: https://tex.stackexchange.com/a/132700. Short answer: use percent encoding \href{https://www.wikiwand.com/fr/Alignement_en_m%C3%A9moire}{...}. – muzimuzhi Z Jun 18 '20 at 22:06
  • I can reproduce your problem with xelatex/lualatex and pdf reader Skim or TeXstudio's internal pdf viewer on macOS, but Adobe Reader works ok. I also checked the url stored in pdf, it is {'/S': '/URI', '/URI': 'https://www.wikiwand.com/fr/Alignement_en_mémoire'}. So the stored url is probably wrong. – muzimuzhi Z Jun 18 '20 at 22:09
  • I can't reproduce the problem in xelatex on Windows: All of Acrobat Reader DC, SumatraPDF, TeXstudio, TeXworks show correct accent in the link. – Akira Kakuto Jun 18 '20 at 22:34
  • I can find the correct /A<</S/URI/URI(https://fr.wikipedia.org/wiki/Alignement_en_mémoire)>> in both of xdv and pdf. – Akira Kakuto Jun 18 '20 at 23:22
  • @muzimuzhi you led me to the solution so thank you – Raoul HATTERER Jun 19 '20 at 08:42
  • @muzimuzhiZ I get the correct URI(https://fr.wikipedia.org/wiki/Alignement_en_m\303\251moire). Is your tex system up-to-date? – Ulrike Fischer Jun 19 '20 at 09:12
  • @UlrikeFischer I add an answer to post what I get. – muzimuzhi Z Jun 19 '20 at 13:07
  • 1
    You get the error from the percent encoding as \href can't change the catcode in a beamer frame. You should use \begin{frame}[fragile]. – Ulrike Fischer Jun 19 '20 at 13:17
  • @Ulrike Fischer \begin{frame}[fragile] doesn't solve the indentation problem with indent-region in emacs. Also what's follow the first percent is considered as a comment. So I need to add the backslashs. – Raoul HATTERER Jun 20 '20 at 10:09

2 Answers2

1

There might be some bug in macOS.

% url-test.tex
\documentclass{article}
\usepackage{hyperref}

\begin{document} \href{https://www.wikiwand.com/fr/Alignement_en_mémoire}{alignement en mémoire} \end{document}

Run the above example with

xelatex -no-pdf url-test.tex
dviasm url-test.xdv > url-test.dviasm
xdvipdfmx -C 0x40 url-test.xdv

then

  • the .dviasm file contains URI(https://www.wikiwand.com/fr/Alignement_en_mémoire), and
  • the .pdf file contains URI(https://www.wikiwand.com/fr/Alignement_en_m\303\251moire).

Both are right.

If I click the url in TeXstudio's internal pdf viewer or Skim.app, then both of them open https://www.wikiwand.com/fr/Alignement_en_m%EF%BF%BDmoire, which is wrong. Adobe Reader opens the right url, however.

I am on macOS 10.15.5, with texlive 2020 and latest latex packages.

muzimuzhi Z
  • 26,474
0

The percent coding solve the problem without additional errors if we escape the percentage symbols with a backslash.

% Pour XeTeX
\XeTeXdefaultencoding utf-8

\documentclass[10pt,svgnames]{beamer} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{french} \usepackage{csquotes} % gestion des guillemets (pas sûr que cela reste indispensable avec polyglossia) \definecolor{links}{HTML}{2A1B81} \hypersetup{colorlinks,linkcolor=,urlcolor=links}

\begin{document} \begin{frame} \begin{itemize} \item Pour des raisons d'\href{https://fr.wikipedia.org/wiki/Alignement_en_mémoire}{alignement en mémoire}, le format BMP a recours au padding.

\item Pour des raisons d'\href{https://fr.wikipedia.org/wiki/Alignement_en_m%C3%A9moire}{alignement en mémoire}, le format BMP a recours au padding. \end{itemize} \end{frame} \end{document}

So the procedure is to copy the address from firefox to get the percent encoding and then add backslashs.

  • Percent encoding is certainly one way to resolve it. But it should also work without it. Can you show your log-file? – Ulrike Fischer Jun 19 '20 at 09:13
  • I tested by XeTeX 0.999992 (TeX Live 2020). Raoul HATTERER is using XeTeX 0.999991 (TeX Live 2019). I don't know but there may be differences in the engine or/and packages. – Akira Kakuto Jun 19 '20 at 09:30
  • @AkiraKakuto I tried on texlive 2019 and it worked fine too. Imho muzimuzhi is right and it is a mac os problem, its pdf viewer is faulty in various places. – Ulrike Fischer Jun 19 '20 at 13:16
  • @AkiraKakuto not related to this question, but if you have some time, could you look here https://tex.stackexchange.com/q/550325/2388? – Ulrike Fischer Jun 20 '20 at 20:40