[NTG-context] Buffers vs. \def

Wolfgang Schuster schuster.wolfgang at googlemail.com
Wed Apr 18 12:50:24 CEST 2012


Am 18.04.2012 um 11:48 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:

> Hello,
> 
> a question - I'm just curious:
> 
> What is advantage (or maybe intension) of using buffers over \def?
> 
> Compare:
> 
> ----
> \def\BufA{This is buffer A.}
> 
> \startbuffer[BufB]
>  This is buffer B.
> \stopbuffer
> 
> \starttext
>  \BufA
>  \getbuffer[BufB]
> 
>  \ifx\BufC\undefined No buffer C.\else\BufC\fi

\ifdefined\BufC … \else … \fi

Sometimes \setvariables is a better method to store texts in a document.

> \stoptext
> ----
> 
> Both ways give the required effect.
> 
> Moreover, when using \def, I can also test its existence (maybe it's also possible with buffers, but I don't know how).

You can use \doifelsebuffer{<buffer name>}{…}{…}.

Wolfgang


More information about the ntg-context mailing list