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

learn more… | top users | synonyms

43
votes
10answers
4k 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 ...
6
votes
2answers
1k 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 ...
5
votes
2answers
704 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 ...
23
votes
8answers
996 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
560 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 ...
19
votes
4answers
634 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.
17
votes
2answers
680 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 ...
8
votes
1answer
649 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} ...
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
1k 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
813 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
176 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 ...
5
votes
2answers
139 views

Use \foreach loop to execute macro with parameters of macro provided in a list

I have to execute a macro a number of times, and would like to provide a list of the parameters to be executed. So, instead of \FormatLinks*[Main Search Site]{Google}{http://www.google.com} ...
4
votes
1answer
65 views

Passing escaped special characters for use as a URL through macros

From an earlier question on Escaping special characters for use as a URL, using \string to escape the special URL characters in the second example works great: \DefineMyFormatLinkParameters{% ...
4
votes
1answer
116 views

Escaping special characters for use as a URL

If a url contain special characters (~ and #) using it as \href{http://people.brunel.ac.uk/~mastmmg/ssguide/set_work.html#4_32}{people.brunel.ac.uk} works just fine. But, I would like to have macro ...
19
votes
7answers
879 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} ...
14
votes
3answers
812 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
365 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
766 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 ...
11
votes
2answers
213 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 ...
6
votes
1answer
350 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 ...
3
votes
2answers
196 views

Deleting duplicates from a comma-separated list of strings

This is a followup to Difference in compilation time between two slightly different versions. As became obvious when asking that question, the speed of that compilation is seriously affected by the ...
2
votes
1answer
207 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} ...
8
votes
2answers
250 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
251 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
68 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 ...
3
votes
2answers
190 views

Separator between author names (with LaTeX kernel programming)

I try to make my own macro for a typesetting an authors block instead of using package authblk. How can I suppress separator near the fist author of the article. Main condition is to use only LaTeX ...