I'm creating a latex document in japanese with lots of furigana and some footnotes. The command to create the kanji with footnote is `\edtext{\ruby{kanji}{reading}}{\Afootnote{meaning}`, where kanji, reading and meaning are my inputs.
​
Is there any way to quickly create them? Yasnippets doesn't seem to work well since I use three different input-modes, japanese for the kanji, japanese-hiragana for the reading and nil for the meaning.
​
I created the following function:
(defun jane/latex-footnote ()
(interactive)
(let ((my-input current-input-method))
(set-input-method 'japanese)
(let ((kanji (read-string "What's the kanji: " nil nil nil t)))
(set-input-method 'japanese-hiragana)
(let ((reading (read-string "What's the reading: " nil nil nil t))
(footnote (read-string "What's the footnote: ")))
(insert (concat "\\edtext\{\\ruby\{" kanji "\}\{" reading "\}\}\{\\Afootnote\{" footnote "\}"))))
(set-input-method my-input)))
It does work, but I do need to type the kanji twice. Once for the kanji, and twice for it's reading. Is there any way to improve my function?