Tag Info

New answers tagged

1

I have no acces to comuter right now, so my answer will be short and non verifyed. I see three errors: In the for loop you can't let a space between } and { in the current version of tikzmath. Your draw command must be enclosed in { }; The coordinates in your draw command must be before the circle. You can check the following code: ...


2

For iterating over an elementary list of items, you can use an array-like structure/interface (similar to what one would expect in programming languages like C) provided by arrayjobx: \documentclass{article} \usepackage{multido,arrayjobx} \newarray\myrowlist\readarray{myrowlist}{r & \theta & z} \begin{document} ...


2

If you are willing to switch from etoolbox to the more powerful expl3 programming environment, you could do like this: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\newlist}{m} { \seq_new:c { g_sumanta_lists_#1_seq } } \newlist{myrow} % default \NewDocumentCommand{\additems}{O{myrow} m} { \clist_map_inline:nn { #2 ...


4

Try the routines \grabitem{number} to get the item from the list. It's not failsafe, of course. In general, it's better to use wrapper commands instead of doing stuff like \forcsvlist{\stepcounter...}{..} directly. \documentclass{article} \usepackage{etoolbox} \listadd\myrowlist{} \newcounter{itemcount} \newcommand{\additem}[2][\myrowlist]{% ...


1

This answer is essentially taken from Christian's post and modified a bit. The basic idea of the post is how does the \forlistloop work. This is an idea from "functional programming" and that is precisely one of the reasons why I could not understand how the \forlistloop worked etoolbox . The basic idea if I might say is as follows. ...


8

As Christian Hupfer comment that \foreach could be easier but his answer is about etoolbox, I have taken the liberty of make a MWE with \foreach because in this case is enough: \documentclass{article} \usepackage{pgffor} \pagestyle{empty} \begin{document} \foreach \ii in {1, 2, ...,4}{% \foreach \jj in {a, b, ...,d}{% ...


7

Here's a LuaLaTeX-based solution. Two examples of two-dimensional arrays constructed with Lua for loops are given. The first surrounds the i,j pairs with parentheses; the second embeds them in a LaTeX array enviroment -- note the use of & and \\ to separate cells within a row and across rows. % !TEX TS-program = lualatex \documentclass{article} ...


12

Some ideas with expl3: \documentclass{article} \usepackage{amsmath} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\doublelist}{m+O{}mO{}m} {% #1 = first list, #2 = code to execute at the end of the inner cycle % #3 = second list, #4 = code to execute between elements in the inner cycle % #5 = two argument macro to which items are passed ...


19

For example something like this: \long\def\for#1in#2#3{\expandafter\def\csname b:\string#1\endcsname{#3}% \forinA#1#2,,} \def\forinA#1#2,{\ifx,#2,\else \def#1{#2}\csname b:\string#1\endcsname \expandafter\forinA\expandafter#1\fi} \for\i in{a, bc, d} {% \for\j in{A, B, C} {% i=\i, j=\j;\par } }


11

This shows one way how to use a nested loop with etoolbox \forlistloop has two parameters: The second one is the list name, the first one is a list processor, i.e. what is to be done inside the loop. The best idea is to use a \newcommand macro which is expandable. This list processing macro can have a 'arbitrary' number of arguments, but the last one is ...


2

enumitem has always met my needs for lists. However, I'm not sure it is the best option here. multienum seems designed to do just what you want. It provides an environment multienumerate within which you can use commands such as \mitemx{} to define a line with a single item, \mitemxx{}{} for a line with 2 and so on. You can also say something like ...


1

The enumitem package version 3.0 provide inline lists (horizontal lists), for their use just add inline in the options when calling the package, this provides the environments enumerate*, itemize* and description* they can be used as follows \documentclass{article} \usepackage[inline]{enumitem} \newcommand{\inline}[1]{\stepcounter{enumi} \def\c{\theenumi} ...


2

I have found a workaround but still I am interested in your suggestions for a solution of the initial problem. I found out that lists are working just fine, so I decided to use a long list while for every "i" I just go 1000 entries higher and start save my entries at "i*1000+j". This may work even for multidimensional arrays depending on the maximum length ...


1

I don't think you want \pdfsavepos at all. You are not really interested in the coordinates of the figures when printed, you just want to use the numbering based on typeset order, so it is that order that you should record, not the position. Note figure numbering only gets out of order if you use non floating floats as the float mechanism goes to some ...



Top 50 recent answers are included