You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When more than one random list is defined using \pgfmathdeclarerandomlist PGF seems to assume that all random lists have the length of the longest list with the result that \pgfmathrandomitem can return a list item that is not defined.
Minimal example
\documentclass{article}
\usepackage{pgfmath,pgffor}
\begin{document}
\parindent=0pt
\pgfmathdeclarerandomlist{short}{{A}{B}{C}{D}}
\pgfmathdeclarerandomlist{middle}{{a}{b}{c}{d}{e}{f}}
\pgfmathdeclarerandomlist{long}{{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}}
\foreach\c in {1,...,40} {
\pgfmathrandomitem{\short}{short}
\pgfmathrandomitem{\middle}{middle}
\pgfmathrandomitem{\long}{long}
\typeout{short = \short, middle = \middle, long = \long.}
short = \short, middle = \middle, long = \long.
}
\end{document}
The resulting PDF file shows that several list items are not defined. More revealingly, the log file contains lines like:
short = \pgfmath@randomlist@short@9 ,
middle = \pgfmath@randomlist@middle@9 ,
long = 8.
that show PGF is trying to assign list items that are not defined.
The text was updated successfully, but these errors were encountered:
Currently, after \pgfmathrandomitem{\short}{short}, \short is defined as \csname pgfmath@randomlist@short@\pgfmath@randomtemp\endcsname, where \pgfmath@randomtemp is the chosen list index. If the \pgfmath@randomtemp is then changed by following use of \pgfmathrandomitem before \short is used, the strange behavior occurs.
I've changed it so that \short will be defined as \pgfmath@randomlist@short@<index>.
It's much easier to track if you merge a PR regardless of how trivial so that github does the clean up and you don't need to mention the issue number in a commit.
When more than one random list is defined using
\pgfmathdeclarerandomlist
PGF seems to assume that all random lists have the length of the longest list with the result that\pgfmathrandomitem
can return a list item that is not defined.Minimal example
The resulting PDF file shows that several list items are not defined. More revealingly, the log file contains lines like:
that show PGF is trying to assign list items that are not defined.
The text was updated successfully, but these errors were encountered: