3
$\begingroup$

Sorry for the very simple question but I can't seem to find an answer anywhere.

I have a list of Latin letters, e.g. {a, b, c, d...}. I want to convert them to the corresponding Gothic letters. How can I do this?

$\endgroup$
4
$\begingroup$
toGothicLetters = Association[System`Convert`TeXFormDump`$GothicLetters /. 
    Rule[a_, b_] :> Rule[StringReplace[b, "\\mathfrak{" | "}" -> ""], a]];

toGothicLetters /@ Join[CharacterRange["a", "z"], CharacterRange["A", "Z"]] // StringJoin

enter image description here

$\endgroup$
4
$\begingroup$

Maybe a little improvement to AGML's solution, which will work for upper and lower case symbols/strings:

Clear[makeGothic];
makeGothic[ s_Symbol] := makeGothic[ ToString@s ]
makeGothic[ s_String ] /; StringLength@s == 1 && Not@StringFreeQ[s, Alphabet[]] := 
    FromCharacterCode[ 
        ToCharacterCode["\[GothicA]"] + ToCharacterCode[s] - ToCharacterCode["a"]
    ]
makeGothic[ s_String ] /; StringLength@s == 1 && Not@StringFreeQ[s, Capitalize@Alphabet[]] := 
    "\\[GothicCapital" <> s <> "]" // ToExpression

makeGothic /@ (Capitalize@Alphabet[] ~ Join ~ Alphabet [])

Result

$\endgroup$
3
$\begingroup$
thelist = {a, b, c, d}

ToGothic[thischar_] := 
 "\\[Gothic" <> ToUpperCase[SymbolName[thischar]] <> "]" // ToExpression

Map[ToGothic, thelist]

This works, but it's pretty hacky. Is there a better way?

Edit: I escaped the slash to avoid an (apparently harmless?) error message.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.