这符文软件包提供了很多符文。一些符文家族,例如中世纪符文,有各种变体形式;例如,“d”的符文包括:
我想用一些文字装饰页面边框。我可以浏览并为文本包含的每个“d”选择不同的符文:有没有简单的方法可以实现这一自动化?理想情况下是这样的:
\prettyRunes{This is a slab of text}
它会随机选择“t”、“i”和其他重复字母的变体(这不是一个很好的例句,但是这个想法就在那里)。
答案1
较长的帖子:初始版本(使用 LuaTeX 的实验)
这allrunes
包是 TeX 发行版的一部分,我们已一切就绪,可以开始了。
中世纪的符文列在第 18 和 19 页手动的。唯一需要的改变是\.u
它应该y
只是主符文中的输入替代(既不是主v
符文也不是变体中的替代y
)。
为了解决这个任务,我使用了这个想法,这个想法我已经考虑了一段时间了。每个\prettyRunes
命令都将其内容保存到外部 TeX 文件 ( ),这与命令 ( ->文件)mal-temp.tex
的方法类似。问题是我们需要在进行一些修改后将其加载回来,而且我们一次只需要一个条目。\index
idx
ind
\ifnum\counter...\fi
我通过向外部文件添加内容并在 TeX 级别加载生成的文件解决了这个特定问题。该文件被加载多次,每次一次\prettyRunes
。值得一提的是,我们至少需要运行两次 TeX:第一次运行生成一个临时 TeX 文件,该文件由独立 Lua 脚本 ( mal-runes.lua
) 处理,输出文件 ( mal-result.tex
) 在第二次和下一次运行 TeX 期间加载回来。
我还应该写一条注释,说明 TeX 中的常规段落被转换为命令\par
(使用此方法可以正常工作),问题在于如果我们使用^^J
TeX 替代其他语言中众所周知的\n
转义字符。在这种情况下,此方法会失败,Lua 脚本会将一个这样的条目理解为多个输入。
Lua 将一行作为一个条目。缺点是这不是一个通用的方法。更好的方法是+++mal+++
在 TeX 级别在每个条目的末尾添加一个唯一标记,例如,这样我们就可以将几个段落作为一个条目。在 TeX 级别,我们将使用它,\long\def\somecommand...
这允许我们在每次调用中处理更多段落。
xelatex
这是由或处理的 TeX 文件lualatex
。我们甚至可以使用,但我在到 的pdflatex
最后一块中遇到了一些困难,这意味着我们无法使用手册中的所有命令来显示符文。我坚持使用。z
\aa
lualatex
% run: xelatex or lualatex mal-runes.tex
\documentclass[a4paper]{article}
%\usepackage[utf8]{inputenc}
% addition for pdflatex, some letters, e.g. ä ö, are not working well, we must use input alternatives
\pagestyle{empty}
\parindent=0pt
\usepackage{xcolor}
\usepackage{allrunes}
\newwrite\malwrite
\openout\malwrite=mal-temp.tex
\newcount\malc \malc=0
\def\malfile{mal-result.tex}
\def\prettyRunes#1{%
\advance\malc by 1%
\write\malwrite{#1}%
%#1% An original text.
\IfFileExists{\malfile}{%
{\armfamily\mdseries% bf, md, lf
\par % to be commented out
{\normalfont Before (input \the\malc): }{\color{blue}#1}\par% original entry; to be commented out
{\normalfont After (output \the\malc): }{\color{green}% to be commented out
%\makebox[0pt][l]{\color{red}\input{mal-result-1.tex}}% comparing random seed versions
\input{\malfile}}%
}\par\smallskip% to be commented out
}% End of \armfamily...
{}%#1% Shall I display anything after the first run of TeX?
}
\begin{document}
Text before. \prettyRunes{This is {a} slab of text}
% first letter "a" is protected from modification, the second letter "a" is not...
Some text. \prettyRunes{Another test \tdot\.N\rdot {\tdot}{\.N}{\rdot}}
% \tdot, \.N and \rdot are also modified, the last three runes are not as they are protected...
Text after. \par\bigskip
%\ifx % all runes to process, deeper testing
\prettyRunes{a\a\.a\adot\'aA bB c\c\.cC\^c d\.t\tbar\=t\tdot\'t\tflag\~t\tring\^tD\.T\D\"T}
\prettyRunes{e\.i\e\=iE\^i fF g\.kG\'k\g\=k h\h H i k l\l\.l\lbar\=l\ldot\'l\lflag\~l\lring\^l m\m}
\prettyRunes{n\n\.n\ndot\'nN\N\.N o p\"b\p\.b\P\Pdots\"\P P q\q\Q r\rdot\.r\r}
\prettyRunes{sS\S tT\T \th þ\TH Þ\thth \dh ð \.\th \DH Ð \.\TH}
\prettyRunes{u v V\.f\v\'f\V\~f w x\x X\X y\.uYv\y\"u\Y\=u}
\prettyRunes{z\z Z äæ\ae \o öø \O ÖØ \oo\oO \ey\arlaug\tvimadur\belgthor jå\aa}
%\fi
\closeout\malwrite
\end{document}
运行后lualatex mal-runes.tex
我们生成mal-temp.tex
。本例中该文件的内容如下:
This is {a} slab of text
Another test \tdot \.N\rdot {\tdot }{\.N}{\rdot }
a\a \.a\adot \'aA bB c\c \.cC\^c d\.t\tbar \=t\tdot \'t\tflag \~t\tring \^tD\.T\D \"T
e\.i\e \=iE\^i fF g\.kG\'k\g \=k h\h H i k l\l \.l\lbar \=l\ldot \'l\lflag \~l\lring \^l m\m
n\n \.n\ndot \'nN\N \.N o p\"b\p \.b\P \Pdots \"\P P q\q \Q r\rdot \.r\r
sS\S tT\T \th þ\TH Þ\thth \dh ð \.\th \DH Ð \.\TH
u v V\.f\v \'f\V \~f w x\x X\X y\.uYv\y \"u\Y \=u
z\z Z äæ\ae \o öø \O ÖØ \oo \oO \ey \arlaug \tvimadur \belgthor jå\aa
我们已经使用了\prettyRunes
八次,文件也有八行。现在是时候用 来处理它了texlua mal-runes.lua
。这是代码。
-- I am mal-runes.lua file...
-- I take characters and convert them to runes main+alternatives randomly...
-- Listed TeX commands are ignored (the second and next columns),
-- { } is a form of a letter protection (the first column only; it can be used in other columns, but there is no need for that)...
math.randomseed(0) -- to be changed anytime, e.g. to 1
--[[ All runes;
the first column is input form and main runes,
the other columns are variant forms (allrunes.pdf from TeX Live distribution)...
those can serve as input as well...
the only difference from allrunes.pdf, version 2.1, pp. 18 and 19, is "\.u", which is used only once next to the "y" letter...
]]
runes={
{ {"a"}, {"\\a ","\\.a"}, {"\\adot ","\\\'a"}, {"A"} },
{ {"b"}, {"B"} },
{ {"c"}, {"\\c ","\\.c"}, {"C","\\^c"} },
{ {"d","\\.t"}, {"\\tbar ","\\=t"}, {"\\tdot ","\\\'t"}, {"\\tflag ","\\~t"}, {"\\tring ","\\^t"}, {"D","\\.T"}, {"\\D ","\\\"T"} },
{ {"e","\\.i"}, {"\\e ","\\=i"}, {"E","\\^i"} },
{ {"f"}, {"F"} },
{ {"g","\\.k"}, {"G","\\\'k"}, {"\\g ","\\=k"} },
{ {"h"}, {"\\h "}, {"H"} },
{ {"i"} },
{ {"k"} },
{ {"l"}, {"\\l ","\\.l"}, {"\\lbar ","\\=l"}, {"\\ldot ","\\\'l"}, {"\\lflag ","\\~l"}, {"\\lring ","\\^l"} },
{ {"m"}, {"\\m "} },
{ {"n"}, {"\\n ","\\.n"}, {"\\ndot ","\\\'n"}, {"N"}, {"\\N ","\\.N"} },
{ {"o"} },
{ {"p","\\\"b"}, {"\\p ","\\.b"}, {"\\P "}, {"\\Pdots ","\\\"\\P"}, {"P"} },
{ {"q"}, {"\\q "}, {"\\Q "} },
{ {"r"}, {"\\rdot ","\\.r"}, {"\\r "} },
{ {"s"}, {"S"}, {"\\S "} },
{ {"t"}, {"T"}, {"\\T "} },
{ {"þ","\\th "}, {"Þ","\\TH "}, {"\\thth "} },
{ {"ð","\\dh ","\\.\\th"}, {"Ð","\\DH ","\\.\\TH"} },
{ {"u"} },
{ {"v"}, {"V","\\.f"}, {"\\v ","\\\'f"}, {"\\V ","\\~f"} },
{ {"w"} },
{ {"x"}, {"\\x "}, {"X"}, {"\\X "} },
{ {"y","\\.u"}, {"Y"}, {"v"}, {"\\y ","\\\"u"}, {"\\Y ","\\=u"} },
{ {"z"}, {"\\z "}, {"Z"} },
{ {"ä","æ","\\ae "} },
{ {"ö","ø","\\o "}, {"Ö","Ø","\\O "}, {"\\oo "}, {"\\oO "} },
{ {"\\ey "} },
{ {"\\arlaug "} },
{ {"\\tvimadur "} },
{ {"\\belgthor "} },
{ {"j"} },
{ {"å","\\aa "} },
} -- end of runes...
-- The core function...
function testme(mstring)
-- Some initial setup and clearing variables...
local s=""
local temp=mstring
local charnew=""
repeat -- Trimming the original string to get an empty string in the end...
-- Clearing some variables needed within one string...
local char=""
local line=0
--local protected=0
-- The core cycles: search in whole runes data table (lines, then columns, then cells)...
for i,iline in pairs(runes) do -- each rune (lines)
for j,jline in pairs(iline) do -- main+variant forms (columns)
for k,kline in pairs(jline) do -- each form of TeX input and output (cells)
--if j>1 then io.write(" ") end
--print(kline)
--s=s.."{\\normalfont\\url{"..kline.."}\\ }"..kline.."{\\normalfont,\\ }"
-- s=s..kline.." "
--if string==kline then print(kline.."shoda") end
-- if j==1 then -- Is it a protected form, e.g. {a}?
-- Should I save e.g. \a or \arlaug? Take the longest match!
-- Protected part...
lookfor="{"..kline.."}"
partfor=string.sub(temp,1,string.len(lookfor))
if partfor==lookfor then -- Found!
--print(partfor.." match of protected string")
if string.len(partfor)>string.len(char) then char=partfor; line=i; protected=1; end
end
-- Common or unprotected part...
partfor=string.sub(temp,1,string.len(kline))
if partfor==kline then -- Found!
--print(partfor.." simple match")
if string.len(partfor)>string.len(char) then char=partfor; line=i; protected=0; end
end
--print(kline,partfor)
-- end -- of j==1
end -- of for kline
end -- of for jline
--print()
--s=s.."\\par "
end -- of for iline
-- Character has been found in runes data table...
if char~="" then
tempvalue=math.random(#runes[line]) -- random number in interval [1,n]
--print(tempvalue) -- which column has been chosen?
charnew=runes[line][tempvalue][1] -- I am selecting random column and its first option
if protected==0 then
s=s..charnew --.." " -- add a space by force to protect TeX commands
else -- character hasn't been found, move by one character/byte by force...
s=s..char --.." "
end -- of if protected
temp=string.sub(temp,string.len(char)+1) -- trim string from left
else
s=s..string.sub(temp,1,1) -- skip an unrecognized characted
temp=string.sub(temp,1+1) -- trim string from left by one character
end -- of if char
-- If I am not skipping a character, e.g. a space, print me found information (for debugging purposes)...
--[[
if line~=0 then
print("s = "..s)
print("temp = "..temp)
print("line = "..line)
print("len of data in that line = "..#runes[line].."\n")
end -- of if line
]]
until temp==""
--print(s) -- a preview of result
-- global replacings for purpose of pdflatex (not working completely)
--[[
s=string.gsub(s,"þ","\\th ")
s=string.gsub(s,"Þ","\\TH ")
s=string.gsub(s,"ð","\\dh ")
s=string.gsub(s,"Ð","\\DH ")
s=string.gsub(s,"ä","\\ae ")
s=string.gsub(s,"æ","\\ae ")
s=string.gsub(s,"ö","\\o ")
s=string.gsub(s,"ø","\\o ")
s=string.gsub(s,"Ö","\\O ")
s=string.gsub(s,"Ø","\\O ")
s=string.gsub(s,"å","\\aa ")
]]
-- Protection is no longer needed... it could help with typesetting kernings.
s=string.gsub(s,"{","")
s=string.gsub(s,"}","")
whereto:write(s)
end -- of core function named testme
-- A single test with protected letter "b"...
-- testme([[a{b}\V c]])
-- A real test which is processing a TeX file...
-- One line is one entry (for multiline input we would need a mark at the end of each entry, generally speaking, it is not implemented here).
local counter=0
whereto=io.open("mal-result.tex","w")
io.write("Processing entry/line ")
for line in io.lines("mal-temp.tex") do
counter=counter+1
io.write(counter.." ")
whereto:write("\\ifnum\\malc="..counter.." ")
--whereto:write(line)
-- global replacements for pdflatex (not working completely)
--[[
line=string.gsub(line,"\\IeC {\\th }","þ")
line=string.gsub(line,"\\IeC {\\TH }","Þ")
line=string.gsub(line,"\\IeC {\\dh }","ð")
line=string.gsub(line,"\\IeC {\\DH }","Ð")
line=string.gsub(line,"\\IeC {\\\"a}","ä")
line=string.gsub(line,"\\IeC {\\ae }","æ")
line=string.gsub(line,"\\IeC {\\\"o}","ö")
line=string.gsub(line,"\\IeC {\\o }","ø")
line=string.gsub(line,"\\IeC {\\\"O}","Ö")
line=string.gsub(line,"\\IeC {\\O }","Ø")
line=string.gsub(line,"\\IeC {\\r a}","å")
]]
testme(line)
--if counter==1 then
-- whereto:write(s)
--end -- of if counter
whereto:write("\\fi\n")
end -- of for line
-- Closing the opened file and Lua script...
whereto:close()
我们在终端收到此消息:Processing entry/line 1 2 3 4 5 6 7 8
。脚本生成了文件mal-result.tex
,就是这样:
\ifnum\malc=1 t\h is is a s\lring aB of T\e \x \T \fi
\ifnum\malc=2 a\ndot o\T \h E\rdot tEst \D nr\tdot \.N\rdot \fi
\ifnum\malc=3 \adot \adot \a \a aA bB \c C\c \c C \tbar \tflag \tbar \D \tdot \tdot D\tdot \tdot \tbar d\tring \tring \tflag \fi
\ifnum\malc=4 Ee\e eEE fF GGgGGG hHH i k l\lbar \lflag lll\lring l\l \ldot \ldot mm\fi
\ifnum\malc=5 N\ndot n\n \N \n N\n o \Pdots \P \Pdots \p \Pdots \P \Pdots \p \q q\Q r\rdot \r \rdot \fi
\ifnum\malc=6 SsStT\T Þ\thth \thth \thth \thth ðð Ð Ðð ð \fi
\ifnum\malc=7 u v \v vVVV\V w \X \x XxYvYVYyvY\fi
\ifnum\malc=8 \z \z z äää\oO \oO ö \oo Ö\oo öÖ\ey \arlaug \tvimadur \belgthor jåå\fi
它\ifnum... \fi
每行添加一个,并随机更改每个符文。我们可以为每个符文使用一个保护,例如,从a
我们输入的{a}
,或者,而不是\thth
我们使用{\thth}
等。这是对 Lua 的提示,不要随机更改符文,而是坚持其原始书写。现在,它仅适用于一个符文,因此我们无法像保护更多符文那样保护它们{abc}
,我们必须使用{a}{b}{c}
表格。
我们可以更仔细地检查第二行:
\tdot \.N\rdot
变成\D nr
。{\tdot }{\.N}{\rdot }
没有改变,Lua 只是删除了它的保护,实际形式(种子设置为零)是这样的:\tdot \.N\rdot
。
第二次运行后lualatex mal-runes.tex
我们得到了这个:
第一行是输入的符文的预览,第二行是修改后的替代方案。
我们可以在 Lua 中比较不同math.randomseed
集合的输出,例如按照以下步骤。
- 运行
lualatex mal-runes.tex
一次。 - 修改
mal-runes.lua
第 5 行,从math.randomseed(0)
到math.randomseed(1)
。 - 跑步
texlua mal-runes.lua
。 - 通过 复制 TeX 文件
cp mal-result.tex mal-result-1.tex
。 - 修改
mal-runes.lua
第 5 行从math.randomseed(1)
开始至math.randomseed(0)
。 - 跑步
texlua mal-runes.lua
。 - 取消注释以
\makebox
in开头的第 23 行mal-runes.tex
。 - 运行
lualatex mal-runes.tex
一次。
我们得到了这个输出。我们可以发现符号为红色的地方存在差异。这是一个粗略的估计,因为符文及其变体的宽度不同。
当我们注释掉文件中的第 20、21、22、23 和 25 行时,生产版本如下所示mal-runes.tex
。如果我们需要在每个符文后允许换行,我们可以--
在代码的第 105 和 107 行中删除mal-runes.lua
。除了空格,我们还可以使用\\allowbreak
或 甚至\\hfill
。这是我们努力的最终预览。
答案2
尝试一种解决方案,使用循环遍历文本runed
。由于时间不足,我无法为每个中世纪符文编写代码,但稍后会回来。
\documentclass[12pt,paper=a4]{scrbook}
\usepackage{xstring}
\usepackage{etoolbox}
\usepackage{forloop}
\usepackage{inputenc}
\usepackage{allrunes}
\usepackage[first=1,last=10,quiet,counter=runerand]{lcg}
\usepackage{blindtext}
\makeatletter
\newrobustcmd{\RandomARune}{%
\chgrand[first=1,last=3,quiet=y]% 3 A runes
%\typeout{\arabic{runerand}}
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
\a}{%
\ifnumequal{\number\value{runerand}}{2}{%
\'a}{%
A}}%
}%
\newrobustcmd{\RandomBRune}{%
\chgrand[first=1,last=2]% 2 B runes
\rand%
\typeout{\arabic{runerand}}%
\ifnumequal{\number\value{runerand}}{1}{%
b}{%
B}%
}%
\newrobustcmd{\RandomCRune}{%
\chgrand[first=1,last=3,quiet=y]% 3 C runes
\typeout{\arabic{runerand}}%
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
c}{%
\ifnumequal{\number\value{runerand}}{2}{%
C}{%
\c}}%
}%
\newrobustcmd{\RandomDRune}{%
\chgrand[first=1,last=7]% 7 D runes
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
d}{%
\ifnumequal{\number\value{runerand}}{2}{%
D}{%
\ifnumequal{\number\value{runerand}}{3}{%
\D}{%
\ifnumequal{\number\value{runerand}}{4}{%
\tring}{%
\ifnumequal{\number\value{runerand}}{5}{%
\tdot}{%
\ifnumequal{\number\value{runerand}}{6}{%
\tflag}{%
\tbar}}}}}}%
}%
\newrobustcmd{\RandomERune}{%
\chgrand[first=1,last=3,quiet=y]% 3 E runes
\rand%
\typeout{\arabic{runerand}}%
\ifnumequal{\number\value{runerand}}{1}{%
e}{%
\ifnumequal{\number\value{runerand}}{2}{%
E}{%
\e}}%
}%
\newrobustcmd{\RandomFRune}{%
\chgrand[first=1,last=2,quiet=y]% 2 F runes
\rand%
\typeout{\arabic{runerand}}%
\ifnumequal{\number\value{runerand}}{1}{%
f}{%
F}%
}%
\newrobustcmd{\RandomGRune}{%
\chgrand[first=1,last=3,quiet=y]% 3 G runes
\rand%
\typeout{\arabic{runerand}}%
\ifnumequal{\number\value{runerand}}{1}{%
g}{%
\ifnumequal{\number\value{runerand}}{2}{%
G}{%
\g}}%
}%
\newrobustcmd{\RandomHRune}{%
\chgrand[first=1,last=3,quiet=y]% 3 H runes
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
h}{%
\ifnumequal{\number\value{runerand}}{2}{%
H}{%
\h}}%
}%
\newrobustcmd{\RandomNRune}{%
\chgrand[first=1,last=5,quiet=y]% 5 N runes
\typeout{\arabic{runerand}}
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
\n}{%
\ifnumequal{\number\value{runerand}}{2}{%
\ndot}{%
\ifnumequal{\number\value{runerand}}{3}{%
\N}{%
\ifnumequal{\number\value{runerand}}{4}{%
n}{%
N}}}}%
}%
\newrobustcmd{\RandomLRune}{%
\chgrand[first=1,last=6,quiet=y]% 6 L runes
\typeout{\arabic{runerand}}
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
\l}{%
\ifnumequal{\number\value{runerand}}{2}{%
\lbar}{%
\ifnumequal{\number\value{runerand}}{3}{%
\ldot}{%
\ifnumequal{\number\value{runerand}}{4}{%
\lflag}{%
\ifnumequal{\number\value{runerand}}{5}{%
l}{%
\lring}}}}}%
}%
\newrobustcmd{\RandomMRune}{%
\chgrand[first=1,last=2,quiet=y]% 2 M runes
\rand%
\typeout{\arabic{runerand}}%
\ifnumequal{\number\value{runerand}}{1}{%
m}{%
\m}%
\gdef\my@randseed{\number\value{runerand}}%
}%
\newrobustcmd{\RandomPRune}{%
\chgrand[first=1,last=5,quiet=y]% 5 P runes
\typeout{\arabic{runerand}}
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
p}{%
\ifnumequal{\number\value{runerand}}{2}{%
\p}{%
\ifnumequal{\number\value{runerand}}{3}{%
\Pdots}{%
\ifnumequal{\number\value{runerand}}{4}{%
\P}{%
P}}}}%
}%
\newrobustcmd{\RandomRRune}{%
\chgrand[first=1,last=3,quiet=y]% 3 R runes
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
r}{%
\ifnumequal{\number\value{runerand}}{2}{%
\rdot}{%
\r}}%
}%
\newrobustcmd{\RandomSRune}{%
\chgrand[first=1,last=3,quiet=y]% 3 S runes
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
s}{%
\ifnumequal{\number\value{runerand}}{2}{%
S}{%
\S}}%
}%
\newrobustcmd{\RandomTRune}{%
\chgrand[first=1,last=3,quiet=y]% 3 T runes
\rand%
\ifnumequal{\number\value{runerand}}{1}{%
t}{%
\ifnumequal{\number\value{runerand}}{2}{%
T}{%
\T}}%
}%
\makeatother
\newcounter{loopcounter}%
\newcounter{textlengthcounter}%
\makeatletter
\newrobustcmd{\TextWithRandomRunes}[1]{%
\def\myresult{}%
\def\my@textlength{}%
\expandarg\StrLen{#1}[\my@textlength]%
\setcounter{textlengthcounter}{0}% For safety
\setcounter{textlengthcounter}{\my@textlength}%
\addtocounter{textlengthcounter}{1}%
\forloop{loopcounter}{1}{\value{loopcounter} < \value{textlengthcounter}}%
{%
\expandarg%
\StrChar{#1}{\number\value{loopcounter}}[\myresult]%
\IfStrEq*{\myresult}{a}{\textarm{\RandomARune}}{%
\IfStrEq*{\myresult}{A}{\textarm{\RandomARune}}{%
\IfStrEq*{\myresult}{b}{\textarm{\RandomBRune}}{%
\IfStrEq*{\myresult}{B}{\textarm{\RandomBRune}}{%
\IfStrEq*{\myresult}{c}{\textarm{\RandomCRune}}{%
\IfStrEq*{\myresult}{C}{\textarm{\RandomCRune}}{%
\IfStrEq*{\myresult}{d}{\textarm{\RandomDRune}}{%
\IfStrEq*{\myresult}{D}{\textarm{\RandomDRune}}{%
\IfStrEq*{\myresult}{e}{\textarm{\RandomERune}}{%
\IfStrEq*{\myresult}{E}{\textarm{\RandomERune}}{%
\IfStrEq*{\myresult}{f}{\textarm{\RandomFRune}}{%
\IfStrEq*{\myresult}{F}{\textarm{\RandomFRune}}{%
\IfStrEq*{\myresult}{g}{\textarm{\RandomGRune}}{%
\IfStrEq*{\myresult}{G}{\textarm{\RandomGRune}}{%
\IfStrEq*{\myresult}{h}{\textarm{\RandomHRune}}{%
\IfStrEq*{\myresult}{H}{\textarm{\RandomHRune}}{%
\IfStrEq*{\myresult}{l}{\textarm{\RandomLRune}}{%
\IfStrEq*{\myresult}{L}{\textarm{\RandomLRune}}{%
\IfStrEq*{\myresult}{m}{\textarm{\RandomMRune}}{%
\IfStrEq*{\myresult}{M}{\textarm{\RandomMRune}}{%
\IfStrEq*{\myresult}{n}{\textarm{\RandomNRune}}{%
\IfStrEq*{\myresult}{N}{\textarm{\RandomNRune}}{%
\IfStrEq*{\myresult}{p}{\textarm{\RandomPRune}}{%
\IfStrEq*{\myresult}{P}{\textarm{\RandomPRune}}{%
\IfStrEq*{\myresult}{r}{\textarm{\RandomRRune}}{%
\IfStrEq*{\myresult}{R}{\textarm{\RandomRRune}}{%
\IfStrEq*{\myresult}{s}{\textarm{\RandomSRune}}{%
\IfStrEq*{\myresult}{S}{\textarm{\RandomSRune}}{%
\IfStrEq*{\myresult}{t}{\textarm{\RandomTRune}}{%
\IfStrEq*{\myresult}{T}{\textarm{\RandomTRune}}{%
\IfStrEq*{\myresult}{ }{ }{%
\textarm{\myresult}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}%
\undef\myresult%
\undef\my@textlength%
} %End of loop
}%
\makeatother
\begin{document}
\def\mytext{Dan Dannington uses the fantastic LaTeX code}%
\mytext
\TextWithRandomRunes{\mytext}%
\TextWithRandomRunes{\mytext}%
\TextWithRandomRunes{\mytext}%
\end{document}
其他待办事项
- 添加其他符文
- 检查空格
- 提高可能的输出改变
- 符文风格(中世纪、北欧等)