Difference between revisions of "Command/doif..."

From Wiki
Jump to navigation Jump to search
m (added \doiftext, \doiftextelse)
Line 11: Line 11:
 
* <tt>\doifnumberelse</tt>
 
* <tt>\doifnumberelse</tt>
 
* <tt>\doifassignmentelse</tt>
 
* <tt>\doifassignmentelse</tt>
 +
* <tt>\doiftext</tt>, <tt>\doiftextelse</tt> — empty string
 
* <tt>\doifrightpageelse</tt> (precede by {{cmd|signalrightpage}})
 
* <tt>\doifrightpageelse</tt> (precede by {{cmd|signalrightpage}})
 
* {{cmd|doifdocumentargument}}
 
* {{cmd|doifdocumentargument}}

Revision as of 16:19, 14 March 2021

\doif...

  • \doifnextcharelse
  • \doifundefined, \doifdefined, etc.
  • \doif, \doifnot, \doifelse
  • \doifempty, \doifnotempty, \doifemptyelse
  • \doifinset, \doifnotinset, \doifnotinsetelse
  • \doifcommon, \doifnotcommon, \doifcommonelse
  • \doifsamestringselse,\doifsamestring,\doifnotsamestring
  • \doifinstringelse,\doifincsnameelse
  • \doifnumberelse
  • \doifassignmentelse
  • \doiftext, \doiftextelse — empty string
  • \doifrightpageelse (precede by \signalrightpage)
  • \doifdocumentargument
  • \doifelseindented (LMTX only)

Example

We can also write tests using Lua. (Example by WS, 3/2011.)

\starttext
  \ctxlua{test = true}
 
   Test is \ctxlua{commands.doifelse(test)}{True}{False}.
 
  \ctxlua{test = false}

  Test is \ctxlua{commands.doifelse(test)}{True}{False}.
\stoptext

See also

Branches and Decisions

Help from ConTeXt-Mailinglist/Forum

All issues with: