Closed fangquinlan closed 6 months ago
在 \annotate
定义末尾添加允许换行的位置 \linebreak[0]
,似乎有用。
\usepackage[pass, showframe]{geometry}
绘制了 text area 的边框,方便看到「超出页面」的视觉效果。ctex
会自动加载 fontspec
,所以我注释了后者。%
是否必要。\newfontfamily\chinesefont{STSong}
这样定义的是西文字体,定义中文字体要用 \newCJKfontfamily
。
如果是用 \newfontfamily
定义的,\chinesefont 汉字
使用的依然是 ctex
默认设置的中文字体。\annotate{中}{[t͡soŋ˥]}。
里的「中」字会用 \chinesefont
的字体(假设它已经是用 \newCJKfontfamily
定义的),而句号用 ctex
默认设置的中文字体。我把 \chinesefont
提到外面使用了,这样所有的中文字和标点都统一用 \chinesefont
指定的字体。% !TeX program = lualatex
\documentclass[12pt]{article}
\usepackage[pass, showframe]{geometry}
\usepackage{stackengine}
%\usepackage{fontspec}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{ctex}
\IfFontExistsTF{simsun.ttf}
{\newCJKfontfamily\chinesefont{simsun.ttf}}
{\newCJKfontfamily\chinesefont{FandolSong}} % for non-win user
\newfontfamily\ipafont{CharisSIL-Regular.ttf}
\definecolor{lightblue}{RGB}{135,206,250}
\newcommand{\annotate}[2]{%
\stackon{%
\textcolor{black}{#1}%
}{%
\textcolor{lightblue}{\ipafont #2}%
}%
\linebreak[0]%
}
\begin{document}
\chinesefont
\annotate{今}{[kɐm˥]}\annotate{日}{[jɐt̚˨]}%
\annotate{天}{[tʰiːn˥]}\annotate{气}{[hei̯˧]}%
\annotate{唔}{[m̩˨˩]}\annotate{错}{[t͡sʰɔː˧]},%
\annotate{阳}{[jœːŋ˨˩]}\annotate{光}{[kʷɔːŋ˥]}%
\annotate{普}{[pʰou̯˧˥]}\annotate{照}{[t͡siːu̯˧]},%
\annotate{温}{[wɐn˥]}\annotate{度}%
{[tou̯˨]}\annotate{适}{[sek̚˥]}\annotate{中}{[t͡soŋ˥]}。
\annotate{我}{[ŋɔː˩˧]}%
\annotate{谂}{[nɐm˧˥]}\annotate{住}{[t͡syː˨]}%
\annotate{趁}{[t͡sʰɐn˧]}\annotate{住}{[t͡syː˨]}%
\annotate{呢}{[nei̯˥]}\annotate{个}{[kɔː˧]}%
\annotate{好}{[hou̯˧˥]}\annotate{天}{[tʰiːn˥]}\annotate{气}{[hei̯˧]}%
\annotate{去}{[hɵy̑˧]}\annotate{行}{[hɐŋ˨˩]}\annotate{下}{[haː˩˧]}%
\annotate{公}{[koŋ˥]}\annotate{园}{[jyːn˧˥]},%
\annotate{呼}{[fuː˥]}\annotate{吸}{[kʰɐp̚˥]}\annotate{下}{[haː˩˧]}%
\annotate{新}{[sɐn˥]}\annotate{鲜}{[siːn˥]}%
\annotate{空}{[hoŋ˥]}\annotate{气}{[hei̯˧]}。
\end{document}
\linebreak[0]
后
感谢答疑,问题已解决。
原生win11下,使用lualatex(xelatex同样有问题)渲染出来的pdf会出现文本超出页面的问题(不使用ctex会更糟糕)。请问该如何解决?