User Tools

Site Tools


gams:tabulators_in_gams

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gams:tabulators_in_gams [2007/08/09 15:01] (current)
Line 1: Line 1:
 +====== Tabulators in GAMS ======
 +
 +//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.
 +<​code>​
 +* 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%|'/;​
 +</​code>​
 +
 +
 +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.
 +<​code>​
 +* 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%|'/;​
 +</​code>​
  
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY gams/tabulators_in_gams.txt ยท Last modified: 2007/08/09 15:01 (external edit)