Replace ligature in bookmarks

Replace ligature in bookmarks



I am trying to replace the s: ligature in the bookmarks by just an s. This is needed as my document is written using a fraktur font, but the colon appears inside the bookmarks as they are not in fraktur.


s:


s



My current code is the following one:


documentclass[a4paper]scrartcl

usepackageyfonts
addtokomafontdispositionfrakfamilyfraklines

usepackage[hidelinks]hyperref

usepackagexstring
newcommandremoveLigatures[1]%
IfSubStr#1s:%
StrSubstitute#1s:s%
#1


newcommandmySection[1]%
sectiontexorpdfstring#1removeLigatures#1


begindocument

frakfamily

tableofcontents

mySectionJus:t a tes:t

enddocument



There seems to be some issue with my code, as I get a bookmark with the text Jus:t a tes:ts:s:sJus:t a tes:t. How can I fix this to achieve the desired results?


Jus:t a tes:ts:s:sJus:t a tes:t




1 Answer
1



You must do the replacement before feeding the argument to texorpdfstring. E.g. with expl3:


documentclass[a4paper]scrartcl

usepackageyfonts

usepackage[hidelinks]hyperref



usepackageexpl3
ExplSyntaxOn
newcommandremoveLigatures[1]%
tl_set:Nn l_tmpa_tl#1
regex_replace_all:nnN s: s l_tmpa_tl

newcommandmySection[1]%
removeLigatures#1
sectiontexorpdfstring#1l_tmpa_tl


ExplSyntaxOff
addtokomafontsectioningfrakfamily

begindocument

frakfamily

tableofcontents

mySectionJus:t a tes:t

enddocument






While this works for the basic case, this eliminates all colons from s::, too. Instead this should be translated to s: as inside the document text itself (where it is represented by the s: ligature followed by a regular colon). This seems to be just a little regex fix.

– epR8GaYuh
Sep 7 '18 at 5:23



s::


s:


s:






yes, sorry I forgot the s in the regex.

– Ulrike Fischer
Sep 7 '18 at 7:05



Thanks for contributing an answer to TeX - LaTeX Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)