User defined environments with parameters
Hi, sometimes one needs a environment where you have to set different strings. While we have \definestartstop to create new environments it doesn’t provide a mechanism to pass values to the environment. Attached is a prototype for such a environment where you can pass values (only style, color and alternative are reserved keys) and create own layouts for the content of each environment. Wolfgang
On Sat, 25 Aug 2018, Wolfgang Schuster wrote:
Hi,
sometimes one needs a environment where you have to set different strings. While we have \definestartstop to create new environments it doesn’t provide a mechanism to pass values to the environment.
Attached is a prototype for such a environment where you can pass values (only style, color and alternative are reserved keys) and create own layouts for the content of each environment.
Would it be better to enhance definestartstop so that it accepts an alternative parameter? Aditya
Aditya Mahajan schrieb am 25.08.18 um 19:02:
On Sat, 25 Aug 2018, Wolfgang Schuster wrote:
Hi,
sometimes one needs a environment where you have to set different strings. While we have \definestartstop to create new environments it doesn’t provide a mechanism to pass values to the environment.
Attached is a prototype for such a environment where you can pass values (only style, color and alternative are reserved keys) and create own layouts for the content of each environment.
Would it be better to enhance definestartstop so that it accepts an alternative parameter?
This is a option but I didn’t want to redefine a existing environment in my example. Still adding a single optional argument to startstop isn’t enough because things like my epigraph example at the end of the file are easier to do with a buffer than simple before/after keys. Another things is my personal preference to use \startenvironment [<instance>] ... \stopenvironment instead of \start<instance> ... \stop<instance> with a simple check if the used instance exists (easy to do when you use the command handler to create new commands). Wolfgang
On 8/25/2018 4:36 PM, Wolfgang Schuster wrote:
Hi,
sometimes one needs a environment where you have to set different strings. While we have \definestartstop to create new environments it doesn’t provide a mechanism to pass values to the environment.
Attached is a prototype for such a environment where you can pass values (only style, color and alternative are reserved keys) and create own layouts for the content of each environment. first attempt in strc-usr.mkiv/lua .. just your code but i moved the before and after, added align and tags
zip on ftp Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Wolfgang Schuster