TiCL Didier Verna Introduction TiCL: the prototype Programmatic Star T EX: the Next Generation (Season 2) Textual Extensions Conclusion Didier Verna didier@lrde.epita.fr @didierverna facebook/didier.verna http://www.lrde.epita.fr/˜didier TUG 2013, October 23 – 26 1/23
TiCL T EX Didier Verna The [final] frontier. Introduction These are the voyages, Programmatic Of a software enterprise. Textual Its continuing mission: Extensions To explore new tokens, Conclusion To seek out a new life, New forms of implementation. . . 2/23
A modernized T EX Previously, on Star T EX TNG. . . TiCL T EX’s strength is in the quality of its typesetting, not in its Didier Verna programmatic interface. Introduction Keep the typesetting functionality but provide. . . Programmatic Textual A more modern and consistent API Extensions Real programming capabilities Conclusion Still simple to use (at least for simple things) Extensibility / customizability 4/23
Fitness of Lisp Previously, on Star T EX TNG. . . TiCL Existing approaches are heterogeneous Didier Verna What about a fully integrated approach ? Introduction Industrial-scale general purpose language Programmatic ◮ Multi-paradigm Textual ◮ Highly optimizable Extensions ◮ Pletora of libraries Conclusion Scripting / extension language ◮ Highly dynamic ◮ Highly reflexive ◮ Easy to learn (no syntax) 5/23
TiCL: the prototype Current architecture TiCL Didier Verna Introduction Programmatic Textual Extensions Conclusion 6/23
This is where we start Not very T EXy. . . TiCL cl-typesetting Hello World Didier Verna ( defun first − document (&key ( f i l e "/tmp/texput.pdf" ) ) Introduction ( t t : with − document ( ) Programmatic ( l e t ( ( content ( t t : compile − text ( ) ( t t : paragraph ( ) "This is some text." ) ) ) ) Textual ( t t : draw − pages content ) ( when pdf : ∗ page ∗ ( typeset : finalize − page pdf : ∗ page ∗ )) Extensions ( t t : write − document f i l e ) ) ) ) Conclusion 8/23
L A T EX-like programmatic layer: step 1 Still full of Lisp idioms TiCL Global variables: *title* , *author* etc. Didier Verna Functions: document-class , make-title etc. Introduction Note: keywords arguments Programmatic Macros: with-document , with-section etc. Textual Extensions Conclusion 9/23
L A T EX-like programmatic layer: step 2 Less full of Lisp idioms TiCL Non lispy accessors (although for constants) Didier Verna Non lispy function (macro) names Introduction Raw symbols instead of keywords Programmatic ◮ for constant arguments Textual ◮ Requires a macro layer Extensions Conclusion Example ; ; Before : ( document − class : a r t i c l e : paper : l e t t e r : pt 12) ; ; After : ( documentclass a r t i c l e : paper l e t t e r : pt 12) 10/23
L A T EX-like programmatic layer: step 3 Even less full of Lisp idioms TiCL Symbol macros Didier Verna Turning 0-ary function calls into mere symbols Introduction More non lispy function (macro) names Programmatic Textual Example Extensions Conclusion ; ; Before : ( make − title ) ( table − of − contents ) ; ; After : maketitle tableofcontents 11/23
L A T EX-like programmatic layer: step 4 Getting rid of some with-* idioms TiCL A (par) command instead of the with-par macro Didier Verna And the par symbol macro that goes with it. Introduction Programmatic Example Textual ; ; Before : Extensions ( with − par "bla bla bla" ) Conclusion ( with − par "bla bla bla" ) ; ; After : "bla bla bla" par "bla bla bla" 12/23
L A T EX-like programmatic layer: step 5 Getting rid of some other with-* idioms TiCL Standalone sectionning commands Didier Verna Need to get rid of underlying macros Introduction Require explicit state management Programmatic e.g. PDF outline levels Textual Extensions Example Conclusion ; ; Before : ( with − section "Title" "bla bla bla" par "bla bla bla" ) ; ; After : ( section "Title" ) "bla bla bla" par "bla bla bla" 13/23
L A T EX-like programmatic layer: step 6 The “empty lines” trick TiCL Replacing par with empty lines in Lisp strings Didier Verna Requires overriding cl-typesetting ’s behavior Introduction But that’s easy (it’s Lisp) ! Programmatic Textual Example Extensions Conclusion ; ; Before : ( section "Title" ) "bla bla bla" par "bla bla bla" ) ; ; After : ( section "Title" ) "bla bla bla bla bla bla" 14/23
L A T EX-like programmatic layer: step 7 L A T EX-like named environments TiCL When impossible to get rid of the macro layer Didier Verna Syntax extension through (read-time) macro characters Introduction Programmatic Example Textual ; ; Before : Extensions ( with − document Conclusion "bla bla bla" "bla bla bla" ) ; ; After : { begin document } "bla bla bla" "bla bla bla" { end document } 15/23
L A T EX-like textual layer The ultimate goal TiCL Idea Didier Verna ◮ Remain text-driven instead of program-driven ◮ Convert automatically to the programmatic layer Introduction Programmatic Implementation Textual ◮ Use \ as an escape (to Lisp) character Extensions ◮ Everything else is accumulated into Lisp strings Conclusion Example ; ; Before : ( section "Lorem Ipsum" ) "Lorem " ( t e x t b f "ipsum" ) " " ( t e x t i t "dolor" ) " sit amet, ... ;; After: \(section " Lorem Ipsum ") Lorem \(textbf " ipsum ") \(textit " dolor ") sit amet, ... 17/23
The merits of extensibility By example TiCL Rivers detection Didier Verna ◮ Requires introspection (boxes internal representation) ◮ But that’s easy (it’s Lisp, and OO) ! Introduction Programmatic Implementation Textual ◮ New kind of box (subclass of vbox ) Extensions ◮ Collects content subject to rivers detection Conclusion ◮ Additional stroking method for this new box ◮ User-level “rivers” environment 19/23
Conclusion TiCL Last year: fitness of Lisp for a T EX implementation Didier Verna This year: proof of concept Introduction Remember the objectives ? Programmatic ◮ A more modern and consistent API Textual ◮ Real programming capabilities Extensions ◮ Still simple to use (at least for simple things) Conclusion ◮ Extensibility / customizability 21/23
TiCL These were the voyages, Didier Verna Of a software enterprise. Introduction Its continuing mission: Programmatic To explore new tokens, Textual To seek out a new life, Extensions New forms of implementation. Conclusion To \textbf{go} , Where no T EX has gone before! 22/23
Live long and prosper! Questions? TiCL Didier Verna Introduction Programmatic Textual Extensions Conclusion 23/23
Recommend
More recommend