Questions tagged [comma-separated-list]
{comma-separated-list} is a data format consisting of fields, most commonly separated by commas
170
questions
0
votes
0
answers
11
views
Formated glossary with items separated by ";" (semicolon) and the last element of the list ending with "." (period)
I'm trying to create a glossary list with items separated by " ; ", penultimate element with " ; and " and the last element ending with a " . ".
I've tried to format it, ...
0
votes
0
answers
22
views
Error combining separators using || in listofitems
I have noticed that .- may cause trouble if chosen as a separator with two or more other separators. Below minimal example compiles, but the line \bar{(w1) .- (w2)} that is commented out will throw ...
3
votes
1
answer
76
views
Automatic listing of authors in a document
I have a command \by{ } that lets me list authors of an article like this:
\by{
{author 1}{tagline} \\
{author 2}{tagline} \\
{author 3}{tagline} \\
<etc.>
}
I would like to store author 1, ...
0
votes
1
answer
38
views
How to append the graphics path in a for-loop?
Objective
I wanted to create a command that enables me to add a collection of paths in a comma-separated list to my graphics path, next to a bunch of other instructions for each path that I will not ...
1
vote
1
answer
95
views
Parsing of comma-separated list for \foreach
I am using PGF's \foreach on comma-separated list where the items may contain spaces; each item can be enclosed in {...} if it contains space, that works fine. Now, what happens when there is only a ...
0
votes
0
answers
54
views
How do I check if a list item is blank when it is passed as a parameter in LaTex?
I'm trying to create a command that accepts two lists using the \listofitems package where the first list is optional.
In the command I want to check if the first entry in the optional list is "...
2
votes
1
answer
195
views
Command for comma in math or text mode
I have the following csv file (myCSVfile.csv) which contains header with LaTeX code:
$T_{1,2}$,
$T_{3}$
100,
300
200,
500
In my LaTeX document, I import this table with \pgfplotstabletypeset[col ...
0
votes
0
answers
26
views
How to choose separating symbol in citations?
Currently my citations are like:
"blah blah (1) blah blah blah (2-6) blah blah blah blah (7,8)"
But I need that "(7,8)" to be "(7-8)". I'm using abntex2cite package, ...
2
votes
1
answer
54
views
Comma separated values list in pgfkey is not a list
The question might be dumb but I can't find an adequate solution.
If I put a comma separated value list as parameter using pgfkeys, then the result of pgfkeysvalueof is an atomic value and not a list.
...
0
votes
1
answer
37
views
Grab variable number of tokens – xparse macro
I'm trying to create the following macro:
\adddescr{<comma separated list>}{<description 1>}...{<description n>}
this macro should print element -- description \par accordingly, so ...
4
votes
1
answer
261
views
Create macro with variable number of comma separated arguments in plain TeX?
I wish to create two macros: one that takes a known number, and another that takes an unknown number of arguments that are comma-separated and does something with them. There have been a few answers ...
3
votes
1
answer
109
views
How can I parse a clist into a keyval prop?
I'm trying to store a comma-separated list into a key-value property to use it later, but I can't get it to work properly.
I don't really understand how latex parses a keyval parameter but my guess is ...
12
votes
6
answers
2k
views
How can I create a comma-separated list of characters from a text string?
How can I split the string Hello World! - stored into a macro \def\mystring{Hello Word!} - into a comma-separated list of characters (including spaces) which can be used as argument of a \foreach loop ...
0
votes
1
answer
130
views
expl3: Print a polynomial out of coefficients stored in a row of CSV file
Following up this answer, how to robustly use the values stored in \getRow as coefficients of a polynomial to be printed?
Also, I need to have an argument of the symbol to be used in the polynomial. (...
1
vote
2
answers
160
views
Creating a table from a comma separated list in LaTeX3
I have a comma separated list and want to create a table from it, like so:
\documentclass[margin=0.1cm]{standalone}
\usepackage{expl3}
\begin{document}
\begin{tabular}{c | c}
\...
4
votes
2
answers
118
views
How to use \clist_map_tokens:Nn?
p. 175: \clist_map_tokens:Nn⟨clist var⟩{⟨code⟩} calls ⟨code⟩{⟨item⟩} for every ⟨item⟩stored in the ⟨comma list⟩. If the ⟨code⟩consists of a single function this is equivalent to \clist_map_function:nN....
0
votes
1
answer
50
views
Expansion while processing math in lists with xparse
I'm trying to "print" a comma-separated list of strings. The actual use case is more complex, the list being stored as a key-value, but the MWE below shows the problem: when I add math to ...
2
votes
1
answer
145
views
Latex3 and \foreach: Do common operation over list of clist variables
I am trying to learn LaTeX3. In writing one of my projects I faced a situation in which is usefull working with short comma-separated lists, testing whether they are empty, have only one item, etc ...
...
1
vote
1
answer
75
views
How to Shift Comma Inside Closing Quotes in Index
Consider the MWE
\documentclass{book}
\usepackage{imakeidx}
\makeindex
\usepackage{idxlayout}
\usepackage{xcolor}
% Make all page numbers in index bold
\let\oldindex\index
\renewcommand{\index}[1]{%
...
0
votes
1
answer
114
views
Adding comma if exactly two authors from *.bst file (bibtex)
I'm using bibtex with a custom .bst file for the thesis. Unfortunately, the .bst file doesn’t produce a comma separating the author names when there are only two authors, and I need to add this comma.
...
2
votes
2
answers
116
views
LaTeX3: Parse CSV list stored in macro
This question is kind-of follow-up to answer given to this question: How to iterate over a comma separated list?
The difference is, that I want to iterate over a csv list stored in a macro \myTerms. ...
1
vote
1
answer
88
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}
\...
2
votes
3
answers
91
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
1
answer
38
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
2
answers
116
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
1
answer
468
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
3
answers
230
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,...
4
votes
2
answers
177
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
2
answers
115
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
2
answers
93
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
6
answers
547
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
1
answer
91
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
1
answer
114
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
1
answer
324
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
1
answer
41
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 ...
1
vote
1
answer
183
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 ...
2
votes
2
answers
139
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
5
answers
133
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
1
answer
48
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
1
answer
122
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
1
answer
111
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
0
answers
69
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
0
answers
215
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
1
answer
330
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
1
answer
594
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
1
answer
95
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
2
answers
114
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
4
answers
624
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
3
answers
839
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
2
answers
224
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 ...