3

LuaTeX defines attributes.

Consider the following snippet (to be compiled with luatex):

\documentclass{article}
\newattribute\testattr
\usepackage{xcolor}
\colorlet{color1}{red}
\colorlet{color2}{blue}

\begin{document}

Test \setattribute\testattr{1} Test1 \setattribute\testattr{2} Test2

\end{document}

How can I use the value of attribute \testattr so that Test1 would be in red and Test2 would be in blue?

  • Have you looked over the code in luacolor? – Joseph Wright Aug 27 '16 at 10:11
  • @JosephWright No I haven't but it looks Indeed promising. Would you mind writing an answer? – cjorssen Aug 27 '16 at 10:28
  • I don't think it is fair to describe it as 'not documented'. The manual devotes considerable space to the code and breaks it down with some commentary. Maybe not sufficient explanation for you, but that's not the same as its being entirely undocumented. – cfr Sep 10 '16 at 0:27
  • @cfr Well, ok. Let me rephrase. I spent some time trying to figure out how ’traverse’ fonction works and, as I said, as a beginner in this field (node list manipulation, hlists, callbacks, etc), it is not that easy. Of course, Heiko's packages are amazing and his answers here are great. Sorry for being unfair on that matter. – cjorssen Sep 10 '16 at 6:44
  • 1
    That's fair. I don't understand any of it either. But I suspect Heiko would have to write several volumes to explain it from scratch ;). – cfr Sep 10 '16 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.