Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tikzducks v0.5 is incompatible with LuaLaTeX and XeLaTeX #14

Closed
yudai-nkt opened this issue Nov 23, 2017 · 6 comments
Closed

tikzducks v0.5 is incompatible with LuaLaTeX and XeLaTeX #14

yudai-nkt opened this issue Nov 23, 2017 · 6 comments

Comments

@yudai-nkt
Copy link

After updating TeX Live on my end, I got interested in how \randuck is implemented and found the following line. https://github.com/samcarter8/tikzducks/blob/2f69d05fef84253fb6ff60081c2eb5d78b72b653/tikzducks.sty#L767

LuaTeX of version 0.81.0 or higher and XeTeX don't have the primitive \pdfrandomseed whereas pdfTeX and e-(u)pTeX do. Therefore, the following MWE

\documentclass{article}
\usepackage{tikzducks}
\begin{document}
\end{document}

cannot be typeset with XeLaTeX and LuaLaTeX.

Solution with LuaLaTeX is easy; you only need to \let \pdfrandomseed to be \randomseed (possibly with version checking). There seems to have been a discussion about PRNG in XeTeX, but I don't have time to read all the thread at the moment and XeTeX doesn't have a primitive named \randomseed.

~$ xetex -interaction=nonstopmode "\show\randomseed\bye"
This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xetex)
 restricted \write18 enabled.
entering extended mode
> \randomseed=undefined.
<*> \show\randomseed
                    \bye
(see the transcript file for additional information)
No pages of output.
Transcript written on texput.log.
ghost pushed a commit that referenced this issue Nov 23, 2017
@ghost
Copy link

ghost commented Nov 23, 2017

@yudai-nkt Thanks a lot for reporting this bug!

I tried to implement a workaround which

  • uses the \randomseed you suggested for lualatex
  • uses a fixed seed for xelatex (and added a warning about this to the documentation).

@ghost ghost closed this as completed in 7d836bb Nov 23, 2017
@ghost
Copy link

ghost commented Nov 23, 2017

Now using \pgfmathsetseed{\time} for xelatex
Updates only once per minute, but generally works

@yudai-nkt
Copy link
Author

yudai-nkt commented Nov 23, 2017

Thank you for the quick fix! In addition to 7d836bb, something like

\RequirePackage{ifluatex}
\RequirePackage{ifxetex}

\ifluatex
  \let\pdfrandomseed\randomseed
\fi

\ifxetex
  \pgfmathsetseed{\time}
\else
  \pgfmathsetseed{\number\pdfrandomseed}
\fi

will utilize e-(u)pTeX's \pdfrandomseed, which can be a better seed (you aren't making an encryption, but it's better indeed), for (u)pLaTeX, which are Japanese variants of LaTeX. I'll be glad if you support the use of \pdfrandomseed in (u)pLaTeX as well although the number of users are considerably smaller than that of other engines.

My follow-up isn't a bug report but just a proposal of enhancement, so I never mean to rush you. Thanks again.

ghost pushed a commit that referenced this issue Nov 23, 2017
@ghost
Copy link

ghost commented Nov 23, 2017

@yudai-nkt Thanks a lot for your comment! I'll happily integrate your code suggestion into the package, no matter how big or small the number of users might be. If such a small change helps someone it is worth doing it (especially as I cannot see any real drawbacks of the new code). It works just fine from what I can tell!

I had already submitted the bug fix 7d836bb to CTAN in order to make the package usable again as soon as possible, so I will include ef333d1 only in the next version of the package.

Please report again, if you happen to notice any other problems between the tikzducks package and (u)pLaTeX (I have to admit, these are engines I don't use regularly -- in fact today was probably the first time I did :)

@yudai-nkt
Copy link
Author

no matter how big or small the number of users might be. If such a small change helps someone it is worth doing it

Much appreciated for the kind words. Also looking forward to the next release! ✨🦆

@samcarter
Copy link
Owner

@yudai-nkt Please excuse me for pinging you about this old thread, but I just made some changes about the random seed because as of 2019 xelatex now also supports the \randomseed primitive.

da3228e

Would you be able to test with (u)pLaTeX? I would be very grateful to hear your feedback! Thanks in advance!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants