使用ruby
包生成日语的假名和中文的拼音。我使用单独的\sf
调用将每个拼音从日文字体单独切换回默认的 sans 字体。有没有更简单的方法?
(我应该澄清一下,我知道每个 CJK 字体都有拼音的罗马字形,但我更喜欢生物线虫。
请参阅 MWE...它的输出使我的问题更加清晰,我认为:
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
% PACKAGES
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Linux Libertine O}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Linux Biolinum O}
\setmonofont[Scale=MatchLowercase]{Linux Libertine Mono O}
\usepackage{ruby}
\usepackage{setspace}
\begin{document} % ==============================================================
\newfontfamily{\J}[Scale=0.85]{Hiragino Kaku Gothic Pro}
\newfontfamily{\C}{STKaiti}
\doublespace
\Large
I'd like to include both Chinese (e.g. {\C\renewcommand\rubysep{-4.9ex}\ruby{内}{\sf nèi}\ruby{忧}{\sf yōu}\ruby{外}{\sf wǎi}\ruby{患}{\sf huàn}}) and Japanese (e.g. {\J\renewcommand\rubysep{-1.9ex}\ruby{内}{ない}\ruby{憂}{ゆう}\ruby{外}{がい}\ruby{患}{かん}}) text, \textit{inline} with English text, and with ruby text (pronunciation), as shown here. Does there exist a convenient method for distributing the \texttt{\textbackslash sf} (or preferably \texttt{\textbackslash textsf\{\}}), across all the \texttt{\textbackslash ruby} calls to generate the Pīnyīn (the text below the Chinese)?
\end{document}
答案1
我还没有测试过它是否会破坏任何东西,但似乎创建一些新的命令并将其参数传递给可能\ruby{}{}
会有效。这允许您每次都更新\rubysep
以及\textsf
仅适用于拼音。这个例子应该很清楚了。
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
% PACKAGES
\usepackage{fontspec}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Linux Libertine O}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Linux Biolinum O}
\setmonofont[Scale=MatchLowercase]{Linux Libertine Mono O}
\usepackage{ruby}
\usepackage{setspace}
\begin{document} % ==============================================================
\newfontfamily{\jpn}[Scale=0.85]{Hiragino Kaku Gothic Pro}
\newcommand{\J}[2]{\renewcommand\rubysep{-1.9ex}{\jpn \ruby{#1}{#2}}}
\newfontfamily{\chn}{STKaiti}
\newcommand{\C}[2]{\renewcommand\rubysep{-4.9ex}{\chn \ruby{#1}{\textsf{#2}}}}
\doublespace
\Large
I'd like to include both Chinese (e.g. \C{内}{nèi}\C{忧}{yōu}\C{外}{wǎi}\C{患}{huàn}) and Japanese (e.g. \J{内}{ない}\J{憂}{ゆう}\J{外}{がい}\J{患}{かん}) text, \textit{inline} with English text, and with ruby text (pronunciation), as shown here. Does there exist a convenient method for distributing the \texttt{\textbackslash sf} (or preferably \texttt{\textbackslash textsf\{\}}), across all the \texttt{\textbackslash ruby} calls to generate the Pīnyīn (the text below the Chinese)?
\end{document}
注意:我xunicode
从标题中删除了它,因为它是由 自动加载的fontspec
。