CTeX-org / forum

A temporarily alternate forum of `bbs.ctex.org`
https://t.me/chinesetex
Apache License 2.0
210 stars 16 forks source link

超页面问题 #307

Closed fangquinlan closed 6 months ago

fangquinlan commented 6 months ago
\documentclass[12pt]{article}
\usepackage{stackengine}
\usepackage{fontspec}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{ctex} 

\newfontfamily\chinesefont{simsun.ttf}
\newfontfamily\ipafont{CharisSIL-Regular.ttf}

\definecolor{lightblue}{RGB}{135,206,250}

\newcommand{\annotate}[2]{%
    \stackon{%
        \textcolor{black}{\chinesefont #1}%
    }{%
        \textcolor{lightblue}{\ipafont #2}%
    }%
}

\begin{document}

    \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}

原生win11下,使用lualatex(xelatex同样有问题)渲染出来的pdf会出现文本超出页面的问题(不使用ctex会更糟糕)。请问该如何解决?

canton2ipa

muzimuzhi commented 6 months ago

\annotate 定义末尾添加允许换行的位置 \linebreak[0],似乎有用。

% !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}
fangquinlan commented 6 months ago

感谢答疑,问题已解决。