Is there a possibility to generate a list dynamically in Latex?Extracting the structure of a LaTex document, including commentsEnumerate and itemize undefined + captions not workingHow do I generate a check-list?Generate List/Array of RequirementsHow to make itemize/enumerate/description environment robust to missing item elements?How do I generate in LaTeX a list of random questions avoiding repetitions?How to generate unordered list with hyphen?How can I create a better pseudo-enumerated list unconstrained by any environmentAuto generate list-items within table from string with delimitercross-referencing two long lists; general recommendations?Generate an iterable list
Error message with tabularx
Can someone publish a story that happened to you?
What does it mean to express a gate in Dirac notation?
Does holding a wand and speaking its command word count as V/S/M spell components?
Critique of timeline aesthetic
Does Gita support doctrine of eternal cycle of birth and death for evil people?
What language was spoken in East Asia before Proto-Turkic?
Is the 5 MB static resource size limit 5,242,880 bytes or 5,000,000 bytes?
What happened to Captain America in Endgame?
Fizzy, soft, pop and still drinks
French for 'It must be my imagination'?
Combinable filters
Pulling the rope with one hand is as heavy as with two hands?
Realistic Necromancy?
How to reduce LED flash rate (frequency)
How to stop co-workers from teasing me because I know Russian?
Rivers without rain
How to creep the reader out with what seems like a normal person?
What is the strongest case that can be made in favour of the UK regaining some control over fishing policy after Brexit?
Why isn't the definition of absolute value applied when squaring a radical containing a variable?
Which big number is bigger?
What route did the Hindenburg take when traveling from Germany to the U.S.?
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
Reducing vertical space in stackrel
Is there a possibility to generate a list dynamically in Latex?
Extracting the structure of a LaTex document, including commentsEnumerate and itemize undefined + captions not workingHow do I generate a check-list?Generate List/Array of RequirementsHow to make itemize/enumerate/description environment robust to missing item elements?How do I generate in LaTeX a list of random questions avoiding repetitions?How to generate unordered list with hyphen?How can I create a better pseudo-enumerated list unconstrained by any environmentAuto generate list-items within table from string with delimitercross-referencing two long lists; general recommendations?Generate an iterable list
As stated, I wonder if there is any possibility to dynamically add items to a list and print it anywhere in the document, regardless of where the definitions are made.
I'm thinking something like this:
documentclass[a4paper,12pt]article
defineListMyListName
begindocument
beginitemize
printlistMyListName
enditemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument
and this would then result in something like this (in essence, the printlistMyListName merely acts as a macro and is replaced by the content of the list:

Of course, being able to iterate over the list items would be even more elegant, however it might introduce too much complexity.
lists
add a comment |
As stated, I wonder if there is any possibility to dynamically add items to a list and print it anywhere in the document, regardless of where the definitions are made.
I'm thinking something like this:
documentclass[a4paper,12pt]article
defineListMyListName
begindocument
beginitemize
printlistMyListName
enditemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument
and this would then result in something like this (in essence, the printlistMyListName merely acts as a macro and is replaced by the content of the list:

Of course, being able to iterate over the list items would be even more elegant, however it might introduce too much complexity.
lists
Is it your intent that later defineditems are printed earlier in the document, at the instance ofprintlist? Alatableofcontents?
– Steven B. Segletes
Apr 23 at 15:07
One can put pretty much anything into @currentlabel and use label and ref to access it. ( Pgfplots puts the entire legend into a ref.) All you need is a label naming convention.
– John Kormylo
Apr 23 at 15:21
An answer like this, tex.stackexchange.com/questions/202574/…, may be exactly what you are looking for.
– Steven B. Segletes
Apr 23 at 15:24
add a comment |
As stated, I wonder if there is any possibility to dynamically add items to a list and print it anywhere in the document, regardless of where the definitions are made.
I'm thinking something like this:
documentclass[a4paper,12pt]article
defineListMyListName
begindocument
beginitemize
printlistMyListName
enditemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument
and this would then result in something like this (in essence, the printlistMyListName merely acts as a macro and is replaced by the content of the list:

Of course, being able to iterate over the list items would be even more elegant, however it might introduce too much complexity.
lists
As stated, I wonder if there is any possibility to dynamically add items to a list and print it anywhere in the document, regardless of where the definitions are made.
I'm thinking something like this:
documentclass[a4paper,12pt]article
defineListMyListName
begindocument
beginitemize
printlistMyListName
enditemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument
and this would then result in something like this (in essence, the printlistMyListName merely acts as a macro and is replaced by the content of the list:

Of course, being able to iterate over the list items would be even more elegant, however it might introduce too much complexity.
lists
lists
asked Apr 23 at 15:04
chrillofchrillof
261
261
Is it your intent that later defineditems are printed earlier in the document, at the instance ofprintlist? Alatableofcontents?
– Steven B. Segletes
Apr 23 at 15:07
One can put pretty much anything into @currentlabel and use label and ref to access it. ( Pgfplots puts the entire legend into a ref.) All you need is a label naming convention.
– John Kormylo
Apr 23 at 15:21
An answer like this, tex.stackexchange.com/questions/202574/…, may be exactly what you are looking for.
– Steven B. Segletes
Apr 23 at 15:24
add a comment |
Is it your intent that later defineditems are printed earlier in the document, at the instance ofprintlist? Alatableofcontents?
– Steven B. Segletes
Apr 23 at 15:07
One can put pretty much anything into @currentlabel and use label and ref to access it. ( Pgfplots puts the entire legend into a ref.) All you need is a label naming convention.
– John Kormylo
Apr 23 at 15:21
An answer like this, tex.stackexchange.com/questions/202574/…, may be exactly what you are looking for.
– Steven B. Segletes
Apr 23 at 15:24
Is it your intent that later defined
items are printed earlier in the document, at the instance of printlist? Ala tableofcontents?– Steven B. Segletes
Apr 23 at 15:07
Is it your intent that later defined
items are printed earlier in the document, at the instance of printlist? Ala tableofcontents?– Steven B. Segletes
Apr 23 at 15:07
One can put pretty much anything into @currentlabel and use label and ref to access it. ( Pgfplots puts the entire legend into a ref.) All you need is a label naming convention.
– John Kormylo
Apr 23 at 15:21
One can put pretty much anything into @currentlabel and use label and ref to access it. ( Pgfplots puts the entire legend into a ref.) All you need is a label naming convention.
– John Kormylo
Apr 23 at 15:21
An answer like this, tex.stackexchange.com/questions/202574/…, may be exactly what you are looking for.
– Steven B. Segletes
Apr 23 at 15:24
An answer like this, tex.stackexchange.com/questions/202574/…, may be exactly what you are looking for.
– Steven B. Segletes
Apr 23 at 15:24
add a comment |
3 Answers
3
active
oldest
votes
You can use the .aux file.
With defineList we initialize a sequence variable; each addToList command writes in the .aux file the corresponding entry as argument to chrillofaddtolist.
When the .aux file is read in at begin document, the sequence is populated with the items gathered in the previous run so it will be available as soon as the document starts.
The command chrillofaddtolist is made a no-op at end document, when the .aux file is read back in, but we need no action.
Finally, printList just delivers the sequence.
As a technical workaround, I added a litemize environment, so no error is raised when the sequence is still empty.
documentclass[a4paper,12pt]article
usepackagexparse
ExplSyntaxOn
NewDocumentCommanddefineListm
seq_new:c g_chrillof_list_#1_seq
NewDocumentCommandaddToListmm
iow_shipout:cn @auxout chrillofaddtolist #1 #2
NewDocumentCommandchrillofaddtolistmm
seq_gput_right:cn g_chrillof_list_#1_seq #2
NewDocumentCommandprintListm
seq_use:cn g_chrillof_list_#1_seq
AtEndDocumentcs_set_eq:NN chrillofaddtolist use_none:nn
ExplSyntaxOff
makeatletter
newenvironmentlitemize
let@noitemerrrelaxitemize
enditemize
makeatother
defineListMyListName
begindocument
beginlitemize
printListMyListName
endlitemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument

add a comment |
The sagetex package, documentation here, gives you access to the Python programming language. This is one way to keep track of the list and print using a loop.
documentclassarticle
usepackagesagetex
begindocument
beginsagesilent
MyList = ["spring","summer"]
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
Lorem ipsum dolor sit amet...
beginsagesilent
MyList.insert(0,"winter")
MyList.append("fall")
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
enddocument
The result is shown below:
The "behind the scenes" work is done in sagesilent environment. The original list is created to contain "spring" and "summer". A for loop creates a string that will put the list into the itemize environment. To insert it into the document, use sagestr, the SAGE string environment. If we want to add "winter" to be first in the list and "fall" to be last, the command MyList.insert(0,"winter") puts "winter" in the first position (which in Python is the zeroth position). The command MyList.append("fall") puts "fall" at the end of the list, however long it is. The for loop prints out over the longer list since len(MyList) is the length of the list.
The extra block of code each time is a bit clunky but it is easy to read and modify. You also get the benefit of being able to insert into any part of the list. The sagetex package relies on the computer algebra system SAGE, which is not part of the LaTeX package. It either needs to be downloaded to your computer or you can open a free Cocalc account and work from the cloud.
add a comment |
Requires two passes. Based on my answer at Extracting the structure of a LaTex document, including comments, but adapting the syntax to meet the OP's needs.
Multiple lists can be simultaneously active. Here, in the MWE, I build "xyz" and "pdq" lists.
documentclassarticle
letsvaddtocontentsaddtocontents
makeatletter
newcommanddefineList[1]%
expandafterdefcsname add#1lineendcsname##1##2##3addtocontents ##1%
protect csname #1lineendcsname ##2##3
expandafterdefcsname write#1endcsname%
renewcommandaddtocontents[2]relax%
setcountersection0noindent%
expandafterdefcsname #1lineendcsname####1####2expandaftercsname####1endcsname####2%
@starttoc#1%
setcountersection0%
letaddtocontentssvaddtocontents%
%
csname add#1lineendcsname#1beginitemize%
AtEndDocumentcsname add#1lineendcsname#1enditemize
newcommandaddToList[2]csname add#1lineendcsname#1item#2
newcommandprintList[1]csname write#1endcsname
makeatother
begindocument
%tableofcontents% CAN UNCOMMMENT TO SEE THAT toc WORKS FINE
defineListxyz
defineListpdq
sectionIntroduction
addToListxyzFirst item on my list.
Text related to why tracking balls is important, blah, blah, blah.
Blah, blah, blah.
addToListpdqFirst pdq item
Here is my XYZ list:
printListxyz
sectionNext Section
addToListxyzSecond item on list
Text relating the challenges, blah, blah, blah.
More blah, blah, blah.
addToListpdqNext pdq item
addToListxyzThird item on list.
Here is my PDQ list:
printListpdq
Text relating the existing work on tracking balls, blah, blah, blah.
Blah, blah, blah.
enddocument

add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f486224%2fis-there-a-possibility-to-generate-a-list-dynamically-in-latex%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the .aux file.
With defineList we initialize a sequence variable; each addToList command writes in the .aux file the corresponding entry as argument to chrillofaddtolist.
When the .aux file is read in at begin document, the sequence is populated with the items gathered in the previous run so it will be available as soon as the document starts.
The command chrillofaddtolist is made a no-op at end document, when the .aux file is read back in, but we need no action.
Finally, printList just delivers the sequence.
As a technical workaround, I added a litemize environment, so no error is raised when the sequence is still empty.
documentclass[a4paper,12pt]article
usepackagexparse
ExplSyntaxOn
NewDocumentCommanddefineListm
seq_new:c g_chrillof_list_#1_seq
NewDocumentCommandaddToListmm
iow_shipout:cn @auxout chrillofaddtolist #1 #2
NewDocumentCommandchrillofaddtolistmm
seq_gput_right:cn g_chrillof_list_#1_seq #2
NewDocumentCommandprintListm
seq_use:cn g_chrillof_list_#1_seq
AtEndDocumentcs_set_eq:NN chrillofaddtolist use_none:nn
ExplSyntaxOff
makeatletter
newenvironmentlitemize
let@noitemerrrelaxitemize
enditemize
makeatother
defineListMyListName
begindocument
beginlitemize
printListMyListName
endlitemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument

add a comment |
You can use the .aux file.
With defineList we initialize a sequence variable; each addToList command writes in the .aux file the corresponding entry as argument to chrillofaddtolist.
When the .aux file is read in at begin document, the sequence is populated with the items gathered in the previous run so it will be available as soon as the document starts.
The command chrillofaddtolist is made a no-op at end document, when the .aux file is read back in, but we need no action.
Finally, printList just delivers the sequence.
As a technical workaround, I added a litemize environment, so no error is raised when the sequence is still empty.
documentclass[a4paper,12pt]article
usepackagexparse
ExplSyntaxOn
NewDocumentCommanddefineListm
seq_new:c g_chrillof_list_#1_seq
NewDocumentCommandaddToListmm
iow_shipout:cn @auxout chrillofaddtolist #1 #2
NewDocumentCommandchrillofaddtolistmm
seq_gput_right:cn g_chrillof_list_#1_seq #2
NewDocumentCommandprintListm
seq_use:cn g_chrillof_list_#1_seq
AtEndDocumentcs_set_eq:NN chrillofaddtolist use_none:nn
ExplSyntaxOff
makeatletter
newenvironmentlitemize
let@noitemerrrelaxitemize
enditemize
makeatother
defineListMyListName
begindocument
beginlitemize
printListMyListName
endlitemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument

add a comment |
You can use the .aux file.
With defineList we initialize a sequence variable; each addToList command writes in the .aux file the corresponding entry as argument to chrillofaddtolist.
When the .aux file is read in at begin document, the sequence is populated with the items gathered in the previous run so it will be available as soon as the document starts.
The command chrillofaddtolist is made a no-op at end document, when the .aux file is read back in, but we need no action.
Finally, printList just delivers the sequence.
As a technical workaround, I added a litemize environment, so no error is raised when the sequence is still empty.
documentclass[a4paper,12pt]article
usepackagexparse
ExplSyntaxOn
NewDocumentCommanddefineListm
seq_new:c g_chrillof_list_#1_seq
NewDocumentCommandaddToListmm
iow_shipout:cn @auxout chrillofaddtolist #1 #2
NewDocumentCommandchrillofaddtolistmm
seq_gput_right:cn g_chrillof_list_#1_seq #2
NewDocumentCommandprintListm
seq_use:cn g_chrillof_list_#1_seq
AtEndDocumentcs_set_eq:NN chrillofaddtolist use_none:nn
ExplSyntaxOff
makeatletter
newenvironmentlitemize
let@noitemerrrelaxitemize
enditemize
makeatother
defineListMyListName
begindocument
beginlitemize
printListMyListName
endlitemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument

You can use the .aux file.
With defineList we initialize a sequence variable; each addToList command writes in the .aux file the corresponding entry as argument to chrillofaddtolist.
When the .aux file is read in at begin document, the sequence is populated with the items gathered in the previous run so it will be available as soon as the document starts.
The command chrillofaddtolist is made a no-op at end document, when the .aux file is read back in, but we need no action.
Finally, printList just delivers the sequence.
As a technical workaround, I added a litemize environment, so no error is raised when the sequence is still empty.
documentclass[a4paper,12pt]article
usepackagexparse
ExplSyntaxOn
NewDocumentCommanddefineListm
seq_new:c g_chrillof_list_#1_seq
NewDocumentCommandaddToListmm
iow_shipout:cn @auxout chrillofaddtolist #1 #2
NewDocumentCommandchrillofaddtolistmm
seq_gput_right:cn g_chrillof_list_#1_seq #2
NewDocumentCommandprintListm
seq_use:cn g_chrillof_list_#1_seq
AtEndDocumentcs_set_eq:NN chrillofaddtolist use_none:nn
ExplSyntaxOff
makeatletter
newenvironmentlitemize
let@noitemerrrelaxitemize
enditemize
makeatother
defineListMyListName
begindocument
beginlitemize
printListMyListName
endlitemize
Lorem ipsum dolor sit amet...
addToListMyListNameitem First
addToListMyListNameitem Second
enddocument

answered Apr 23 at 15:51
egregegreg
737k8919393267
737k8919393267
add a comment |
add a comment |
The sagetex package, documentation here, gives you access to the Python programming language. This is one way to keep track of the list and print using a loop.
documentclassarticle
usepackagesagetex
begindocument
beginsagesilent
MyList = ["spring","summer"]
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
Lorem ipsum dolor sit amet...
beginsagesilent
MyList.insert(0,"winter")
MyList.append("fall")
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
enddocument
The result is shown below:
The "behind the scenes" work is done in sagesilent environment. The original list is created to contain "spring" and "summer". A for loop creates a string that will put the list into the itemize environment. To insert it into the document, use sagestr, the SAGE string environment. If we want to add "winter" to be first in the list and "fall" to be last, the command MyList.insert(0,"winter") puts "winter" in the first position (which in Python is the zeroth position). The command MyList.append("fall") puts "fall" at the end of the list, however long it is. The for loop prints out over the longer list since len(MyList) is the length of the list.
The extra block of code each time is a bit clunky but it is easy to read and modify. You also get the benefit of being able to insert into any part of the list. The sagetex package relies on the computer algebra system SAGE, which is not part of the LaTeX package. It either needs to be downloaded to your computer or you can open a free Cocalc account and work from the cloud.
add a comment |
The sagetex package, documentation here, gives you access to the Python programming language. This is one way to keep track of the list and print using a loop.
documentclassarticle
usepackagesagetex
begindocument
beginsagesilent
MyList = ["spring","summer"]
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
Lorem ipsum dolor sit amet...
beginsagesilent
MyList.insert(0,"winter")
MyList.append("fall")
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
enddocument
The result is shown below:
The "behind the scenes" work is done in sagesilent environment. The original list is created to contain "spring" and "summer". A for loop creates a string that will put the list into the itemize environment. To insert it into the document, use sagestr, the SAGE string environment. If we want to add "winter" to be first in the list and "fall" to be last, the command MyList.insert(0,"winter") puts "winter" in the first position (which in Python is the zeroth position). The command MyList.append("fall") puts "fall" at the end of the list, however long it is. The for loop prints out over the longer list since len(MyList) is the length of the list.
The extra block of code each time is a bit clunky but it is easy to read and modify. You also get the benefit of being able to insert into any part of the list. The sagetex package relies on the computer algebra system SAGE, which is not part of the LaTeX package. It either needs to be downloaded to your computer or you can open a free Cocalc account and work from the cloud.
add a comment |
The sagetex package, documentation here, gives you access to the Python programming language. This is one way to keep track of the list and print using a loop.
documentclassarticle
usepackagesagetex
begindocument
beginsagesilent
MyList = ["spring","summer"]
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
Lorem ipsum dolor sit amet...
beginsagesilent
MyList.insert(0,"winter")
MyList.append("fall")
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
enddocument
The result is shown below:
The "behind the scenes" work is done in sagesilent environment. The original list is created to contain "spring" and "summer". A for loop creates a string that will put the list into the itemize environment. To insert it into the document, use sagestr, the SAGE string environment. If we want to add "winter" to be first in the list and "fall" to be last, the command MyList.insert(0,"winter") puts "winter" in the first position (which in Python is the zeroth position). The command MyList.append("fall") puts "fall" at the end of the list, however long it is. The for loop prints out over the longer list since len(MyList) is the length of the list.
The extra block of code each time is a bit clunky but it is easy to read and modify. You also get the benefit of being able to insert into any part of the list. The sagetex package relies on the computer algebra system SAGE, which is not part of the LaTeX package. It either needs to be downloaded to your computer or you can open a free Cocalc account and work from the cloud.
The sagetex package, documentation here, gives you access to the Python programming language. This is one way to keep track of the list and print using a loop.
documentclassarticle
usepackagesagetex
begindocument
beginsagesilent
MyList = ["spring","summer"]
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
Lorem ipsum dolor sit amet...
beginsagesilent
MyList.insert(0,"winter")
MyList.append("fall")
output = r"beginitemize"
for i in range(0,len(MyList)):
output += r"item %s"%(MyList[i])
output += r"enditemize"
endsagesilent
sagestroutput
enddocument
The result is shown below:
The "behind the scenes" work is done in sagesilent environment. The original list is created to contain "spring" and "summer". A for loop creates a string that will put the list into the itemize environment. To insert it into the document, use sagestr, the SAGE string environment. If we want to add "winter" to be first in the list and "fall" to be last, the command MyList.insert(0,"winter") puts "winter" in the first position (which in Python is the zeroth position). The command MyList.append("fall") puts "fall" at the end of the list, however long it is. The for loop prints out over the longer list since len(MyList) is the length of the list.
The extra block of code each time is a bit clunky but it is easy to read and modify. You also get the benefit of being able to insert into any part of the list. The sagetex package relies on the computer algebra system SAGE, which is not part of the LaTeX package. It either needs to be downloaded to your computer or you can open a free Cocalc account and work from the cloud.
answered Apr 23 at 16:56
DJPDJP
8,00921732
8,00921732
add a comment |
add a comment |
Requires two passes. Based on my answer at Extracting the structure of a LaTex document, including comments, but adapting the syntax to meet the OP's needs.
Multiple lists can be simultaneously active. Here, in the MWE, I build "xyz" and "pdq" lists.
documentclassarticle
letsvaddtocontentsaddtocontents
makeatletter
newcommanddefineList[1]%
expandafterdefcsname add#1lineendcsname##1##2##3addtocontents ##1%
protect csname #1lineendcsname ##2##3
expandafterdefcsname write#1endcsname%
renewcommandaddtocontents[2]relax%
setcountersection0noindent%
expandafterdefcsname #1lineendcsname####1####2expandaftercsname####1endcsname####2%
@starttoc#1%
setcountersection0%
letaddtocontentssvaddtocontents%
%
csname add#1lineendcsname#1beginitemize%
AtEndDocumentcsname add#1lineendcsname#1enditemize
newcommandaddToList[2]csname add#1lineendcsname#1item#2
newcommandprintList[1]csname write#1endcsname
makeatother
begindocument
%tableofcontents% CAN UNCOMMMENT TO SEE THAT toc WORKS FINE
defineListxyz
defineListpdq
sectionIntroduction
addToListxyzFirst item on my list.
Text related to why tracking balls is important, blah, blah, blah.
Blah, blah, blah.
addToListpdqFirst pdq item
Here is my XYZ list:
printListxyz
sectionNext Section
addToListxyzSecond item on list
Text relating the challenges, blah, blah, blah.
More blah, blah, blah.
addToListpdqNext pdq item
addToListxyzThird item on list.
Here is my PDQ list:
printListpdq
Text relating the existing work on tracking balls, blah, blah, blah.
Blah, blah, blah.
enddocument

add a comment |
Requires two passes. Based on my answer at Extracting the structure of a LaTex document, including comments, but adapting the syntax to meet the OP's needs.
Multiple lists can be simultaneously active. Here, in the MWE, I build "xyz" and "pdq" lists.
documentclassarticle
letsvaddtocontentsaddtocontents
makeatletter
newcommanddefineList[1]%
expandafterdefcsname add#1lineendcsname##1##2##3addtocontents ##1%
protect csname #1lineendcsname ##2##3
expandafterdefcsname write#1endcsname%
renewcommandaddtocontents[2]relax%
setcountersection0noindent%
expandafterdefcsname #1lineendcsname####1####2expandaftercsname####1endcsname####2%
@starttoc#1%
setcountersection0%
letaddtocontentssvaddtocontents%
%
csname add#1lineendcsname#1beginitemize%
AtEndDocumentcsname add#1lineendcsname#1enditemize
newcommandaddToList[2]csname add#1lineendcsname#1item#2
newcommandprintList[1]csname write#1endcsname
makeatother
begindocument
%tableofcontents% CAN UNCOMMMENT TO SEE THAT toc WORKS FINE
defineListxyz
defineListpdq
sectionIntroduction
addToListxyzFirst item on my list.
Text related to why tracking balls is important, blah, blah, blah.
Blah, blah, blah.
addToListpdqFirst pdq item
Here is my XYZ list:
printListxyz
sectionNext Section
addToListxyzSecond item on list
Text relating the challenges, blah, blah, blah.
More blah, blah, blah.
addToListpdqNext pdq item
addToListxyzThird item on list.
Here is my PDQ list:
printListpdq
Text relating the existing work on tracking balls, blah, blah, blah.
Blah, blah, blah.
enddocument

add a comment |
Requires two passes. Based on my answer at Extracting the structure of a LaTex document, including comments, but adapting the syntax to meet the OP's needs.
Multiple lists can be simultaneously active. Here, in the MWE, I build "xyz" and "pdq" lists.
documentclassarticle
letsvaddtocontentsaddtocontents
makeatletter
newcommanddefineList[1]%
expandafterdefcsname add#1lineendcsname##1##2##3addtocontents ##1%
protect csname #1lineendcsname ##2##3
expandafterdefcsname write#1endcsname%
renewcommandaddtocontents[2]relax%
setcountersection0noindent%
expandafterdefcsname #1lineendcsname####1####2expandaftercsname####1endcsname####2%
@starttoc#1%
setcountersection0%
letaddtocontentssvaddtocontents%
%
csname add#1lineendcsname#1beginitemize%
AtEndDocumentcsname add#1lineendcsname#1enditemize
newcommandaddToList[2]csname add#1lineendcsname#1item#2
newcommandprintList[1]csname write#1endcsname
makeatother
begindocument
%tableofcontents% CAN UNCOMMMENT TO SEE THAT toc WORKS FINE
defineListxyz
defineListpdq
sectionIntroduction
addToListxyzFirst item on my list.
Text related to why tracking balls is important, blah, blah, blah.
Blah, blah, blah.
addToListpdqFirst pdq item
Here is my XYZ list:
printListxyz
sectionNext Section
addToListxyzSecond item on list
Text relating the challenges, blah, blah, blah.
More blah, blah, blah.
addToListpdqNext pdq item
addToListxyzThird item on list.
Here is my PDQ list:
printListpdq
Text relating the existing work on tracking balls, blah, blah, blah.
Blah, blah, blah.
enddocument

Requires two passes. Based on my answer at Extracting the structure of a LaTex document, including comments, but adapting the syntax to meet the OP's needs.
Multiple lists can be simultaneously active. Here, in the MWE, I build "xyz" and "pdq" lists.
documentclassarticle
letsvaddtocontentsaddtocontents
makeatletter
newcommanddefineList[1]%
expandafterdefcsname add#1lineendcsname##1##2##3addtocontents ##1%
protect csname #1lineendcsname ##2##3
expandafterdefcsname write#1endcsname%
renewcommandaddtocontents[2]relax%
setcountersection0noindent%
expandafterdefcsname #1lineendcsname####1####2expandaftercsname####1endcsname####2%
@starttoc#1%
setcountersection0%
letaddtocontentssvaddtocontents%
%
csname add#1lineendcsname#1beginitemize%
AtEndDocumentcsname add#1lineendcsname#1enditemize
newcommandaddToList[2]csname add#1lineendcsname#1item#2
newcommandprintList[1]csname write#1endcsname
makeatother
begindocument
%tableofcontents% CAN UNCOMMMENT TO SEE THAT toc WORKS FINE
defineListxyz
defineListpdq
sectionIntroduction
addToListxyzFirst item on my list.
Text related to why tracking balls is important, blah, blah, blah.
Blah, blah, blah.
addToListpdqFirst pdq item
Here is my XYZ list:
printListxyz
sectionNext Section
addToListxyzSecond item on list
Text relating the challenges, blah, blah, blah.
More blah, blah, blah.
addToListpdqNext pdq item
addToListxyzThird item on list.
Here is my PDQ list:
printListpdq
Text relating the existing work on tracking balls, blah, blah, blah.
Blah, blah, blah.
enddocument

edited Apr 23 at 17:25
answered Apr 23 at 16:53
Steven B. SegletesSteven B. Segletes
163k9208421
163k9208421
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f486224%2fis-there-a-possibility-to-generate-a-list-dynamically-in-latex%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is it your intent that later defined
items are printed earlier in the document, at the instance ofprintlist? Alatableofcontents?– Steven B. Segletes
Apr 23 at 15:07
One can put pretty much anything into @currentlabel and use label and ref to access it. ( Pgfplots puts the entire legend into a ref.) All you need is a label naming convention.
– John Kormylo
Apr 23 at 15:21
An answer like this, tex.stackexchange.com/questions/202574/…, may be exactly what you are looking for.
– Steven B. Segletes
Apr 23 at 15:24