-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
夹注:传统直排半高夹注正文对齐求助 #714
Labels
Comments
请提供一个简单又完整的例子。 |
1. 对应附图左边情形的完整代码 \documentclass[a4paper]{book}
\usepackage{xeCJK}
\usepackage{atbegshi}
\usepackage{jiazhu}
\defaultCJKfontfeatures { RawFeature= { vertical:+vert:+vhal } }
\setCJKmainfont{SimSun}
\jiazhuset{
beforeskip=0pt,
afterskip=0pt,
ratio=0.5
}
\textwidth=420pt
\parindent=0pt
\AtBeginShipout{
\global\setbox\AtBeginShipoutBox\vbox{%
\special{pdf: put @thispage <</Rotate 90>>}%
\box\AtBeginShipoutBox}%
}
\begin{document}
\fontsize{20pt}{20pt}\selectfont
康誥曰克明德
\jiazhu{康誥周書克能也}
大甲曰顧諟天之明命
\jiazhu{大讀作泰諟古是字大甲商書顧謂常目在之也諟猶此也或曰審也
天之明命即天之所以與我而我之所以爲德者也常目在之則無時不明
矣}
帝典曰克明峻德
\jiazhu {峻書作俊帝典堯典虞書峻大也皆自明也結所引書皆言自明
己德之意}
\end{document} 2. 对应附图中间情形的代码 \documentclass[a4paper]{book}
\usepackage{xeCJK}
\usepackage{atbegshi}
\usepackage{jiazhu}
\defaultCJKfontfeatures { RawFeature= { vertical:+vert:+vhal } }
\setCJKmainfont{SimSun}
\ExplSyntaxOn
\cs_set_protected:Npn \__jiazhu_dim_normalize:N #1 {
\int_set:Nn \l_tmpa_int { \dim_ratio:nn { #1 } { \l__jiazhu_unit_dim } }
\int_if_even:nF { \l_tmpa_int } { \int_incr:N \l_tmpa_int }
\dim_set:Nn #1 { \l__jiazhu_unit_dim * \l_tmpa_int }
}
\cs_set_protected:Npn \__jiazhu_extract_max_width:N #1 {
\dim_set:Nn \l__jiazhu_width_dim { \box_wd:N #1 }
\dim_set_eq:NN \l__jiazhu_max_dim \l__jiazhu_width_dim
}
\ExplSyntaxOff
\jiazhuset{
beforeskip=0pt,
afterskip=0pt,
ratio=0.5
}
\textwidth=420pt
\parindent=0pt
\AtBeginShipout{
\global\setbox\AtBeginShipoutBox\vbox{%
\special{pdf: put @thispage <</Rotate 90>>}%
\box\AtBeginShipoutBox}%
}
\begin{document}
\fontsize{20pt}{20pt}\selectfont
康誥曰克明德
\jiazhu{康誥周書克能也}
大甲曰顧諟天之明命
\jiazhu{大讀作泰諟古是字大甲商書顧謂常目在之也諟猶此也或曰審也
天之明命即天之所以與我而我之所以爲德者也常目在之則無時不明
矣}
帝典曰克明峻德
\jiazhu {峻書作俊帝典堯典虞書峻大也皆自明也結所引書皆言自明
己德之意}
\end{document} 3. 对应附图右侧情形的代码 \documentclass[a4paper]{book}
\usepackage{xeCJK}
\usepackage{atbegshi}
\usepackage{jiazhu}
\defaultCJKfontfeatures { RawFeature= { vertical:+vert:+vhal } }
\setCJKmainfont{SimSun}
\jiazhuset{
beforeskip=0pt,
afterskip=0pt,
ratio=0.5
}
\textwidth=420pt
\parindent=0pt
\AtBeginShipout{
\global\setbox\AtBeginShipoutBox\vbox{%
\special{pdf: put @thispage <</Rotate 90>>}%
\box\AtBeginShipoutBox}%
}
\begin{document}
\fontsize{20pt}{20pt}\selectfont
康誥曰克明德
\jiazhu{康誥周書克能也}
大甲曰顧諟天之明命
\jiazhu{大讀作泰諟古是字大甲商書顧謂常目在之也諟猶此也或曰審也
天之明命即天之所以與我而我之所以爲德者也常目在之則無時不明矣}
\hspace{0.5em}帝典曰克明峻德
\jiazhu {峻書作俊帝典堯典虞書峻大也皆自明也結所引書皆言自明
己德之意}
\end{document} |
经尝试,得到一个无需手工插入空白解决方案的,修改 \cs_set_protected:Npn \__jiazhu_processing:
{
\__jiazhu_split_lines:
\__jiazhu_put_closing_box:
\__jiazhu_good_break:
\__jiazhu_hskip:N \l__jiazhu_after_skip_tl
+ \int_set:Nn \l_tmpa_int { \dim_ratio:nn { \l__jiazhu_max_dim } { \l__jiazhu_unit_dim } }
+ \int_if_odd:nT \l_tmpa_int { \skip_horizontal:n { \l__jiazhu_unit_dim } }
\group_end:
\tex_ignorespaces:D
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
中文传统直排要求正文垂直方向对齐。在ratio=0.5,夹注字符尺寸是正文的一半,当夹注字数除以 4 余数为 1、2 的时候,夹注本身的宽度是夹注字体尺寸的奇数倍,就会造成正文在垂直对齐错位半个正文字符。(附图左边情形)我最初解决这个问题的方法是在夹注末尾手动插入全角空格,强行使得夹注宽度是夹注字符尺寸的偶数倍。
感谢 @qinglee 给出的一个 Patch,保证了夹注的宽度总是夹注字体尺寸的偶数倍,解决了正文垂直对齐的问题。(附图中间情形)这个方案会出现夹注的第一行比第二行多出 2 个或 3 个字符的情形。但是总是感觉不够美观。
我现在的临时手工解决方案是不再采用这个 patch,手动在夹注末尾和正文之间插入
\hspace{0.5em}
增加空白来对齐。(附图右边的情形)是否可以通过判断,夹注本身宽度为夹注字符尺寸奇数倍的时候,自动在夹注末尾和正文之间自动插入一个夹注字符高度的空白?本身水平有限,虽然读了夹注包的源代码,没有读懂而无从下手。请求帮助。感谢。
The text was updated successfully, but these errors were encountered: