2

I am writing a document that contains several languages, including English and Japanese (polyglossia, xeLatex, Windows 7, TeXLive, TeXWorks).

For English, I prefer the classic Hoefler Text font, and since English is the main language, it unfortunately also influences the numerals that appear inside the Japanese environment. The resulting output is quite mismatched with the numerals appearing to have the wrong size and position inside horizontal texts, and producing the wrong spacing in vertical texts. Here is a minimal example:

 \documentclass[12pt]{article}
 \usepackage[a4paper,vmargin=2cm,hmargin=2cm,showframe=false]{geometry}
 \usepackage{xunicode}

 \usepackage{fontspec}

 \usepackage{polyglossia}

 \usepackage{setspace}

 \setmainlanguage{english}

 %Setting main fonts for English (Latin alphabet) text
 \setmainfont[Mapping=tex-
 text,Ligatures=TeX,Scale=1,Color=black,FakeBold=0,AutoFakeSlant=0]{Hoefler 
 Text}
 \setsansfont[Ligatures=TeX]{Geneva}
 \setmonofont{Noto Mono}

 %-------------------------------------------------------%%%

 %%% CJK requires a different treatment
 \usepackage[space,AutoFallBack=true]{xeCJK}

 \usepackage[CJK,overlap]{ruby} % use \ruby{kanji}{kana} to set Furigana

 % position and size of horizontal Furigana (global): below/right
 \renewcommand{\rubysep}{-4ex}
 \renewcommand{\rubysize}{0.5}

 \XeTeXlinebreaklocale "ja"
 \XeTeXlinebreakskip=0em plus 0.1em minus 0.01em
 % we also drop paragraph indentation in order to get proper alignment
 \setlength{\parindent}{0pt}

 \setCJKmainfont[Mapping=tex-text,Script=CJK,BoldFont=MS 
 Gothic,ItalicFont=Meiryo,Scale=1,FakeBold=0]{Kozuka Mincho Pro}
 \setCJKfamilyfont{cjk-vert}[Script=CJK,RawFeature=vertical]{Kozuka Gothic 
 Pro M} %vertical font assignment\
 \newCJKfontfamily\strokefont{KanjiStrokeOrders} %for kanji stroke orders
 \setCJKsansfont{Noto Sans CJK SC}
 \setCJKmonofont{cwTeXFangSong}

 \newenvironment{japanese}


 \begin{document}

 \section{Japanese 1}

 \subsection{Horizontal and Vertical Furigana}

 \begin{japanese}

 \foreignlanguage{english}{An example of Furigana under the character on 
 this horizontal line} 3 \ruby{学}{がく}\ruby{生}{せい}. \par%

 \foreignlanguage{english}{An example of vertical text with vertical 
  Furigana:}\\
 \begin{figure}[ht!]
 \begin{center}
 \rotatebox{-90}{
 \begin{minipage}{0.32\textwidth}
 \CJKfamily{cjk-vert} %setting font locally
 \doublespacing  %setting double space for vertical alignment
 \renewcommand{\rubysep}{-5ex} %setting ruby spacing locally
 \renewcommand{\rubysize}{0.5} %setting ruby size locally
 きのう、\textbf{ラース}は \ruby{山}{やま}\ruby{本}{もと}と あいました。 
「こんにちは、\ruby{山}{やま}\ruby{本}{もと}さん。おげんき 100 ですか。」
 \end{minipage}
 }
 \end{center}
 \end{figure}

 \end{japanese}

 \section{Japanese 2}

 \begin{japanese}

 \subsection{ご使用のまえに 1000} 

 本機は、AC(交流)100 V専用の機械です。絶対に100 V以上の電 圧やDC (直流)を加え
 ないでください。

 \end{japanese}

 \end{document}   

The resulting PDF is quite ugly.PDF
Note the number '3' before the horizontal Furigana in Section 1 is out of place on the line. Note the number '100' in the vertical minipage environment is both too small and weirdly situated, so the spacing above the number and below it is different. The number '1000' in the subsection heading also appears out of kilter. Finally, for the typical text in subsection 2.1, the number '100' again appears too small and simply incompatible with the rest of characters in that sentence.

Is it possible to define the numerals/digits for the Japanese environment separate from the main environment? Is it possible to resolve the discrepancy between horizontal and vertical alignment of the numbers?

Finally, although the numbering of the sections seems OK, I neither like the size of the numerals of subsections nor the horizontal spacing between the heading and the number. Is it possible to control this spacing?

Any help would be greatly appreciated!!

Your Answer

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

Browse other questions tagged or ask your own question.