Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
GNU TeXmacs
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Typesetting and document control == The typesetting process converts TeXmacs trees into boxes.<ref name=":0">M. Gubinelli, The Guile in TeXmacs, presentation at the Guile and Guix Days in Strasbourg, June 21β22, 2019 [http://www.iam.uni-bonn.de/fileadmin/user_upload/gubinelli/texmacs/talk-texmacs-guile-strasbourg-june-2019.pdf pdf] Retrieved 2019-09-21.</ref> Evaluation of TeXmacs trees proceeds by reduction of the primitives, that is by evaluation of macro applications. The typesetting primitives are designed to be very fast and are built-in into the editor; the rendering of many of the primitives can be customized through the built-in environment variables; the stylesheet language allows users to write new primitives as macros on top of the built-in primitives. TeXmacs uses a global algorithm for "line-breaking" (similar to the [[TeX#Hyphenation and justification|TeX one]]) and in addition uses a global algorithm for "page-breaking"; the page-breaking algorithm takes into account floating objects (figures, table, footnotes) and multi-column content. === Document control === Documents can be controlled through a native macro system and through Guile-Scheme. It is possible to customize the editor's menus and keybindings and to act programmatically on the document tree. ==== TeXmacs macros ==== TeXmacs macros provide a means of structured input (as in TeX/LaTeX) and they are immediately typeset, at the same time maintaining editable input fields. They are written in source code, although the WYSIWYG editor can aid in their composition through the translation of visual structures into their syntax.<ref>{{Cite web|title=The TeXmacs Manual; 11.1 Writing a simple style package|url=http://www.texmacs.org/tmweb/documents/manuals/texmacs-manual.en.pdf|access-date=2020-11-27}}</ref> ==== Document control through Scheme ==== Scheme is embedded in TeXmacs through [[GNU Guile]]; the editor itself can be controlled in this way:<ref name=":0" /> menus and keybindings can be customized. Scheme commands can be invoked interactively inside TeXmacs documents, can be invoked from the command line and from inside TeXmacs macros. TeXmacs trees can be passed to Scheme in different forms: as "passive trees" (convenient to manipulate content directly using standard Scheme routines on lists), as "active trees" (keep track of the position of the tree inside the global document tree and can be used to programmatically modify documents), and in a "hybrid" representation. ==== Graphics ==== Graphics objects are also part of the TeXmacs format and can be manipulated programmatically from Scheme. An example of TeXmacs graphics generated in a TeXmacs Scheme session is shown below together with the session which generated the image. Images generated programmatically in a Scheme session can also be edited using the internal drawing editor, as they are inserted in the document as a tree; Scheme scripts can also be executed through the <code>extern</code> TeXmacs macroβin this case only the typeset material is available in the document and no direct editing is possible (the modifications must be made within the Scheme code).<syntaxhighlight lang="scheme"> Scheme] (define pi (acos -1)) ;; A function to define a point in the TeXmacs graphics format using two coordinates Scheme] (define (pt x y) β(point ,(number->string x) ,(number->string y))) ;; Set points Scheme] (define xC (- (* 2 (cos (/ pi 3))))) Scheme] (define yC (* 2 (sin (/ pi 3)))) Scheme] (define pA (pt -2 0)) Scheme] (define pB (pt 2 0)) Scheme] (define pC (pt xC yC)) Scheme] (define tA (pt -2.3 -0.5)) Scheme] (define tB (pt 2.1 -0.5)) Scheme] (define tC (pt (- xC 0.2) (+ yC 0.2))) ;; Generate graphics Scheme] (stree->tree β(with "gr-geometry" (tuple "geometry" "400px" "300px" "center") (graphics (with "color" "blue" (text-at (TeXmacs) ,(pt -0.55 -0.75))) (with "color" "black" (arc ,pA ,pC ,pB)) (with "color" "black" (line ,pA ,pB)) (with "color" "red" (cline ,pA ,pB ,pC)) (with "color" "black" (text-at "A" ,tA)) (with "color" "black" (text-at "B" ,tB)) (with "color" "black" (text-at "C" ,tC))))) </syntaxhighlight>[[File:TeXmacs graphics sample - triangle in a half-circle.png|alt=|frameless|360x360px]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)