The output is sorted using the tag's list field and the tiddlers' list-before and list-after fields.
The behaviour when T is empty depends on the settings of the S optional suffix:
T is missing and S is either missing or set to "loose", then the output of tag is empty, and the output of !tag is a copy of the input.T is missing and S is set to "strict", then the output of both tag and !tag is a copy of the input