Skip to content

Instantly share code, notes, and snippets.

@mkpoli
Created June 23, 2021 06:49
Show Gist options
  • Select an option

  • Save mkpoli/620ea65bb2403c98ad4913e37cd17d06 to your computer and use it in GitHub Desktop.

Select an option

Save mkpoli/620ea65bb2403c98ad4913e37cd17d06 to your computer and use it in GitHub Desktop.
字母ルビー(複数行のふりがな+自動括弧)
\documentclass[article, lualatex, [...], tate, landscape]{jlreq}
\usepackage{pythontex}
[...]
\begin{pycode}
def addparen(string):
result = "\\vspace{-0.8\\zh}"
for char in string:
result += ("\\tatechuyoko{(" + char + ")}" if char != " " else " ")
return result
\end{pycode}
\newcommand{\addparen}[1]{\py{addparen("#1")}}
\newcommand{\jibo}[2]{\shortstack{\addparen{#2}\\#1}}
\newcommand{\jruby}[3]{\ruby{#1}{\jibo{#2}{#3}}}
[...]
\begin{document}
\jruby{山茶}{つばき}{ 者 }
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment