TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On p. 95 of my interface3 documentation, dated July 28, 2013, the \tl_case:??? function is first introduced as having a signature \tl_case:NnnTF, but on its extended description for usage it appears as \tl_case:NnTF. I guess this is a typo, but just in case... is it?

My question is actually about the possibility to use this switch-like flow control structure for testing the content of a token list variable against the contents of a collection of token lists, whereas what I understand we have now is a test against the contents of a collection of token list variables. Please, amend my understanding if I got it wrong.

Btw, it is not clear to me from the documentation whether or not the testing stops after the first success (if any). This point may not make any sense in regard to testing against token lists but it definitely does when testing against token lists variables, since we could have more than just one variable set to the same content.

share|improve this question
Yes, it's a typo in the description column at the margin. Your understanding is correct. – egreg Sep 16 '13 at 16:41
@egreg: And is there any possibility to use this function in the way I suggest on the second paragraph? I've also added a related question on the same post. – Marcos Sep 16 '13 at 16:53
@egreg: The typo seems to be in the version on the main text. If I use \tl_case:Nn, I get an "undefined function" error message on compiling. – Marcos Sep 16 '13 at 17:13
My system says \tl_case:Nn is defined: \tl_case:Nn=\long macro: #1#2->\tex_romannumeral:D \__tl_case:NnTF #1{#2}{}{}. – egreg Sep 16 '13 at 17:37
We did a rename: \tl_case:Nnn => \tl_case:NnF with T, TF and 'no branch` versions also added. – Joseph Wright Sep 16 '13 at 21:12
up vote 4 down vote accepted

The \tl_case:NnnTF in the left margin is a typo; it should be \tl_case:NnTF which agrees with the description in the main text.

The old function \tl_case:Nnn has recently been renamed into \tl_case:NnF and an argument for adding actions in the “true” case (that is, when a match occurs) has found its place.

The TF is optional, in the sense that there is a total of four functions:


All of them do a match of a token list variable against token list variables, which is the only way to ensure full expandability.

If you need to do a matching with character strings, there are the similar functions


(where (TF) stands for empty, T, F or TF) and


The difference is that the latter tries complete expansion on the argument strings. (Note that there is a misprint in the description of \str_case:nnTF in the manual.)

As indicated by Joseph Wright, the tests do stop on first hit: they are essentially loops with a break condition (so they are expandable).

share|improve this answer
Well... is there a way that I can test against token lists? Or maybe an alternative function or approach to do this? And, does it stop testing on the first success? – Marcos Sep 18 '13 at 20:21
You might want to use \str_case:nnTF, if your token lists are "character only" – egreg Sep 18 '13 at 20:23
@Marcos The tests do stop on first hit: they are essentially loops with a break condition (so they are expandable). – Joseph Wright Sep 18 '13 at 21:26
@{egreg, Joseph Wright}: Could you possibly add the last two comments to the answer? That's what I was looking for (\str_case:nn) and they would fill the gaps. – Marcos Sep 19 '13 at 11:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.