Skip to content
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

ctex: \CTEXifname 的名称和用法问题 #451

Closed
stone-zeng opened this issue Sep 19, 2019 · 2 comments
Closed

ctex: \CTEXifname 的名称和用法问题 #451

stone-zeng opened this issue Sep 19, 2019 · 2 comments

Comments

@stone-zeng
Copy link
Member

目前 ctex 文档中对 \CTEXifname 的说明如下:

\CTEXifname 用于根据当前章节的名字的有无设置不同的格式。……例如,设置章的标题有名字时左对齐,无名字时居中对齐,并且在标题后画一条横线。

但在代码部分的注释却是「用于判断当前标题是否有编号」,且从后续代码来看确实是用来判断是否有编号而非名字的。

所以,是否应当重新命名这一命令,或是仅仅修改文档?以及这一名称的由来有什么解释吗?

有关信息:\CTEXifname 是在 fbfc484 引入的,之后基本没有做过修改。

@muzimuzhi
Copy link
Contributor

「章节的名字」这个名词的初次介绍,是在选项 name 处。
image

个人理解,「章节的名字」是作为「章节的编号」在中文场景下的拓展而存在的。

  • 章节的编号,延续其在英文文档中的对应意思,侧重 \the<counter> 的输出
  • 中文场景下,因为有 name={<pre>,<post>} 的可配置项,所以用「章节的名字」表示 <pre> \the<counter> <post> 的输出,对应 \CTEXthe<counter>

实际行为是

  • 若编号(例如使用 \section),则输出章节的名字,且 \CTEXifname == \@firstoftwo
  • 若不编号(例如使用 \section*),则不输出章节的名字,且 \CTEXifname == \@secondoftwo

对开发者而言,是「是否编号」决定了 \CTEXifname 的行为;对普通用户而言,影响 CTEXifname 的有两点,从输入看「是否编号」,从输出看「是否输出章节的名字」。所以用户文档和源码注释中的用词差异,可能是有意义的。

最后,我支持在文档中更清楚地表达「在本文档中,章节的名字表示 xxx,而章节的编号表示 xxx」、「是否编号(即是否使用带星的章节命令),决定是否输出章节的名字」等意思。

@Liam0205
Copy link
Contributor

太复杂了,直接把表述调整为和「星号」挂钩就好了。

Liam0205 added a commit that referenced this issue Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants