-
Notifications
You must be signed in to change notification settings - Fork 1
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
Prototype for “inline cutting note” #6
Comments
PrerequisitesIn this comment, I will try to list off all dependencies of my implementation. The LaTeX formatMy implementation requires access to eTeX’s expressions ( A version that runs on plain eTeX can be derived from my implementation. Too much work, though.
|
GalleryThe layout design is based on Vertical textText: 後漢書, by 范曄, annotated by 李賢 et al. Layout: 13Q body on 301⁄3H leading (main text) and 9Q body on 9H leading (inline cutting note). The title is in 18Q and occupies two main text lines, aligned to the right edge. Horizontal textText: The TeXbook, by Donald E. Knuth. Layout: 13Q body on 30H leading (main text) and 9Q body on 10H leading (inline cutting note, with English text in 6.88pt). |
Syntax
\cuttingnote{⟨note text⟩}
\cuttingnote[⟨number of stacked lines⟩]{⟨note text⟩}
\cuttingnote[⟨number of stacked lines⟩][⟨decimal or fraction⟩]{⟨note text⟩}
The ⟨number of stacked lines⟩
The first optional argument, ⟨number of stacked lines⟩, represents the number of lines that should be stacked for arranging the ⟨note text⟩ of this inline cutting note. It can be any arbitrary integer expression accepted by
\numexpr...\relax
. The default is2
. For example,\cuttingnote[2]{⟨note text⟩}
, equivalent to\cuttingnote{⟨note text⟩}
\cuttingnote[3]{⟨note text⟩}
\cuttingnote[(1+6)/2-3]{⟨note text⟩}
, equivalent to\cuttingnote[1]{⟨note text⟩}
The ⟨decimal or fraction⟩
The second optional argument, ⟨decimal or fraction⟩, represents the length (in units of ideographic width) that should be occupied by the ⟨note text⟩ of this inline cutting note. This length does not include the opening and closing brackets (if present) of the inline cutting note. For example,
\cuttingnote[2][12]{⟨note text⟩}
means that the ⟨note text⟩ should be fit into two stacked lines, each of which measures 12-ideograph long (and thus at most 2×12=24 hanzi characters can be fit in).If the ⟨note text⟩ is much longer, then the head 24-hanzi-character amount of the ⟨note text⟩ will be typeset in two stacked lines, followed by a forced line break, and thus wrapping the remaining ⟨note text⟩ onto the next main text line. The remaining ⟨note text⟩ will of course be typeset in the same ⟨number of stacked lines⟩. But if it still cannot be fit into this new main text line, the leftover ⟨note text⟩ will be wrapped onto the next main text line, and so on, until the tail of the original ⟨note text⟩ is fit in and typeset.
The intended use for this second optional argument is to manually break a long ⟨note text⟩. Common and useful input includes integers (
11
,12
, etc.) and half-integers (11.5
,12.5
, etc.), because of the full-width/square nature of ideographs and the half-width nature of many CJK punctuation marks. Fraction expressions such as205/13
and"CD/'15
are also accepted (by the way, these two fractions both represent approximately15.76923
).Dealing with erroneous input
Zero or negative ⟨number of stacked lines⟩
If the given ⟨number of stacked lines⟩ evaluates to zero or some negative integer, then this optional argument along with the second optional argument (if present) will be ignored, and the ⟨note text⟩ will be processed by the identity function
\@firstofone
(\use:n
) and thus will be typeset as part of the main text.For example, the following erroneous input
⟨pre-note main text⟩\cuttingnote[0]{⟨note text⟩}⟨post-note main text⟩
or⟨pre-note main text⟩\cuttingnote[0][12]{⟨note text⟩}⟨post-note main text⟩
or⟨pre-note main text⟩\cuttingnote[6-8]{⟨note text⟩}⟨post-note main text⟩
or⟨pre-note main text⟩\cuttingnote[(9-11)/3][9.5]{⟨note text⟩}⟨post-note main text⟩
will all be treated as
⟨pre-note main text⟩⟨note text⟩⟨post-note main text⟩
. This is not the same as⟨pre-note main text⟩\cuttingnote[1]{⟨note text⟩}⟨post-note main text⟩
.I originally thought about using
\@gobble
(\use_none:n
) instead of\@firstofone
(\use:n
), so that the ⟨note text⟩ would simply disappear for such nonsensical ⟨number of stacked lines⟩. However, the users will likely be baffled by the disappearance of their ⟨note text⟩. Moreover, this is not a good solution when dealing with nested inline cutting notes (see below).Nested inline cutting notes
It makes no sense to nest inline cutting notes. Therefore, as soon as we enter into a valid inline cutting note—one with a positive ⟨number of stacked lines⟩—any inner
\cuttingnote
’s will essentially behave like the identity function.For example (assuming the first
\cuttingnote
is not already inside another\cuttingnote
of course), the following erroneous input\cuttingnote{...\cuttingnote{⟨inner-note text⟩}...}
or\cuttingnote{...\cuttingnote[0]{⟨inner-note text⟩}...}
or\cuttingnote{...\cuttingnote[3][16]{⟨inner-note text⟩}...}
will all be treated as
\cuttingnote{...⟨inner-note text⟩...}
. Likewise, the following erroneous input\cuttingnote[1]{...\cuttingnote[2]{,,,\cuttingnote[3]{⟨inner-inner-note text⟩},,,}...}
will be treated as
\cuttingnote[1]{...,,,⟨inner-inner-note text⟩,,,...}
.Exercise. What about the following input?
⟨pre-note main text⟩\cuttingnote[0]{...\cuttingnote[0]{,,,\cuttingnote[3]{⟨inner-inner-note text⟩},,,}...\cuttingnote[3]{;;;\cuttingnote[3]{⟨another inner-inner-note text⟩};;;}...}⟨post-note main text⟩
Answer. It will be treated as
⟨pre-note main text⟩...,,,\cuttingnote[3]{⟨inner-inner-note text⟩},,,...\cuttingnote[3]{;;;⟨another inner-inner-note text⟩;;;}...⟨post-note main text⟩
. The first\cuttingnote[3]
survives despite being nested two levels deep, since the outer two\cuttingnote[0]
’s are invalid. Similarly, the second\cuttingnote[3]
survives despite being nested one level deep. The third\cuttingnote[3]
is reduced to the identity function, since it is inside a valid\cuttingnote[3]
.The text was updated successfully, but these errors were encountered: