5

I am trying to typeset chinese vertically, with some roman characters mixed in, as well as a few rare characters that require "fallback" to a font different from the main font. The problem of roman characters was solved using a solution found in this post: Vertical Chinese text that contains characters in a "CJK fallback family font" as seen in the MWE below:

\documentclass[landscape,12pt,a4paper]{bxjsarticle}
\usepackage[a4paper]{geometry}
\usepackage{fontspec}
\usepackage[AutoFallBack=true]{xeCJK}
\usepackage{zxjatype}
\usepackage{flowfram}

%command borrowed from the aforementioned post to properly align roman characters with chinese characters:
\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{#1}}
\newcommand*\CJKmove{\punctstyle{plain}
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKsymbol}

%font settings:
\setmainfont{Linux Libertine O}
\setCJKmainfont[Scale=MatchLowercase,Mapping=tex-text,RawFeature={vertical}]{Kozuka Mincho Pro L}
\setCJKfallbackfamilyfont{rm}[Script=CJK,RawFeature={vertical}]{SimSun}

%settings for a 90-degree rotated "flowframe" to enable vertical typesetting
\newflowframe{\textheight}{\textwidth+2em}{0pt}{\textheight}[mainframe] 
\setflowframe{1}{angle=-90} 

\begin{document}

% This next line appears to be the problem: It seems to be needed to enable the command created above, but seems to prevent the CJK fonts from "falling back" properly
\CJKmove

\begin{quote}
別說則慢有八種。此屬增上。真出假位現種種形調伏眾生。故名大慢。大經三十云。菩薩若見眾<the character 眾 doesn't display but the character 衆 does 生有憍慢者。
\end{quote}
\end{document}

This code produces a "tofu" box for the character 眾, as it appears to not be contained in the font Kozuka Mincho Pro L. Instead, it should "fallback" to the SimSun font, but something in the \CJKmove command, needed to keep the roman and chinese baselines aligned, seems to prevent it from doing so. If I delete the \CJKmove command after the \begin{document} line, the Chinese renders fine, but the English is out of alignment. With the command included, the english is aligned, but some chinese characters appear as "tofu" blocks.

It seems that the problem may have something to do with \CJKsymbol from the xeCJK package. Is there any way to have both properly aligned roman characters, and use fallback for vertically typeset CJK?

3

Your problem is that you redefine \CJKsymbol and \CJKpunctsymbol to be \raise.35em\hbox{#1}. You completely lose the original definitions which contain the code for font fall back.

You need to include the original definitions in your new definitions like this:

\let\CJKsymbolOrig\CJKsymbol
\let\CJKpunctsymbolOrig\CJKpunctsymbol
\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{\CJKsymbolOrig{#1}}}
\newcommand*\CJKmovepunctsymbol[1]{\raise.35em\hbox{\CJKpunctsymbolOrig{#1}}}
\newcommand*\CJKmove{\punctstyle{plain}
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKmovepunctsymbol}

Full MWE:

\documentclass[landscape,12pt,a4paper]{bxjsarticle}
\usepackage[a4paper]{geometry}
\usepackage{fontspec}
\usepackage[AutoFallBack=true]{xeCJK}
\usepackage{zxjatype}
\usepackage{flowfram}

%command borrowed from the aforementioned post to properly align roman characters with chinese characters:
\let\CJKsymbolOrig\CJKsymbol
\let\CJKpunctsymbolOrig\CJKpunctsymbol
\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{\CJKsymbolOrig{#1}}}
\newcommand*\CJKmovepunctsymbol[1]{\raise.35em\hbox{\CJKpunctsymbolOrig{#1}}}
\newcommand*\CJKmove{\punctstyle{plain}
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKmovepunctsymbol}

%font settings:
\setmainfont{Linux Libertine O}
\setCJKmainfont[Scale=MatchLowercase,Mapping=tex-text,RawFeature={vertical}]{Kozuka Mincho Pro L}
\setCJKfallbackfamilyfont{rm}[Script=CJK,RawFeature={vertical}]{SimSun}

%settings for a 90-degree rotated "flowframe" to enable vertical typesetting
\newflowframe{\textheight}{\textwidth+2em}{0pt}{\textheight}[mainframe] 
\setflowframe{1}{angle=-90} 

\begin{document}

% This next line appears to be the problem: It seems to be needed to enable the command created above, but seems to prevent the CJK fonts from "falling back" properly
\CJKmove

\begin{quote}
別說則慢有八種。此屬增上。真出假位現種種形調伏眾生。故名大慢。大經三十云。菩薩若見眾<the character 眾 doesn't display but the character 衆 does 生有憍慢者。
\end{quote}
\end{document}

enter image description here

  • Excellent! That works perfectly! I'm wondering--since you seem like you may be familiar with this sort of thing--do you think that this solution for doing vertical typesetting with a rotated "flowframe" makes sense, or do you know of a better way? – Tom Newhall Nov 21 '17 at 7:26
  • Sorry, I don't have any experience with vertical CJK (and only a little with horizontal), nor much with flowframe. And I can't read any of these languages either! You could see how you go with a specific question if you run into trouble. – David Purton Nov 21 '17 at 9:47
  • Thanks for the advice... maybe I'll post another question – Tom Newhall Nov 25 '17 at 7:03

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.