3

I am writing a document mostly in English with a few Chinese examples. I would like to be able to typeset the Chinese characters with bopomofo (zhuyinfuhao) annotations to the right side of the character, e.g., sample image of bopomofo to right, rather than the top/bottom, which I can already do using the ruby package. Is there a way to do this? I'm currently using LaTeX, but would be open to XeTeX, etc., if necessary.

Here's a MWE I can compile using pdflatex, which gets the bopomofo characters on top of the Chinese characters:

\documentclass[11pt]{article}
\usepackage{CJKutf8}
\usepackage{ucs}
\usepackage[encapsulated]{CJK}
\newcommand{\cjktext}[1]{\begin{CJK}{UTF8}{bkai}#1\end{CJK}}
\usepackage[overlap, CJK]{ruby}
\renewcommand{\rubysize}{0.5}
\renewcommand{\rubysep}{0ex}

\begin{document}

\cjktext{\ruby{媽}{ㄇㄚ}}
\cjktext{\ruby{麻}{ㄇㄚ\'{}}}
\cjktext{\ruby{馬}{ㄇㄚ\v{}}}
\cjktext{\ruby{罵}{ㄇㄚ\`{}}}

\end{document}

The output with the bopomofo on top looks like this (the tone diacritics aren't quite where they should be, but this is the best I could do):

output of MWE code

Many thanks!

  • 4
    Welcome to TeX.SE! – Mensch Jun 29 '19 at 18:52
1

A comment:

Some fonts already contain the bopo, like HanWangKaiMediumChuIn:

bopomofo font

but that means using fontspec and compiling with xelatex.

Code

\documentclass[12pt]{article}
\usepackage{xcolor}
\pagecolor{red!3}

\usepackage{fontspec}
\newcommand\sampletext{了亶他件}

\setromanfont{HanWangKaiMediumChuIn}

\begin{document}
\section{Sample}
\huge
\sampletext
\end{document}

Another possibility is to use TikZ: see Typesetting furigana above and below original text and alter below to right.

I think there is also a ruby solution - I will search for it.


Edited to add:

A tabular within a tabular also works.

tabular

Code

% !TeX program = xelatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Noto Serif}
\newfontface\fcjk{Noto Sans TC Regular}

\newcommand\fvside[2]{%
\begin{tabular}{cc}%
\Huge #1 & #2\\%
\end{tabular}}%

\newcommand\fvover[2]{%
\begin{tabular}[b]{c}%@{}
#1\\
#2\\
\end{tabular}}

\newcommand\fbpmf[3]{%
\fvside{#1}{\fvover{#2}{#3}}%
}

%adjust padding
\renewcommand\arraystretch{0.5}
\setlength\tabcolsep{0.2em}

\begin{document}
\fcjk
\fvside{另}{\fvover{ㄎ}{ㄚ}}
\fvside{剭}{\fvover{ㄎ}{ㄚ}}
\fvside{俜}{\fvover{ㄎ}{ㄚ}}
\fbpmf{四}{ㄎ}{ㄚ}
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.