ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* ConTeXt's equivalent of standalone class
@ 2021-10-02 15:50 noib3 via ntg-context
  2021-10-02 15:55 ` Wolfgang Schuster via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: noib3 via ntg-context @ 2021-10-02 15:50 UTC (permalink / raw)
  To: ntg-context; +Cc: noib3


[-- Attachment #1.1: Type: text/plain, Size: 473 bytes --]

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?

[-- Attachment #1.2: Type: text/html, Size: 527 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ConTeXt's equivalent of standalone class
  2021-10-02 15:50 ConTeXt's equivalent of standalone class noib3 via ntg-context
@ 2021-10-02 15:55 ` Wolfgang Schuster via ntg-context
  2021-10-02 17:38   ` Gavin via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2021-10-02 15:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users, noib3 via ntg-context; +Cc: Wolfgang Schuster

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ConTeXt's equivalent of standalone class
  2021-10-02 15:55 ` Wolfgang Schuster via ntg-context
@ 2021-10-02 17:38   ` Gavin via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Gavin via ntg-context @ 2021-10-02 17:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-02 17:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 15:50 ConTeXt's equivalent of standalone class noib3 via ntg-context
2021-10-02 15:55 ` Wolfgang Schuster via ntg-context
2021-10-02 17:38   ` Gavin via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).