Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
expl3:スペース区切りでモノルビ指定
% https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2899&parent=16984
\documentclass[uplatex]{jsarticle}
\usepackage{xparse}
\usepackage{okumacro}
\ExplSyntaxOn %!!!!!!!!!!!!!!!!!!!!!!!! expl3 code BEGIN
\seq_new:N \l__sruby_body_seq
\seq_new:N \l__sruby_ruby_seq
\cs_new_protected:Nn \__sruby_do:nn
{
\seq_set_split:Nnn \l__sruby_body_seq { ~ } {#1}
\seq_set_split:Nnn \l__sruby_ruby_seq { ~ } {#2}
\int_step_inline:nn { \seq_count:N \l__sruby_body_seq }
{
\ruby
{ \seq_item:Nn \l__sruby_body_seq { ##1 } }
{ \seq_item:Nn \l__sruby_ruby_seq { ##1 } }
}
}
\NewDocumentCommand \spacedruby { m m }
{ \__sruby_do:nn {#1} {#2} }
\ExplSyntaxOff %!!!!!!!!!!!!!!!!!!!!!!!! expl3 code END
\begin{document}
\spacedruby{明 朝 体}{みん ちょう たい}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.