diff options
Diffstat (limited to 'Master/texmf-dist/doc/luatex/luaintro/04-04-10.lualtx')
-rw-r--r-- | Master/texmf-dist/doc/luatex/luaintro/04-04-10.lualtx | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/luatex/luaintro/04-04-10.lualtx b/Master/texmf-dist/doc/luatex/luaintro/04-04-10.lualtx new file mode 100644 index 00000000000..980bce48862 --- /dev/null +++ b/Master/texmf-dist/doc/luatex/luaintro/04-04-10.lualtx @@ -0,0 +1,60 @@ +%% +%% Ein Beispiel der DANTE-Edition +%% +%% 1. Auflage +%% +%% Beispiel 04-04-10 auf Seite 94. +%% +%% Copyright (C) 2013 Herbert Voss +%% +%% It may be distributed and/or modified under the conditions +%% of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% +%% See http://www.latex-project.org/lppl.txt for details. +%% +%% +%% ==== +% Show page(s) 1 +%% +%% +\documentclass[]{exaarticle} +\pagestyle{empty} +\setlength\textwidth{352.81416pt} +\setlength\parindent{0pt} +%StartShownPreambleCommands +\usepackage{luacode,libertine} +\begin{luacode} + local translate={c='ĉ', g='ĝ', h='ĥ', j='ĵ', s='ŝ', u='û'} + local function get_char_token(char) + return token.create(unicode.utf8.byte(char)) + end + local function get_token_char(tok) + return tok[1] == 11 and unicode.utf8.char(tok[2]) + end + local circumflex_token = get_char_token("^") + local function is_circumflex(tok) + return tok[1] == circumflex_token[1] and tok[2] == circumflex_token[2] + and tok[3] == circumflex_token[3] + end + local function in_math_mode() + local n = tex.nest[tex.nest.ptr] + return n.mode == 235 or n.mode == -235 + end + local function texperanto() + local t = token.get_next() + if not in_math_mode() and is_circumflex(t) then + local u = token.get_next() + local c = get_token_char(u) + if c then + local d = translate[c] + if d then return get_char_token(d) else return {t, u} end + else return {t, u} end + else return t end + end + luatexbase.add_to_callback("token_filter", texperanto, "texperanto") +\end{luacode} +%StopShownPreambleCommands +\begin{document} +^c ^g ^h ^j ^s ^u $a^2+b^2=c^2$ und $a^c\le h^j$ +\end{document} |