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

learn more… | top users | synonyms

1
vote
1answer
58 views

Programming language-like syntax for nested lists

Consider the following code that simply nests two lists using the \ForEach command: \documentclass{article} \usepackage{forarray} \newcommand{\demo}[1] { \begin{itemize} \ForEach{.}{\item ...
5
votes
1answer
43 views

csuse with foreach

Am having difficulty determining the correct syntax for using \csuse from the etoolbox package with a \foreach. I have a list, and for each element in this list I need to create a new list. To ...
6
votes
3answers
174 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 ...
4
votes
1answer
66 views

Extract from a token containing a list with math content

I have a token which contains a list consisting of: a date in YYYY-MM-DD format, followed by a colon, and some text which may contain math. The text will consist of a sentence or two (i.e., no ...
4
votes
2answers
137 views

How to use { and } as delimiter instead of active character in this example

How to use { and } as delimiter instead of active caractere in this example ? I'd like [360] [90] [7,2] as output of foreach command instead of this. I need a string foreach compatible, splited on ; ...
3
votes
2answers
68 views

Generate comma separated list with some non-empty strings

I'm trying to generate a comma separated list that uses strings that may or may not be empty. For example \mylist{\stringA,\stringB,\stringC} would expand to A, C if B is empty or B, C if A is empty, ...
3
votes
1answer
53 views

Beamer and a for each loop

I'm using the beamer presentation package and trying to combine the examples from this post How to iterate over a comma separated list? with the beamer package. In modifying the top example, chaning ...
3
votes
1answer
76 views

Check if a number is in a comma separated list (print or display selected sections from a specific list)

I'm trying to check if a section number belongs to a specified list: \ifnum\value{section}=\mylist % check if section number in mylist --- WRONG \dosomething \fi The conditional is ...
34
votes
10answers
2k 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
1answer
102 views

Macro expanding to comma separated list

I'm trying to use a macro for pgfplotstable labels but the macro is treated as a single entry of a csl rather than a csl. The Question asked in Using a macro as value of addtotoc in \includepdf ...
11
votes
2answers
343 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 ...
7
votes
2answers
178 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 ...
5
votes
1answer
50 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 ...
2
votes
1answer
78 views

What is the right number of #’s for nested sequence mappings?

Im trying to nest two sequence mappings, which works so far but I want to use them inside a command definition so the <items> should be accessible as ##1 and ###1 but this won’t work. Is it ...
11
votes
2answers
177 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
4answers
405 views

Decimal separator and axis label centering with Tikz

The following code creates a figure with Tikz without the use of pfgplots (that I want to avoid here): % compilation: pdflatex --jobname=Runge-f1 Runge.tex \documentclass[12pt]{book} ...
1
vote
0answers
38 views

Math lists: commas inside or outside of math mode? [duplicate]

I am wondering whether to use that (1) $A_{a}, B_{b}, C_{c}$ # comma in math mode or that (2) $A_{a}$, $B_{b}$, $C_{c}$ # multiple math modes, comma outside math mode Any good reasons for ...
23
votes
10answers
1k views

Get the head, the tail, and the last element of a comma-separated list

I have a comma-separated list, stored in a macro. It is non-empty, and it has commas between the elements but not at the start or end. How can I get: the first element (a.k.a. the "head")? the last ...
4
votes
1answer
149 views

Append two lists for TikZ foreach loop

How can I make a TikZ foreach loop iterate over two lists consecutively? I had hoped that in my code below, the expression \firstlist,\secondlist would evaluate to 2,3,5,7,1,4,6, but it doesn't work. ...
8
votes
2answers
260 views

PDF keywords from Expl3 clist

I’m trying to add PDF keywords to my résumé. In the custom class file, I have these lines: \clist_new:N \jcsres_keywords_clist \NewDocumentCommand \keywords {m} { \clist_gset:Nn ...
19
votes
2answers
323 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} ...
7
votes
2answers
154 views

Deleting an element from a comma separated list

In this answer we learnt how to remove the n-th element from a comma-separated list. How can I remove an element from a list by its value, rather than its position? For example: if my global variable ...
2
votes
1answer
177 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} ...
7
votes
3answers
136 views

Sorting to match a given list

I am looking for ideas on the following task. I want to sort the entries in \listb to those in \lista. It cannot always be assumed that only the elements of \lista are in \listb; neither can it be ...
3
votes
2answers
72 views

Reading arguments in a command?

I now know that if I want to get for example the 3rd argument passed to a command, I have use #3. My question is if this argument is an array how can I read elements of array without a for loop? For ...
18
votes
4answers
449 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.
9
votes
2answers
244 views

Confusion regarding strings and numbers in tikz

I'm using a macro that uses \StrBetween from xstring It seems to be working great. However, when I try to use a value that it returns as a coordinate in a tikz picture, I get a confusing error. ...
7
votes
1answer
155 views

Getting a random sublist from a given list

The etoolbox package provides macros to handle list, which can be useful to package/class writers, however it miss macros to get random sublists. So I want to define the following macros: ...
3
votes
1answer
69 views

List Version of \str_if_eq

I am using \str_if_eq:xxTF{\A}{\Target}{<true>}{<false} to execute the <true> or <false> code if \A=\Target. What is the list version equivalent of this? So I am looking for ...
10
votes
2answers
192 views

How to set class options that can have multiple values?

Title says it all, but here's an example: the KOMA-Script classes provide the option toc which can have multiple values that don't interfere with each other, like values that enable the Bibliography ...
5
votes
2answers
162 views

List delimited by commas (not lines)

Note: Comma delimited lists is not a duplicate. What I want to do is have a list environment of items, like itemize and enumerate, but I want the output to be delimited by commas instead of new ...
4
votes
2answers
731 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
460 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 ...
11
votes
4answers
666 views

How to make a recursive Latex macro with comma separated argument list

I would like to make a macro that takes two arguments, the second of which is a comma separated list and then produces a nested commutator of argument1 with each entry of argument2. I've been ...
6
votes
3answers
147 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 ...
7
votes
3answers
589 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 ...
13
votes
3answers
538 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 ...
11
votes
1answer
200 views

Using etoolbox to automatically generate input for \xymatrix

I'd like to make a command \exactseq such that, for example, \exactseq{A,f,B,g,C} corresponds to \xymatrix{A \ar[r]^{f} & B \ar[r]^{g} & C} and such that this works for inputs of ...
3
votes
1answer
203 views

Comma in macro parameters

I have a macro accepting several optional arguments in a comma separated list. I would like to assign a value containing a comma to a particular argument. Is there a way to "escape" this particular ...
6
votes
1answer
162 views

Problem with old ConTeXt separated list example

I have been trying to get the following small example from ConTeXt garden to work without success. \starttext \usemodule[database] \def\SendMe#1#2#3#4{\framed [align={flushleft,lohi}, width=4cm, ...
3
votes
1answer
463 views

How to create a comma-separated list in LaTeX according to the number of elements in another list?

I have been looking for a way to create dynamically a comma-separated list consisting of n entries, all entries equal, defined by \newcommand\mytext{species:} (example) and n being the number of ...
18
votes
7answers
659 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} ...
12
votes
1answer
474 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 ...
4
votes
2answers
366 views

Cutting a table to fit the available space on a page

I have a long list of data, in a CSV file, formatted like this: tiger, 300, 10.0, 7, 4.0 lion, 200, 15.0, 5, 3.0 bear, 100, 15.0, 3, 1.0 fish, 10, 10.0, 2, 0.1 The first rows are more important ...
8
votes
2answers
146 views

Mapping a macro onto multiple lists simultaneously

I have a macro (say \myMacro) that takes three arguments (say a, b, c) and I want to write another macro (say \otherMacro) that given three lists of parameters (comma delimited lists and all of the ...
5
votes
2answers
548 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 ...
7
votes
1answer
538 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} ...
6
votes
1answer
282 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 ...
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 ...
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 ...