{comma-separated-list} is a data format consisting of fields, most commonly separated by commas

learn more… | top users | synonyms

36
votes
10answers
3k views

How to iterate over a comma separated list?

How can I iterate, loop, process, or otherwise do something, with each element from a comma separated list of things? This question has been asked perhaps many many times, and the are already lots of ...
5
votes
2answers
599 views

Replacing matching text with a macro containing information from a CSV file

I have some data stored in a CSV file, in this manner: 000000001 @ name @ information @ more information @ some more information I also have a information.tex file containing the numbers from the ...
22
votes
8answers
892 views

What is the best way to scan over a list of somethings?

It seems that a common operation needed when defining new commands is to scan over a list of arguments (separated e.g. by a comma, but maybe by something else) and do something with each argument in ...
12
votes
1answer
511 views

Sorting Comma Separated Lists defined with, or without macro

I would like to be able to sort a comma separated list. Before I resort to writing something that would require \ensureunix :-) and having that do the sort for me, I thought I'd make an attempt to ...
5
votes
2answers
924 views

Iterating through comma-separated arguments

I've looked all over and can't seem to find a succinct answer to this question. Is it possible (and if so, how) to create a command that will iterate through its `arguments' of comma-separated values ...
17
votes
2answers
535 views

Selecting random elements from a comma separated list

I would like to have a command (either user-defined, or from a package, or whatever) that has the basic form: \selectNrandom{N}{list, of, comma, separated, elements}{code to execute} which will ...
7
votes
1answer
585 views

How to process a comma separated list?

Using receipt of "LaTeX3: unable to convert space separated list into clist" I elaborated the following code for my needs: \documentclass{book} ... \usepackage{expl3} \begin{document} ...
18
votes
4answers
518 views

Comma delimited list - how to obtain the length?

It's simple. I have a list like {0,1,54,1,3} as input argument to a command in making. How can I obtain the length of this list? Something like \length(#1) where #1 is the list.
13
votes
5answers
1k views

How do I write a macro having comma-separated and variable number of arguments?

I want to write a macro in LaTeX2e that can pass \textcolor, which is embedded in another macro, the values of the colour model gray, rgb, or cmyk. The number of arguments specified implies the colour ...
13
votes
5answers
957 views

Parse comma-separated list of command names with spaces

Problem This question is related to How can I specify a long list of math operators? – but with a twist: I want to allow spaces in in the comma-separated list, like so: \newacronyms{acm, ams, cpu, ...
7
votes
3answers
668 views

parse variable length comma separated list into command

I've been trying to modify the solution here into a LaTeX3 command that takes a variable length comma separated list of numbers and an optional argument (a unit) and prints the square root of the sum ...
6
votes
3answers
160 views

Expansion issue when adding to CSV list from within a \foreach

Another expansion issue that I am unable to guess at the correct combination of \edef/\expandafters to get to work. Background: Below I have defined \AddToCommaSeparateList which uses \g@addto@macro ...
19
votes
7answers
741 views

How to define a command to feed the contents of a list into an \ifcase construct?

It's common to use an \ifcase construct to redefine a command depending on the value of a counter. The following example illustrates this: \documentclass{article} \usepackage{xcolor} ...
13
votes
3answers
622 views

Get n-th element of a list (with etoolbox, or not)

I'm defining a list and I need to obtain the n-th element of this list. I was surprised that etoolbox doesn't provide a way to obtain it. The way I found to obtain the n-th element is along these ...
10
votes
7answers
1k views

Iterating through two lists

I have two comma delimited lists: ListA(a,b,c,d,e,f,g) and ListB(name1,name2,name3,name4,name5) I would like to iterate through both lists at the same time, something like: loop readvalue ...
19
votes
2answers
339 views

Difficulty with macro expansion

I'm not getting the output I want from my LaTeX code, and I think the problem is that I'm not expanding things at the right times. Code \documentclass{article} \usepackage{tikz} ...
11
votes
2answers
460 views

How do I put card backs on my cards?

I have a a document that is making me sheets of cards. A stripped down, almost minimal example looks something like \documentclass{article} \usepackage[utf8]{inputenc} %Needed for input ...
6
votes
1answer
307 views

Why am I processing a comma-separated list incorrectly when using etoolbox and kvoptions?

I'm trying to pick something out of a list that has been passed from some package options by kvoptions, but docsvlist doesn't appear to be recognising the commas. I suspect this may be something to ...
2
votes
1answer
191 views

Compare two comma separated lists

Hi I would like to compare two comma separated lists. \documentclass[a4paper]{article} \usepackage{comment} \usepackage{ifthen} \usepackage{xargs} \usepackage{xkeyval} \usepackage{xfor} ...
11
votes
2answers
194 views

How to process a list and ignore spaces?

This question is part of a new package: metrix. Typeset metric/prosodic symbols standalone and above syllables. I’m wrinting a new package and I need to process a list (using etoolbox at the ...
8
votes
2answers
209 views

How do I process a comma separated list passed through a command

When passing a comma-separated list the commas are ignored, i.e. the list becomes a single item and I can't seem to find a way to prevent this. What should I do so that TEST C in the attached code ...
6
votes
3answers
218 views

Long List of Files Names with Paths

I need to keep a list of files (max of around 500) along with the path. Based on the fact that each file name and path could be up to 100 characters, should I just save it in a comma separated list ...
5
votes
1answer
58 views

Is there any way to add a key to a sub/module in l3keys?

I need to loop through a comma-separated list, creating them all as keys for a data structure. I can't think of a way to loop through the keys inside \keys_define:nn, so the only other option I see is ...