Created
July 11, 2020 13:04
-
-
Save zr-tex8r/681b30cacbcc80180272750a6d984435 to your computer and use it in GitHub Desktop.
expl3:スペース区切りでモノルビ指定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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