2025년 2월 5일 (수) 오전 1:15, post--- via lualatex-dev <[email protected]>님이 작성:
>
> You will have to re-implement ‘substr of’ with a lua function. The example
> below shows how to do it with minim-mp; I am sure the same can be done with
> luamplib in a similar way.
>
Currently luamplib does not provide any helper function for
'runscript', but we can do it anyway. For instance:
---------------------------
\documentclass{article}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{true}
\begin{mplibcode}
beginfig(1);
string Test;
Test="AaeéB";
for k=1 upto runscript("return utf8.len[["&Test&"]]"):
label.top(runscript("local t=[["&Test&"]];local k="&decimal
k&";return
string.format('%q',utf8.char(utf8.codepoint(t,utf8.offset(t,k))))"),(k*1cm,0));
endfor;
endfig;
\end{mplibcode}
\end{document}
---------------------------
--
Dohyun Kim
Seoul, Republic of Korea