Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong usage of \detokenize breaks all commands and active characters in the text argument of \link etc. #79

Closed
komascript opened this issue Nov 19, 2021 · 1 comment · Fixed by #97
Labels
bug Something isn't working

Comments

@komascript
Copy link

You've defined \link as

\newcommand*{\link}[2][]{%
  \ifthenelse{\equal{#1}{}}%
    {\href{#2}{#2}}%
    {\href{#2}{\detokenize{#1}}}}

Similar for all other commands, that internally use \href.

With this, something like:

\newcommand*{\test}{This is an often used text.}
\link[\test]{http://some.link.invalid}

is not possible (or would result in the not expected string \test in the output).

Moreover with pdfLaTeX all non US-ASCII-characters will break and even TeX commands for accents umlauts etc. break, e.g.

\documentclass[a4paper,11pt]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}

\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{inputenc}
\usepackage[paper=a4paper,left=20mm,right=10mm,top=10mm,bottom=20mm]{geometry}
\firstname{John}
\familyname{Doe}

\begin{document}
\cvitem{10/2020 03/2021}{\textbf{Hilfreiche Links} \newline
\httplink[Göögle.com]{www.google.com} \newline
\httplink[Sehr hilfreich für Probleme]{golatex.de} \newline
\httplink[Sehr hilfreich f{\"u}r Probleme]{golatex.de} \newline
}
\end{document}

results in broken Umlauts like:

GÃűÃűgle.com
Sehr hilfreich fÃijr Probleme
Sehr hilfreich f{\"u}r Probleme

instead of the expected:

Göögle.com
Sehr hilfreich für Probleme
Sehr hilfreich für Probleme

IMO here the \detokenize does not make much sense, because the user would expect more, that commands work than that an underscore can be given by _ instead of the usual LaTeX underscore character command \_.

Moreover, it makes no sense, that \httplink[john_doe]{somewhere.invalid} should work but \httplink{somehwere.invalid/john_doe} doesn`t.

So please remove all these \detokenize. They break more than they help.

BTW: Can you please add some explicit information to the manual, that the mandatory argument of \httplink, \httpslink etc. should be without the prefix http:// etc. Because currently this information is only implicit from the example. Furthermore the command \weblink shown in the manual is not defined. Instead this is \link, which is not documented in the manual.

BTW: @ethuleau has already reported the issue here. But you've closed the whole issue without fixing it. So I've opened a new one.

@mefuller
Copy link
Member

ok, I'll work on this since we also have an issue being reported with the classic theme not compiling and this all started with a classic-only bug
Thanks for pointing out the drawbacks of detokenize @komascript - I didn't realize it would break things as you describe

paultcochrane added a commit to paultcochrane/moderncv that referenced this issue Mar 2, 2024
As pointed out in moderncv#79, the documented command `\weblink` is actually
implemented as `\link` (see also
https://github.com/moderncv/moderncv/blob/f3dd14ff621583bb6ce12d7e84a499f54cfa068f/moderncv.cls#L572).
This change thus fixes the docs and reduces confusion for users who copy
this code from the documented example in the manual.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants