Giter Club home page Giter Club logo

Comments (2)

muzimuzhi avatar muzimuzhi commented on August 12, 2024

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

  • 辅助和样式性修改
    • 我用 \usepackage[pass, showframe]{geometry} 绘制了 text area 的边框,方便看到「超出页面」的视觉效果。
    • 我在 macOS,没有 simsun,所以用 FandolSong 作为了后备。
    • 用 lualatex/xelatex 时 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}
  • 修改之前
    image
  • 加上 \linebreak[0]
    image

from forum.

fangquinlan avatar fangquinlan commented on August 12, 2024

感谢答疑,问题已解决。

from forum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.