From 82aed3e7e8af29f359ebef4f93684d20e98107e6 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 25 May 2017 13:21:58 +0200 Subject: 2017-05-25 12:56:00 --- .../documents/general/manuals/workflows-mkiv.pdf | Bin 96859 -> 113307 bytes doc/context/documents/general/qrcs/setup-cs.pdf | Bin 808435 -> 843800 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 809549 -> 842055 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 812254 -> 846956 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 806017 -> 840961 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 809896 -> 843036 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 806303 -> 839187 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 805088 -> 839616 bytes .../general/fonts/fonts/fonts-extensions.tex | 20 +++ .../general/manuals/luatex/luatex-nodes.tex | 4 +- .../general/manuals/math/math-introduction.tex | 3 + .../general/manuals/workflows/workflows-mkiv.tex | 1 + .../manuals/workflows/workflows-synctex.tex | 178 +++++++++++++++++++++ 13 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 doc/context/sources/general/manuals/workflows/workflows-synctex.tex (limited to 'doc') diff --git a/doc/context/documents/general/manuals/workflows-mkiv.pdf b/doc/context/documents/general/manuals/workflows-mkiv.pdf index cbbec0a5a..e156a2efc 100644 Binary files a/doc/context/documents/general/manuals/workflows-mkiv.pdf and b/doc/context/documents/general/manuals/workflows-mkiv.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index 6d5775ddb..a18dd3f3a 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index 721e31d5b..61555c8a5 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index 304cdbe33..23c4a1f20 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index e28ca467e..4e6fb890d 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index e54aa9fe6..1ae5c87b9 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index 84dbf2b1c..308dcac21 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index b248bfb77..74fae7adf 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/doc/context/sources/general/fonts/fonts/fonts-extensions.tex b/doc/context/sources/general/fonts/fonts/fonts-extensions.tex index fcb9746f2..87e362569 100644 --- a/doc/context/sources/general/fonts/fonts/fonts-extensions.tex +++ b/doc/context/sources/general/fonts/fonts/fonts-extensions.tex @@ -1621,6 +1621,26 @@ example we only displace the second glyph. Of course you need to know a bit about the metrics of the glyphs involved so in practice this boils down to trial and error. +A single character (glyph) can also be tweaked, although normally this is done +better in a manipulator when loading the font. Anyway: + +\startbuffer +\startluacode + fonts.handlers.otf.addfeature { + name = "stest", + type = "single", + data = { + a = { -30, 0, -50, 0 }, + } + } +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +This will reduce the left and right edges and make the glyph a pretty tight one. The +values are for Latin Modern. + \stopsubsection \startsubsection[title=Examples] diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index d3c2c06da..f600eeb2f 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -368,7 +368,8 @@ and \type {false} gets returned otherwise. When nil is returned, the id is also returned. The \type {is_glyph} variant doesn't check for a subtype being less than 256, so it returns either the character value or nil plus the id. These helpers are not always faster than separate calls but they sometimes permit -making more readable tests. +making more readable tests. The \type {uses_font} helpers takes a node +and font id and returns true when a glyph or disc node references that font. \subsubsection{boundary nodes} @@ -1977,6 +1978,7 @@ consistency. You can of course always define additional accessor using \type \NC \type {unprotect_glyphs} \NC \yes \NC \yes \NC \NR \NC \type {unset_attribute} \NC \yes \NC \yes \NC \NR \NC \type {usedlist} \NC \yes \NC \yes \NC \NR +\NC \type {uses_font} \NC \yes \NC \yes \NC \NR \NC \type {vpack} \NC \yes \NC \yes \NC \NR \NC \type {whatsitsubtypes} \NC \yes \NC \nop \NC \NR \NC \type {whatsits} \NC \yes \NC \nop \NC \NR diff --git a/doc/context/sources/general/manuals/math/math-introduction.tex b/doc/context/sources/general/manuals/math/math-introduction.tex index f5d241004..70e766669 100644 --- a/doc/context/sources/general/manuals/math/math-introduction.tex +++ b/doc/context/sources/general/manuals/math/math-introduction.tex @@ -9,6 +9,9 @@ collection of wrap|-|ups. The file also serves as testcase. The content can change over time and can also serve as a trigger for discussions on the mailing list. Suggestions are welcome. +% https://www.youtube.com/watch?v=SB8_2Yuj8Og +% youtube: Mathematics - Hollie + Metropole Orkest (conducted by Jules Buckley) + \startlines Hans Hagen Hasselt NL diff --git a/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex b/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex index c742b94e1..0014991f2 100644 --- a/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex +++ b/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex @@ -44,6 +44,7 @@ \component workflows-injectors \component workflows-xml \component workflows-setups + \component workflows-synctex \stopbodymatter \stopdocument diff --git a/doc/context/sources/general/manuals/workflows/workflows-synctex.tex b/doc/context/sources/general/manuals/workflows/workflows-synctex.tex new file mode 100644 index 000000000..d275c5d48 --- /dev/null +++ b/doc/context/sources/general/manuals/workflows/workflows-synctex.tex @@ -0,0 +1,178 @@ +% language=uk + +\environment workflows-style + +\startcomponent workflows-xml + +\startchapter[title=Synctex] + +\startsection[title=Introduction] + +Some users like the synctex feature that is built in the \TEX\ engines. +Personally I never use it because it doesn't work well with the kind of documents +I maintain. If you have one document source, and don't shuffle around (reuse) +text too much it probably works out okay but that is not our practice. Here I +will describe how you can enable a more \CONTEXT\ specific synctex support so +that aware \PDF\ viewers can bring you back to the source. + +\stopsection + +\startsection[title=What we want] + +The synctex method roughly works as follows. Internally \TEX\ constricts linked +lists of glyphs, kerns, glue, boxes, rules etc. These elements are called nodes. +Some nodes carry information about the file and line where they were created. In +the backend this information gets somehow translated in a (sort of) verbose tree +that describes the makeup in terms of boxes, glue and kerns. From that +information the synctex parser library, hooked into a pdf viewer, can go back +from a position on the screen to a line in a file. One would expect this to be a +relative simple rectangle based model, but as far as I can see it's way more +complex than that. There are some comments that \CONTEXT\ is not supported well +because it has a layered page model, which indicates that there are some +assumptions about how macro packages are supposed to work. Also the used +heuristics not only involve some specific spot (location) but also involve the +corners and edges. It is therefore not so much a (simple) generic system but a +mechanism geared for a macro package like \LATEX. + +Because we have a couple of users who need to edit complex sets of documents, +coded in \TEX\ or \XML, I decided to come up with a variant that doesn't use the +synctex machinery but manipulates the few synctex fields directly \footnote {This +is something that in my opinion should have been possible right from the start +but it's too late now to change the system and it would not be used beyond +\CONTEXT\ anyway.} and eventually outputs a straightforward file for the editor. +Of course we need to follow some rules so that the editor can deal with it. It +took a bit of trial and error to get the right information in the support file +needed by the viewer but we got there. + +The prerequisites of a decent \CONTEXT\ \quotation {click on preview and goto +editor} are the following: + +\startitemize + +\startitem + It only makes sense to click on text in the text flow. Headers and footers + are often generated from structure, and special typographic elements can + originate in macros hooked into commands instead of in the source. +\stopitem + +\startitem + Users should not be able to reach environments (styles) and other files + loaded from the (normally read|-|only) \TEX\ tree, like modules. We don't + want accidental changed in such files. +\stopitem + +\startitem + We not only have \TEX\ files but also \XML\ files and these can normally + flushed in rather arbitrary ways. Although the concept of lines is sort of + lost in such a file, there is still a relation between lines and the snippets + that make of the content of an \XML\ node. +\stopitem + +\startitem + In the case of \XML\ files the overhead related to preserving line + numbers should be minimal and have no impact on loading and memory when + these features are not used. +\stopitem + +\startitem + The overhead in terms of an auxiliary file size and complexity as well + as producing that file should be minimal. It should be easy to turn on and + off these features. (I'd never turn them on by default.) +\stopitem + +\stopitemize + +It is unavoidable that we get more run time but I assume that for the average user +that is no big deal. It pays off when you have a workflow when a book (or even a +chapter in a book) is generated from hundreds of small \XML\ files. There is no +overhead when synctex is not used. + +In \CONTEXT\ we don't use the built|-|in synctex features, that is: we let +filename and line numbers be set but often these are overloaded explicitly. The +output file is not compressed and constructed by \CONTEXT. There is no benefit in +compression and the files are probably smaller than default synctex anyway. + +\stopsection + +\startsection[title=Commands] + +Although you can enable this mechanism with directives it makes sense to do it +using the following command. + +\starttyping +\setupsynctex[state=start] +\stoptyping + +The advantage of using an explicit command instead of some command line option is +that in an editor it's easier to disable this trickery. Commenting that line will +speed up processing when needed. This command can also be given in an environment +(style). On the command line you can say + +\starttyping +context --synctex=context somefile.tex +\stoptyping + +Often an \XML\ files is very structured and although probably the main body of +text is flushed as a stream, specific elements can be flushed out of order. In +educational documents flushing for instance answers to exercises can happen out of +order. In that case we still need to make sure that we go to the right spot in +the file. It will never be 100\% perfect but it's better than nothing. The +above command will also enable \XML support. + +If you don't want a file to be accessed, you can block it: + +\starttyping +\blocksynctexfile[foo.tex] +\stoptyping + +Of course you need to configure the viewer to respond to the request for +editing. In Sumatra combined with SciTE the magic command is: + +\starttyping +c:\data\system\scite\wscite\scite.exe "%f" "-goto:%l" +\stoptyping + +Such a command is independent of the macro package so you can just consult the +manual or help info that comes with a viewer, given that it supports this linking +back to the source at all. + +\stopsection + +\startsection[title=Tracing] + +In case you want to see what gets synced you can enable a tracker: + +\starttyping +\enabletrackers[system.synctex.visualize] +\stoptyping + +The following tracker outputs some status information about \XML\ flushing. Such +trackers only make sense for developers. + +\starttyping +\enabletrackers[system.synctex.xml] +\stoptyping + +At the cost of extra overhead, the next (experimental) directive can be used when +the accuracy is not optimal. + +\starttyping +\enabledirectives[system.synctex.details] +\stoptyping + +\stopsection + +\startsection[title=Warning] + +Don't turn on this feature when you don't need it. This is one of those mechanism +that hits performance badly. + +Depending on needs the functionality can be improved and|/|or extended. Of course +you can always use the traditional synctex method but don't expect it to behave +as described here. + +\stopsection + +\stopchapter + +\stopcomponent -- cgit v1.2.3