[OT] TeXShop v4.66 adds support for new ConTeXt's syncing method
For those who are interested, the latest TeXShop release provides support for ConTeXt's own syncing method (by invoking mtxrun --script synctex). This supersedes the old syncing method based on Laurens' SyncTeX, which should not be used any more. I have brought TeXShop's page in the wiki up to date (I haven't touched what are currently §1.4 and §1.5), with instructions to get synchronisation to work: https://wiki.contextgarden.net/TeXShop Make sure to read it carefully! I have tested the feature for some time now, and I'd say that it works pretty well (with some caveats, which I have annotated in the wiki). I take the opportunity to thank Hans for being so responsive with the changes in mtxrun necessary to provide this feature, and for patiently bear with my sometimes unclear requests or feedback. Kudos also to Richard Koch (TeXShop's author) for his relentless support of the macOS TeX community and, in this case, of the ConTeXt community! Happy ConTeXt'ing! Nicola
Hello, I have a book containing many margin figures drawn with TikZ, which is very slow. By putting the TikZ code in a buffer and using \typesetbuffer only altered TikZ code is executed on each run, saving tremendous time. This means the code containsmany constructions like this, which I would like to simplify: \startbuffer[BlueCircle] \usemodule[tikz]% Actually this is many lines to load environments, define fonts, etc. \startTEXpage \starttikzpicture \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stoptikzpicture \stopTEXpage \stopbuffer \placefigure[margin][fig:BlueCircle] % location, label {Ti{\it k}Z drew this blue circle\dots slowly.} % caption text {\hbox{\typesetbuffer[BlueCircle]}} My plan is to replace the first block with a new \startTikZbuffer…\stop…, which is defined using \definestartstop to include all of the stuff around the TikZ code. Then I will replace the second block with a new command, \marginTikZ, which has three arguments: a label, a caption, and the TikZ code. This command will use my new \startTikZbuffer to create the buffer before using \placefigure to put it in the margin. Only the \marginTikZ command will appear throughout the book. I’d like to do this in two steps because I will also have \textTikZ and \wideTikZ for diagrams in the text block and diagrams spanning the full page with. All of these can use the same \startTikZbuffer. However, I cannot get the \startTikZbuffer to work as expected. I put a small working example below. Removing the “This method works” block and adding the "This method fails” block causes the an error that I cannot decipher: "Use of \page_fitting_start doesn't match its definition." Any advice is appreciated. Maybe I am doing this entirely the wrong way. A couple notes: I considered using \definebuffer, but this doesn’t allow me to create named buffers, which seems like a deal breaker. I considered using \definefloat, but it don’t allow me include before and after commands, as far as I can tell. ConTeXt version: 2021.07.06 18:49 Same results with MkIV and LMTX. Thanks! Gavin \setuppapersize[letter] \setuplayout[ backspace=90pt, % Horizontal layout leftmargin=36pt, % 1/2 in leftmargindistance=9pt, % 3/8 in width=306pt, % 4 1/4 in rightmargindistance=27pt, % 3/8 in rightmargin=144pt, % 2 in ] \definestartstop[TikZbuffer][ before={\startbuffer[\tikzname]\usemodule[tikz]\startTEXpage\starttikzpicture}, after={\stoptikzpicture\stopTEXpage\stopbuffer}, ] \starttext \input knuth % This method works: \startbuffer[BlueCircle] \usemodule[tikz] \startTEXpage \starttikzpicture \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stoptikzpicture \stopTEXpage \stopbuffer % This method fails: %\def\tikzname{BlueCircle} %\startTikZbuffer % \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; %\stopTikZbuffer \placefigure[margin][fig:BlueCircle] % location, label {Ti{\it k}Z drew this blue circle\dots slowly.} % caption text {\hbox{\typesetbuffer[BlueCircle]}} \input knuth \stoptext
On 7/8/2021 7:55 PM, Gavin wrote:
Hello,
I have a book containing many margin figures drawn with TikZ, which is very slow. By putting the TikZ code in a buffer and using \typesetbuffer only altered TikZ code is executed on each run, saving tremendous time. This means the code containsmany constructions like this, which I would like to simplify:
\startbuffer[BlueCircle] \usemodule[tikz]% Actually this is many lines to load environments, define fonts, etc. \startTEXpage \starttikzpicture \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stoptikzpicture \stopTEXpage \stopbuffer
\placefigure[margin][fig:BlueCircle] % location, label {Ti{\it k}Z drew this blue circle\dots slowly.} % caption text {\hbox{\typesetbuffer[BlueCircle]}}
My plan is to replace the first block with a new \startTikZbuffer…\stop…, which is defined using \definestartstop to include all of the stuff around the TikZ code. Then I will replace the second block with a new command, \marginTikZ, which has three arguments: a label, a caption, and the TikZ code. This command will use my new \startTikZbuffer to create the buffer before using \placefigure to put it in the margin. Only the \marginTikZ command will appear throughout the book.
I’d like to do this in two steps because I will also have \textTikZ and \wideTikZ for diagrams in the text block and diagrams spanning the full page with. All of these can use the same \startTikZbuffer. However, I cannot get the \startTikZbuffer to work as expected.
I put a small working example below. Removing the “This method works” block and adding the "This method fails” block causes the an error that I cannot decipher: "Use of \page_fitting_start doesn't match its definition."
Any advice is appreciated. Maybe I am doing this entirely the wrong way.
A couple notes: I considered using \definebuffer, but this doesn’t allow me to create named buffers, which seems like a deal breaker. I considered using \definefloat, but it don’t allow me include before and after commands, as far as I can tell. \starttext
\input knuth \startbuffer[starttikz] \usemodule[tikz] \startTEXpage \starttikzpicture \stopbuffer \startbuffer[stoptikz] \stoptikzpicture \stopTEXpage \stopbuffer \protected\def\MyTikzBuffer#1{\typesetbuffer[starttikz,BlueCircle,stoptikz]} \startbuffer[BlueCircle] \draw [thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stopbuffer \startplacefigure[location=margin,reference=fig:BlueCircle,title={Example A.}] \typesetbuffer[starttikz,BlueCircle,stoptikz] \stopplacefigure \startplacefigure[location=margin,reference=fig:BlueCircle,title={Example B.}] \MyTikzBuffer{BlueCircle} \stopplacefigure \input knuth \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Thanks Hans! That works great. I understand it all and it is working in my book, so even better. I did not know you could \typsetbuffer[a,b,c]. I will be using that again. In case anyone finds this in the future, trying to solve a similar issue, my final version is below, including my \marginTikZ command. Gavin \setuppapersize[letter] \setuplayout[ backspace=90pt, % Horizontal layout leftmargin=36pt, % 1/2 in leftmargindistance=9pt, % 3/8 in width=306pt, % 4 1/4 in rightmargindistance=27pt, % 3/8 in rightmargin=144pt, % 2 in ] \startbuffer[starttikz] \usemodule[tikz]% Lots of setup can go here! \startTEXpage \starttikzpicture \stopbuffer \startbuffer[stoptikz] \stoptikzpicture \stopTEXpage \stopbuffer \define[2]\marginTikZ{ \startplacefigure[location=margin, reference=fig:#1, title={#2}] \typesetbuffer[starttikz,#1,stoptikz] \stopplacefigure } \starttext \startbuffer[BlueCircle] \draw[thick,blue] (0,0) circle (2cm)node{Ti{\it k}Z!}; \stopbuffer \marginTikZ{BlueCircle}{Ti{\it k}Z drew this blue circle\dots slowly.} \startbuffer[RedCircle] \draw[thick,red] (0,0) circle (2cm)node{Ti{\it k}Z!}; \stopbuffer \marginTikZ{RedCircle}{Ti{\it k}Z drew this red circle\dots slowly.} Take a look at the blue circle in \in{figure}[fig:BlueCircle] and the red circle in \in{figure}[fig:RedCircle] \stoptext
participants (3)
-
Gavin
-
Hans Hagen
-
Nicola