How can I use tabs in GAMS?
The key to putting tabs into GAMS output lies in using the $ondelim/$offdelim dollar controls to prevent tab expansion. The small attached example demonstrates this.
* without ondelim the Tabs will be expanded where they appear in the input * enter Tab directly or stick into a GAMS 'environment' * tabs are lost (expanded) where they appear outside of $ondelim/offdelim * the content of %tab% and %losttab% depend on where they are defined, not used file tab / tab.put /; $ondelim display 'tab tab'; * ^ tab character put tab 'enclosed tab| |'/; * ^ tab character $offdelim display 'tab tab'; * ^ tab character put tab 'expanded tab| |'/; * ^ tab character $ondelim $setglobal tab ' ' * ^ tab character $offdelim $setglobal losttab ' ' * ^ tab character display '%tab%a%tab%b%tab%'; put tab 'this is a tab|%tab%|'/; display '%losttab%a%losttab%b%losttab%'; put tab 'this is a losttab|%losttab%|'/;
The key to putting tabs into GAMS output lies in using the $ondelim/$offdelim dollar controls to prevent tab expansion. The small attached example demonstrates.
* without ondelim the Tabs will be expanded where they appear in the input * enter Tab directly or stick into a GAMS 'environment' * tabs are lost (expanded) where they appear outside of $ondelim/offdelim * the content of %tab% and %losttab% depend on where they are defined, not used file tab / tab.put /; $ondelim display 'tab tab'; * ^ tab character put tab 'enclosed tab| |'/; * ^ tab character $offdelim display 'tab tab'; * ^ tab character put tab 'expanded tab| |'/; * ^ tab character $ondelim $setglobal tab ' ' * ^ tab character $offdelim $setglobal losttab ' ' * ^ tab character display '%tab%a%tab%b%tab%'; put tab 'this is a tab|%tab%|'/; display '%losttab%a%losttab%b%losttab%'; put tab 'this is a losttab|%losttab%|'/;