UNPKG

8.29 kBMarkdownView Raw
1<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4
5- [MingKwai Type Setter 明快排字機](#mingkwai-type-setter-%E6%98%8E%E5%BF%AB%E6%8E%92%E5%AD%97%E6%A9%9F)
6- [Syntax](#syntax)
7 - [Level 1—MarkDown Syntax](#level-1%E2%80%94markdown-syntax)
8 - [Level 2—HTML Tags](#level-2%E2%80%94html-tags)
9 - [Level 3—MKTS Tags (MingKwai TypeScript)](#level-3%E2%80%94mkts-tags-mingkwai-typescript)
10
11<!-- END doctoc generated TOC please keep comment here to allow auto update -->
12
13
14
15# MingKwai Type Setter 明快排字機
16
17A streaming MarkDown -> LaTeX (i.e. XeLaTeX, LuaLaTeX) -> PDF typesetter,
18implemented in CoffeeScript.
19
20# Syntax
21
22## Level 1—MarkDown Syntax
23
24MingKwai TypeSetter (MKTS) uses
25[`markdown-it`](https://github.com/markdown-it/markdown-it)* and, as such,
26supports all the parts of [CommonMark, the Common MarkDown
27Spec](http://commonmark.org/) that are supported by `markdown-it` core—or any
28available syntax plugin—offers, provided an adapter for the given feature has
29been integrated into the MKTS processing pipeline.
30
31> **\*)** this may change in the future, since `markdown-it` does not currently
32> support parsing sources in a piecemeal fashion as would be appropriate
33> for an all-out streaming framework.
34
35## Level 2—HTML Tags
36
37Since `markdown-it` accepts raw HTML tags, it is possible to 'escape to HTML' to
38quickly get features not available in MarkDown as such; however, this also
39presupposes that an HTML-to-TeX translation for the HTML tags has been implemented.*
40
41> **\*)** at the time of this writng, no plug-in structure for syntax extensions
42> has been establish, but that will hopefully change in the future.
43
44## Level 3—MKTS Tags (MingKwai TypeScript)
45
46
47
48* HTML:
49* Raw (i.e. <<(raw>>\TeX<<raw)>>/<<(raw>>\LaTeX<<raw)>>): `<<<...raw material...>>>`
50<!-- * Raw (i.e. <<<\TeX>>>/<<<\LaTeX>>>): `<<<...raw material...>>>` -->
51* Regions:
52 <!-- distinction between span and block needed? -->
53 * Spans: `<<(span>>...<<span)>>`
54 * Blocks: `<<[block>>...<<block]>>`
55* ...
56 * ...
57 * Actions: `<<!action>>`
58 * Exec-Block: <<(!>>exec block<<!)>>
59 * Value Interpolation:
60 <!-- * Variables: `<<$variable>>` -->
61 * Eval-Block: `<<(\$>>eval block<<\$)>>`
62
63
64
65# Fonts and Styles
66
67The MKTS design philosophy rejects the idea of there being stylistic variations of a given typeface;
68instead, it treats each font (German: Schriftschnitt) as an entity in its own right.
69
70* what can be done algorithmically vs what can only be done by conscious choice by the designer
71
72 * Italic: Nope—Oblique yes, but no Italic in the proper sense
73 * Bold: Easier than Italic, but no thanks
74
75It turns out that in present day digital typesetting, all the algorithmic type variation that you can both
76get and actually use in a serious publication is retricted to, basically, scaling ( type size). You *can*
77squeeze and stretch type a teenie-weenie bit, but that's about it.
78
79> In theory underlines are very well within the reach of algorithmic type modification, but, astoundingly,
80> in practice almost all underlined text looks ugly. That should not be the case, given how straightforward
81> it is to add an underline to text. The [Shady Characters](http://www.shadycharacters.co.uk/) website is a
82> the rare exception; there, the designers went to lengths and devised ways to ensure that underlined text
83> look good.[^There's a very interesting proposal for a CSS property `text-decoration-skip` to provide for,
84> inter alia, gaps in the underline where it would otherwise cross descenders; as of 2016, it hasn't been
85> implemented in any browser, though.]
86
87Some (like Knuth) would argue that even mere font scaling produces another font (Schriftschnitt), and this
88was indeed, by and large, the matter of affairs with movable type, where you had one case with, say Times
89Roman @ 12pt and a separate one with Times Roman @ 10pt.
90
91> But observe that (1)&nbsp;even Knuth probably did not provide hand-tailored separate masters for *each* of
92> the envisioned type sizes, not even the several small and very small ones (citation needed);
93> (2)&nbsp;Knuths multiple masters were probably done algorithmically with _MetaFont_ (citation needed); and
94> that (3)&nbsp;even in the olden days, designers used mechanical devices like
95> [pantographs](https://en.wikipedia.org/wiki/Pantograph) to be able to just-so produce multiple sizes from
96> the exact same *urbild* (some adjustments notwithstanding, like keeping hairlines to a certain minimum
97> required widths—that's what we have font hinting and ClearType for in the digital world).
98
99* Algorithmic Variation vs Hand-Picked Matches
100* Convenient Packaging vs Freedom of Choice
101* Helps Simplicity, Ease and Clarity of Implementation
102
103<!--
104
105Whenever you select a font in a word processor like Microsoft Word or OpenOffice Writer and then highlight
106a word and press the Italic or the Bold button on the toolbar, the program will try to interpret your font choice
107
108 -->
109
110## Related Projects
111
112### SILE
113
114Written in Lua, C++
115
116* https://www.youtube.com/watch?v=t_kk20vlamo
117* https://www.youtube.com/watch?v=5BIP_N9qQm4
118* http://sile-typesetter.org
119* http://sile-typesetter.org/images/sile-0.9.4.pdf
120* https://news.ycombinator.com/item?id=13680910
121* https://news.ycombinator.com/item?id=8392653
122
123### Pollen
124
125Written in Rackett
126
127* https://docs.racket-lang.org/pollen/
128
129Written with Pollen:
130
131* Butterick’s Practical Typography, 2nd Edition: https://practicaltypography.com/
132
133### Patoline
134
135* http://patoline.org/patobook.pdf
136
137### Glenn Vanderburg - Cló: The Algorithms of TeX in Clojure
138
139* https://www.youtube.com/watch?v=824yVKUPFjU
140
141> "Cló is a typesetting library for Clojure, implementing the core typesetting algorithms of TeX as
142> composable functions. Although much work remains before Cló is useful in practice, even at an early stage
143> it is instructive, providing interestingly complex examples of real-world procedural algorithms translated
144> into functional form. Thinking about typesetting as a functional problem has yielded valuable clarity and
145> insight about these algorithms, even though in their original form they were written with instruction and
146> teaching in mind (the notion of "literate programming" was invented for TeX). In this talk, I'll share
147> some of the background, code, results, and lessons learned so far."
148
149### Rinohtype, The Python document processor
150
151> "Rinohtype is a document processor in the style of LaTeX. It renders structured documents to PDF based on
152> a document template and a style sheet. An important goal of rinohtype is to be more user-friendly than
153> LaTeX. This includes providing clear error messages and making it very easy to adjust the document style."
154
155* https://github.com/brechtm/rinohtype
156* http://www.mos6581.org/rinohtype
157
158(v0.3.0 released on Dec 7, 2016)
159
160### CSS Paged Media Module Level 3
161
162> W3C Working Draft, 18 October 2018
163>
164> "This CSS module specifies how pages are generated and laid out to hold fragmented content in a paged
165> presentation. It adds functionality for controlling page margins, page size and orientation, and headers
166> and footers, and extends generated content to enable page numbering and running headers / footers. The
167> process of paginating a flow into such generated pages is covered in [CSS3-BREAK].
168>
169> CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen,
170> on paper, etc."
171
172* https://www.w3.org/TR/css-page-3/
173
174### Prince
175
176
177> "Prince is an ideal printing component for server-based software, such as web applications that need to
178> print reports or invoices. Using Prince, it is quick and easy to create PDF files that can be printed,
179> archived, or downloaded.
180>
181> Prince can also be used by authors and publishers to typeset and print documents written in HTML, XHTML,
182> or one of the many XML-based document formats. Prince is capable of formatting academic papers, journals,
183> magazines, and books."
184
185* https://www.princexml.com/
186* http://css4.pub/2015/icelandic/dictionary.pdf
187
188## Status of Japanese (and CJK) typesetting with TeX in Debian
189
190* https://www.youtube.com/watch?v=i0UO44PNMWM
191
192
193