Repository navigation
unicode question: German Umlauts in anchor ids #12077
|
Hi all, I am seeking for a little push in the right direction: I have a bilingual project where english and german md files are converted into pdf using a dockerized pandoc. English works flawlessly. However when compiling the german files all the Umlauts (ä, ö, ü, ß and the likes) are resulting in broken links/hyper reference undefined. The md files are proper utf-8. Where in the compile process are the anchors converted to some uri encoded things and how can I solve/prevent this? Example: md file: console output: The pdfs are being built but without those links. Thanks a million for any hint. |
Replies: 3 comments 1 reply
|
The A concrete way to avoid depending on German heading-slug generation is to give the heading an explicit ## Undo/Redo -- Rückgängig machen/Wiederholen {#undo-redo}
Wiederholen, siehe [Undo/Redo -- Rückgängig machen/Wiederholen](#undo-redo).This assumes Pandoc Markdown with To establish the original cause, inspect the intermediate forms inside the same Docker image, with pandoc -f markdown -t native input.md
pandoc -f markdown -s -t latex input.md -o debug.texCompare the heading's identifier with the link target, then its
|
|
This is a real asymmetry, not a Unicode-input problem, and there's a specific mechanism behind it. What the warning tells you. The toLabel z = go `fmap` stringToLaTeX URLString z
where
go = T.concatMap $ \x -> case x of
_ | (isLetter x || isDigit x) && isAscii x -> T.singleton x
| T.any (== x) "_-+=:;." -> T.singleton x
| otherwise -> T.pack $ "ux" <> showHex (ord x) ""Note the Why the two sides can disagree — the normalisation detail. if writerPreferAscii opts then Normalize.normalize Normalize.NFD zs else zsSo Both the heading's
How to pin it down in one command — compare the normalisation of the two strings directly: python3 - <<'EOF'
import unicodedata as u
a = "undoredo----rückgängig-machenwiederholen" # from your heading
b = "undoredo----rückgängig-machenwiederholen" # from your link, copy-pasted separately
print("heading NFC?", u.is_normalized("NFC", a), "| link NFC?", u.is_normalized("NFC", b))
print("equal after NFC:", u.normalize("NFC", a) == u.normalize("NFC", b))
EOFIf those come back equal, look at the generated Practical fixes, in order of robustness:
The |
|
One thing to check before treating Drako01's explicit-identifier suggestion is correct and is the right answer for your document. But if the warning you quoted came from a different link than the one you showed (the If the failing link is in a bibliography or a generated index, explicit ids won't reach it — those get their labels from |
The
uxfc/uxe4spelling is LaTeX-label escaping, not evidence that your UTF-8 input wasmisread. Pandoc's
toLabelfunctionencodes non-ASCII characters that way. Both generated labels and internal link targets use that
transformation, so seeing it in a warning does not, by itself, explain the unresolved reference.
A concrete way to avoid depending on German heading-slug generation is to give the heading an explicit
ASCII identifier and use that exact identifier in the link:
This assumes Pandoc Markdown with
header_attributesenabled, for example-f mark…