Questions tagged [comma-separated-list]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
21 views

Mapping a expl3 clist to a list of command sequences

I am trying to map a clist to a clist of command sequences using \csname \endcsname and then using clist_use to print the list: Here is the MWE: \documentclass{article} \usepackage{xparse} \...
0
votes
1answer
44 views

How to create a list variable in LaTeX using a start and end value?

I am creating a new class file and a new command to do some calculations inside it. Part of the command is given below \newcommand{\myCommand}[3]{ \newcounter{var1} \newcounter{var2} \newcounter{Var3} ...
2
votes
3answers
42 views

How to get the first length in a list

I need to get the first length in a list of lengths and store it in a variable. This is what I got so far: \documentclass[12pt,a4paper]{article} \newlength{\mylength} %% does not work at all %\...
2
votes
1answer
25 views

Modifying a list and passing it to another command

I am trying to write some macros to easy my life while writing mathematics in LaTeX. For this, I would like to have some macros to write wedge products in a more concise manner. I have a command which ...
4
votes
2answers
44 views

Define macros from a list processed by the listofitems package

I wanted to distinguish the control variables of different agents in a separate color so that my students can read examples more easily. To do so, I wanted to write a macro \definevar{x,y;z} that I ...
1
vote
1answer
46 views

A problem with the listofitems package

Using MiKTeX 2.9 on Windows 10 I've run into a problem with listofitmes. In the code shown: % arara: xelatex: { shell: true } \documentclass{article} \usepackage{fontspec} \usepackage{...
8
votes
3answers
196 views

User friendly array definition macro

I am working on a custom documentclass where there may be one or multiple authors in a document. Normally, one would simply specify \author{} and call some additional macros to set some special values,...
3
votes
2answers
54 views

Feeding a list into a tabular with listofitems

I am using listofitems package to parse a list. Then I want to feed the result into a table (with particular details depending on the items indices). As the first step, I tried to just iterate over ...
2
votes
2answers
58 views

Process Comma Separated List from Key Value (expl3)

I'm trying to \SplitList / \ProcessList a clist set in a wrapper command's argument as the value of a key. Unfortunately, it seems that the original command (\mycmd below) doesn't recognize the input ...
3
votes
2answers
53 views

Parsing non-comma-separated lists in TikZ environment

In this answer I saw that we can use [<new pgf key>/.code={...}, <new pgf key>] to smuggle in some code into the construction of a TikZ path. This approach works if all coordinates have a ...
11
votes
6answers
361 views

Command with arguments separated by comma II (typically an easy way to write matrices)

Since I am using 2 x 2 matrices very frequently, I would like to define a command which would work like this: \matr{a, b, c, d} would produce $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$. Of ...
1
vote
1answer
56 views

Evaluate each element in a computed comma separated list

I have a permutated list which I sort, which I then use as shades for some TikZ figures. \documentclass{article} \usepackage{expl3, tikz} \ExplSyntaxOn \clist_new:N \l_my_clist \NewDocumentCommand{\...
1
vote
1answer
65 views

Iterating over two lists of text elements (or a list of pairs)

Let's assume I have two lists of text elements - L1,L2,L3,...,Ln and R1,R2,R3,...Rn - or a list of pairs - (L1,R1),(L2,R2),(L3,R3),...,(Ln,Rn). I want to iterate over them in order to produce an ...
2
votes
1answer
48 views

Create a nested comma-separated-list from a CSV file

In my Latex document I define a nested list that looks like this: \def\recipes{ { test1@ test2@ test3@ test4@ test5a*test5b@ test6a*test6b }, { test1@ test2@ test3@ test4@ test5a*test5b@ test6a*test6b ...
2
votes
1answer
26 views

Manually add an entry to the list of tracked entries

I feel like I'm missing something simple, but I can't manage to write a macro to manually add an entrykey to the list of tracked entries in biblatex such that \ifciteseen will be true. What am I doing ...
0
votes
1answer
71 views

How to auto-complete with comma-separated citations?

I am using TexMaker and I want my editor to auto-complete the \parencite{} command for biblatex for any number of arguments. I already added \parencite{#bib#} in User > customize Completion, but I ...
0
votes
0answers
38 views

Get results for multiple audiences at once

I had previously used the multiaudience package without any problem. But now I have a document with multiple audiences and I need to get the result for two audiences at once. I have 5 audiences, ...
5
votes
5answers
80 views

Pairing items from two comma-separated lists into a single list

How to pair items from two comma-separated lists (assuming they have the same length) in another list? I did my best looking for the answer before asking… so I do hope this is not a duplicate! For ...
0
votes
0answers
21 views

Make a list in of strings in LaTeX which can be indexed in \foreach

I have a tikz picture like so: \begin{tikzpicture} \begin{axis}[ width=0.9\linewidth, height=0.25\textheight, legend pos=north west, ymin=0, ] \foreach \yindex in {2,...,7} { ...
0
votes
1answer
33 views

How to get rid of last comma

I am using the following code to print a list of all characters that say something in a given scene of a play-script. \newcommand\sceneroles[2][Roles]{% \def\scenename{#2}% \textbf{#1}:% \Bind{?...
0
votes
1answer
55 views

Remove last comma in list of birthdays in each day of calendar (tikz)

I am adopting this calendar (https://texample.net/tikz/examples/birthday-calendar/) to my needs, but I have a problem I cannot solve on my own. In each single day grid, how can I get rid of the last ...
2
votes
1answer
72 views

Creating dynamic list variable with repeat command

I need to create a list in LaTeX with n people and their respective sex: \adduser[M]{Pedro Jose} \adduser[M]{John Scar} \adduser[F]{Leila Brew} ... \adduser[F]{Larissa Yik} When I compile it using ...
0
votes
0answers
36 views

Define a new command to wrap \cref

I am typesetting an MCQ exam paper. There are a few questions where there exists a block of information, and the student is prompted to use that information to answer several questions that follow, ...
0
votes
0answers
142 views

Are there 'general' journal abbreviation files/packages for BibTeX/LaTeX? or: Can BibTeX/LaTeX use lists from Endnote (Mendeley, JabRef)?

Many publishers ask for abbreviations for journal names in the bibliography. I have checked the links which either need to build the list from the start: is there a tool , or is there a transparent ...
2
votes
1answer
132 views

How to create comma separated list as the argument of a macro or command?

In the following MWE, I tried to create a command (but I also tried with a macro) that receives #1 argument. In this case, I am trying to create a comma separated list. However, as shown in the figure ...
4
votes
1answer
381 views

How to get the index variable in the foreach loop

I have the following MWE: \documentclass{article} \usepackage{pgf, tikz} \setlength{\parskip}{0.5cm} \begin{document} \textbf{Comprehensive knowledge storage follows the evolutionary sequence given ...
2
votes
1answer
48 views

Macro to apply a custom command to a conditional datatool definition

This is somewhat of an expansion of the previous question:Macro to apply a custom command across a comma-separated list I'm working on creating a garden journal in LaTex. I have a .csv database file ...
1
vote
2answers
54 views

datatool DTLgetvalue using foreachitem

The following code is supposed to get values from the first row of mydata.csv and then copy values to a new empty row. I am using foreachitem to pass the key to the DTLgetvalue function. It compiles, ...
4
votes
4answers
501 views

Building and using a list

I made a macro for subtracting two lists which does what was intended. Then, I found a set-up, here on TeX.SE, with the macro \g@addto@macro and \@gobble which is much simpler and gives, in principle, ...
2
votes
3answers
375 views

Read csv values as key-value pairs [duplicate]

I have a csv file that contains the following: "N","n","M" 200,100,50 How can I read it with LaTeX such that \N, \n_trees and \M then returns respectively 200, 100 and 50 ? Or some other internal ...
3
votes
2answers
164 views

Automatically use \cr or & (for matrices) in macro?

I'm trying to write a macro to abstract different possible representations of matrices. In particular, we're changing whether we want to represent a particular matrix as a column or row vector. My ...
1
vote
1answer
167 views

Providing command key-value arguments with commas in value

When using commands that allow using key-value pairs, how can one provide an argument value that has commas in it? As an example, say I'm using the \newacronym command from the glossaries package as ...
0
votes
0answers
29 views

How to use macro as a `foreach` range? [duplicate]

These two loops do not produce the same result: \documentclass{article} \usepackage{tikz} \begin{document} \foreach \i in {a,b,c} {% \i+ } \def\Index{a,b,c} \foreach \i in {\Index} {% \i+ ...
5
votes
2answers
190 views

Fast membership test for integer lists/sets

Say we have big list of integer numbers, stored as comma-separated values in a macro or token register. Now we want to test in a loop for every integer n = 1, 2, ..., N if n occurs in the list of ...
7
votes
1answer
152 views

Commas in \clist_map_inline:nn split values in undesired places

I am curious about the workings of \clist_map_inline:nn. I have a list of sentences. This list is has no fixed length. Sometimes, the list may contain 2 sentences, or 10 sentences etc. So, I came ...
3
votes
2answers
82 views

Why using a variable as index of a list-item does not retrieve that item with \clist_item:Nn?

For some reason, using a variable as index of a list-item does not work for retrieving that item. But using a number instead of a variable works. Why? \documentclass{standalone} \usepackage{expl3} \...
2
votes
2answers
275 views

How to check if comma list is empty?

How do I check if \myList is empty? Following (is my attempt) prints "NOT empty" when, in fact, the list is empty. \documentclass{standalone} \usepackage{expl3} \begin{document} \ExplSyntaxOn \...
2
votes
1answer
55 views

How to suppress comma list from outputting its values on declaration?

I need to suppress the display of the comma list on its declaration. I just need comma-list variable to store the list, not display it. \documentclass{standalone} \usepackage{expl3} \begin{document} ...
4
votes
2answers
116 views

converting several comma-separated lists into a table, one column per list

I have been searching on here for information about comma separated lists, but the only info I have found is how to sort, or iterate over a single list, which isn't quite what I need. If there is a ...
11
votes
1answer
228 views

Combine `map` and `use` expl3 macros

I'm trying to build a macro that processes a comma-separated-list of elements so that: \MapAndUse{a,b,c} would produce: My first intuition is to use a expl3 combination of \seq_map* to process each ...
6
votes
2answers
64 views

Make a CSV out of a \IfStrEqCase list

I have a macro \DefineStrEqCaseMacro which defines a macro that selects a value based on a parameter. With this, I am trying to replace the manual method: \newcommand*{\SelectBasedOnValue}{beta}% ...
5
votes
4answers
173 views

Command to format any number of equations

I am reading many entries here on comma-separated list of arguments in new commands. I cannot get them to adapt to my needs, so here I come with my question. I'd like a command like so: \eqsRef{equ:...
3
votes
3answers
812 views

Iterate over part of a list

I know that the package etoolbox has a \foreach command. I want to set a list once an use it multiple times. In the example, I would set \mylist equal to the comma separated value list 10,20,30,40,...
2
votes
1answer
127 views

expl3 read a comma list from file

I am using expl3 now, I want to read data from file, and store them in a comma list, then use the comma list one by one. I don't have any code, I just know exp13 have these function, so need someone ...
2
votes
1answer
51 views

No hyperref with a comma separated list and ExplSyntax

I was following the answers to How to iterate over a comma separated list? and especially the way working with ExplSyntax. But the hyperref does not work with the \clist_map_inline:nn however it ...
2
votes
1answer
24 views

Process first or last case differently with clist_map

I wrote this macro to transform a comma-separated list of objects into a custom-separated list of objects: \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\separators}{m}{% \clist_map_inline:...
2
votes
1answer
116 views

How to parse a custom \author format using xparse?

I want to allow using the \author command like this: \author{John Doe <john.doe@example.com>, Someone Else <someone@example.com>} And later parse the value to something like this: \...
0
votes
1answer
110 views

Calling Lua on the output of a \@for loop to add “and” to the end of a comma-separated list

I'm trying to make a package-free command that applies a command across a comma-separated list, and then adds the word ``and'' to the output as is grammatically appropriate. I've already gotten some ...
4
votes
4answers
206 views

Macro to apply a custom command across a comma-separated list

I want to make an apply function that can apply any single-argument command to a comma-separated list of arguments, and print the results separated by commas. (ETA: I want to make the command from ...
1
vote
2answers
182 views

Why is there a conflict between \kern and this Separator & customized-Tooltips command

Because the MWE below uses the line LINE 1: \def\anyX#1{#1} %%% OK it compiles without a hassle. If one replaces LINE 1 with the (also included in the MWE) following line (but uncomment it): LINE ...