Re: [NTG-context] ConTeXt's equivalent of standalone class

2021-10-02 Thread Gavin via ntg-context
noib3 via ntg-context schrieb am 02.10.2021 um 17:50:
> Coming from LaTeX, when I had some TikZ pictures I wanted to add in my 
> document I would usually keep them on a separate file, I would compile them 
> with the standalone class so that the resulting PDF's size would be limited 
> to exactly the dimensions of the figure. I would then import the compiled PDF 
> in my main document. All this to not slow down compilation times.
> 
> What's the ConTeXt equivalent of this workflow? How can I keep the PDF 
> dimensions limited to the figure?

In addition to Wolfgang’s suggestion, you might consider using buffers. These 
are only typeset if something in the figure changes, which ConTeXt checks with 
each run. It automates the process of making separate files and including them, 
without slowing down compilation.

Put the TikZ code in buffers and typeset the buffers to make the figures:

\startbuffer[MyTikZFigure]
% TikZ code here
\stopbuffer

\startplacefigure[reference=MyFig, title={This is the figure’s caption}]
\typesetbuffer[starttikz, MyTikZFigure,stoptikz]
\stopplacefigure


Following a suggestion from Hans, I made two buffers that have the starting and 
ending stuff needed for my figures:

\startbuffer[starttikz]  % This buffer will start every TikZ picture.
\environment env_physics % My physics macros
\environment env_TikZ % My TikZ macros
\setupbodyfont [libertinus,11pt] % Other setups for figures
   \startTEXpage
   \starttikzpicture
\stopbuffer

\startbuffer[stoptikz] % This buffer will stop every TikZ picture.
   \stoptikzpicture
   \stopTEXpage
\stopbuffer
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] ConTeXt's equivalent of standalone class

2021-10-02 Thread Wolfgang Schuster via ntg-context

noib3 via ntg-context schrieb am 02.10.2021 um 17:50:
Coming from LaTeX, when I had some TikZ pictures I wanted to add in my 
document I would usually keep them on a separate file, I would compile 
them with the standalone class so that the resulting PDF's size would 
be limited to exactly the dimensions of the figure. I would then 
import the compiled PDF in my main document. All this to not slow down 
compilation times.


What's the ConTeXt equivalent of this workflow? How can I keep the PDF 
dimensions limited to the figure?


\usemodule[tikz]

% uncomment \starttext and \stoptext when you use
% multiple TEXpage environments in your document

%\starttext

\startTEXpage
\starttikzpicture
...
\stoptikzpicture
\stopTEXpage

%\stoptext

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] ConTeXt's equivalent of standalone class

2021-10-02 Thread noib3 via ntg-context
Coming from LaTeX, when I had some TikZ pictures I wanted to add in my
document I would usually keep them on a separate file, I would compile them
with the standalone class so that the resulting PDF's size would be limited
to exactly the dimensions of the figure. I would then import the compiled
PDF in my main document. All this to not slow down compilation times.

What's the ConTeXt equivalent of this workflow? How can I keep the PDF
dimensions limited to the figure?
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___